[Puppet Users] [augeas] ins before / after

2020-07-09 Thread Helmut Schneider

Hi,

I want to put values ordered in (here) sshd_config. I tried with 
ins...after but get only errors:


'sshd_config PrintMotd':
  context: '/files/etc/ssh/sshd_config'
  changes:
- 'set PrintMotd yes'
'sshd_config PasswordAuthentication':
  context: '/files/etc/ssh/sshd_config'
  changes:
- 'ins PasswordAuthentication after 
/files/etc/ssh/sshd_config/PrintMotd'

- 'set PasswordAuthentication no'

Error: /Stage[main]/My_sshd/Augeas[/files/etc/ssh/sshd_config: 
sshd_config PasswordAuthentication]: Could not evaluate: Save failed, 
see debug output for details


I want to add an entry "PasswordAuthentication no" after "PrintMotd 
yes". What is the correct syntax?


Thank you!

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/re7226%24bhj%241%40ciao.gmane.io.


[Puppet Users] Augeas and SSH

2019-09-24 Thread Helmut Schneider
Hi,

I want to set some values in sshd_config. Example:

KexAlgorithms
curve25519-sha...@libssh.org,diffie-hellman-group-exchange-sha256

keys($sshdCfg).each |String $comment| {
  augeas { "$file: $comment":
context => $sshdCfg[$comment]['context'],
changes => [ $sshdCfg[$comment]['changes'] ],
notify  => Service["${sshdService}"],
  }
}

'sshd_config Security Settings':
  context:   '/files/etc/ssh/sshd_config'
  changes:
- 'set KexAlgorithms
curve25519-sha...@libssh.org,diffie-hellman-group-exchange-sha256'

This does not work, error below. I can work around that with

'sshd_config Security Settings':
  context:   '/files/etc/ssh/sshd_config'
  changes:
- 'set KexAlgorithms/1 curve25519-sha...@libssh.org'
- 'set KexAlgorithms/2 diffie-hellman-group-exchange-sha256'

but this does not remove existing values 3, 4, 5, ... How can I solve
that?

Thank you!

Debug: /Stage[main]/My_sshd/Notify[sshd_config PrintMotd]: The
container Class[My_sshd] will propagate my refresh event
Debug: Augeas[: sshd_config PrintMotd](provider=augeas): Opening augeas
with root /, lens path , flags 32
Debug: Augeas[: sshd_config PrintMotd](provider=augeas): Augeas version
1.12.0 is installed
Debug: Augeas[: sshd_config PrintMotd](provider=augeas): Will attempt
to save and only run if files changed
Debug: Augeas[: sshd_config PrintMotd](provider=augeas): sending
command 'set' with params ["/files/etc/ssh/sshd_config/PrintMotd",
"yes"]
Debug: Augeas[: sshd_config PrintMotd](provider=augeas): Skipping
because no files were changed
Debug: Augeas[: sshd_config PrintMotd](provider=augeas): Closed the
augeas connection
Notice: {"context"=>"/files/etc/ssh/sshd_config", "changes"=>["set
KexAlgorithms
curve25519-sha...@libssh.org,curve25519-sha...@libssh.org"]}
Notice: /Stage[main]/My_sshd/Notify[sshd_config Security
Settings]/message: defined 'message' as {
  'context' => '/files/etc/ssh/sshd_config',
  'changes' => ['set KexAlgorithms
curve25519-sha...@libssh.org,curve25519-sha...@libssh.org']
}
Debug: /Stage[main]/My_sshd/Notify[sshd_config Security Settings]: The
container Class[My_sshd] will propagate my refresh event
Debug: Augeas[: sshd_config Security Settings](provider=augeas):
Opening augeas with root /, lens path , flags 32
Debug: Augeas[: sshd_config Security Settings](provider=augeas): Augeas
version 1.12.0 is installed
Debug: Augeas[: sshd_config Security Settings](provider=augeas): Will
attempt to save and only run if files changed
Debug: Augeas[: sshd_config Security Settings](provider=augeas):
sending command 'set' with params
["/files/etc/ssh/sshd_config/KexAlgorithms",
"curve25519-sha...@libssh.org,curve25519-sha...@libssh.org"]
Debug: Augeas[: sshd_config Security Settings](provider=augeas): Put
failed on one or more files, output from /augeas//error:
Debug: Augeas[: sshd_config Security Settings](provider=augeas):
/augeas/files/etc/ssh/sshd_config/error = put_failed
Debug: Augeas[: sshd_config Security Settings](provider=augeas):
/augeas/files/etc/ssh/sshd_config/error/path =
/files/etc/ssh/sshd_config/
Debug: Augeas[: sshd_config Security Settings](provider=augeas):
/augeas/files/etc/ssh/sshd_config/error/lens =
/usr/local/share/augeas/lenses/dist/sshd.aug:142.12-.47:

 { "#comment" = "$FreeBSD: releng/11.2/crypto/openssh/sshd_config
323136 2017-09-02 23:39:51Z des $" }
 {  }
 { "#comment" = "This is the sshd server system-wide configuration
file.  See" }
 { "#comment" = "sshd_config(5) for more information." }
 {  }
 { "#comment" = "This sshd was compiled with
PATH=/usr/bin:/bin:/usr/sbin:/sbin" }
 {  }
 { "#comment" = "The strategy used for options in the default
sshd_config shipped with" }
 { "#comment" = "OpenSSH is to specify options with their default
value where" }
 { "#comment" = "possible, but leave them commented.  Uncommented
options override the" }
 { "#comment" = "default value." }
 {  }
 { "#comment" = "Note that some of FreeBSD's defaults differ from
OpenBSD's, and" }
 { "#comment" = "FreeBSD has a few additional options." }
 {  }
 { "#comment" = "Port 22" }
 { "#comment" = "AddressFamily any" }
 { "#comment" = "ListenAddress 0.0.0.0" }
 { "#comment" = "ListenAddress ::" }
 {  }
 { "#comment" = "HostKey /etc/ssh/ssh_host_rsa_key" }
 { "#comment" = "HostKey /etc/ssh/ssh_host_dsa_key" }
 { "#comment" = "HostKey /etc/ssh/ssh_host_ecdsa_key" }
 { "#comment" = "HostKey /etc/ssh/ssh_host_ed25519_key" }
 {  }
 { "#comment" = "Ciphers and keying" }
 { "#comment" = "RekeyLimit default none" }
 {  }
 { "#comment" = "Logging" }
 { "#comment" = "SyslogFacility AUTH" }
 { "#comment" = "LogLevel INFO" }
 {  }
 { "#comment" = "Authentication:" }
 {  }
 { "#comment" = "LoginGraceTime 2m" }
 { "#comment" = "PermitRootLogin no" }
 { "#comment" = "StrictModes yes" }
 { "#comment" = "MaxAuthTries 6"
 { 

Re: [Puppet Users] [augeas] edit YAML file

2019-02-09 Thread Helmut Schneider
Ben Ford wrote:

> The https://forge.puppet.com/fiddyspence/hash_file module makes it
> very easy to manage yaml files.

Will check. Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/xn0lpxxcdwjcu8000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] [augeas] edit YAML file

2019-02-07 Thread Ben Ford
The https://forge.puppet.com/fiddyspence/hash_file module makes it very easy to 
manage yaml files.

Sent from my iPhone

> On Feb 7, 2019, at 4:47 PM, Helmut Schneider  wrote:
> 
> Hi,
> 
> I want to edit a YAML file:
> 
> network:
>  version: 2
>  renderer: networkd
>  ethernets:
>eth0:
>  dhcp4: yes
>  dhcp6: yes
> 
> Id like to add a line:
> 
> network:
>  version: 2
>  renderer: networkd
>  ethernets:
>eth0:
>  dhcp4: yes
>  dhcp6: yes
>  dhcp-identifier: mac
> 
> How can I do so?
> 
> Thank you!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/puppet-users/xn0lpwsm9ld5lb8000%40news.gmane.org.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/55259A86-56F3-446C-81B0-BBCD7B4A90ED%40puppet.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] [augeas] edit YAML file

2019-02-07 Thread Helmut Schneider
Hi,

I want to edit a YAML file:

network:
  version: 2
  renderer: networkd
  ethernets:
eth0:
  dhcp4: yes
  dhcp6: yes

Id like to add a line:

network:
  version: 2
  renderer: networkd
  ethernets:
eth0:
  dhcp4: yes
  dhcp6: yes
  dhcp-identifier: mac

How can I do so?

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/xn0lpwsm9ld5lb8000%40news.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas-1.5.0 to edit file using Puppet

2017-03-30 Thread Shrawan Bhagwat
Hi All,

I have configured Puppet 3.8.1 and Augeas 1.5.0.

I am trying to edit /etc/hosts file using augeas with following code:

augeas{'host_file':
context => "/files/etc/hosts",
changes => [
  "set ipaddr 192.168.0.1",
  "set canonical pigiron.example.com",
  "set alias[1] pigiron",
  "set alias[2] piggy",
],
}

When i am applying this config on Node, it's giving following error:
Error: /Stage[main]/Aug_mod::Configuration_files/Augeas[host_file]: Could 
not evaluate: undefined method `set' for #

Please guide.


-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/76dbf3da-c912-465b-981b-d19cda59df6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas and custom lenses?

2017-02-16 Thread otheus uibk
Ah, documented bug: https://tickets.puppetlabs.com/browse/FACT-696

On Thu, Feb 16, 2017 at 8:48 PM, otheus uibk  wrote:

> Dom, Sorry about resurrecting the old thread. About facts:  `facter -p`
> (2.4.6) shows puppet facts, but not the ones loaded via puppet modules in
> /var/lib/puppet/facts.d (unless --external-dir is specified). For that
> reason, perhaps, we started putting ours in /etc/facter.
>



-- 
Otheus
otheus.u...@gmail.com
otheus.shell...@uibk.ac.at

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CALbQNd2A6YEFhRG8jp3kAvBPEgQK10frdpazhyyy3G2ZaMigjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas and custom lenses?

2017-02-16 Thread otheus uibk
Dom, Sorry about resurrecting the old thread. About facts:  `facter -p`
(2.4.6) shows puppet facts, but not the ones loaded via puppet modules in
/var/lib/puppet/facts.d (unless --external-dir is specified). For that
reason, perhaps, we started putting ours in /etc/facter.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CALbQNd1VfgZtKcKkHbEfkQv7PP2KZA1FAKsbi-YDdVoampTi1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas and custom lenses?

2017-02-15 Thread Dominic Cleal
On 15/02/17 10:38, otheus uibk wrote:
> Hi Dom,
> 
> The puppet documentation you references is just slight on details (well,
> that could be said about lots of projects these days). 

If you're replying to a five year old thread(!), some context would be
handy. For reference:
https://docs.puppet.com/puppet/latest/plugins_in_modules.html

> Does puppet put such lenses in its own directory?

Yes, in the agent's libdir, under augeas/lenses/.

> Does puppet ensure such lenses override the "default" ones mentioned in the 
> augtool
> page?

Yes. The agent directory is specified as an include directory to Augeas,
which always has precedence over Augeas' default directories.

> All that is mentioned is "Facts and Augeas lenses are used solely
> by Puppet agent."  But that's not really true of facts, as their
> visibility, once installed, are global.

Custom facts from Puppet are read only when the additional agent
directory is included (i.e. with Facter's -p flag). Lenses work in a
very similar way - they are not installed globally.

-- 
Dominic Cleal
domi...@cleal.org

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c6104d3d-026e-04d9-c795-1592cc20a58b%40cleal.org.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas and custom lenses?

2017-02-15 Thread otheus uibk
Hi Dom,

The puppet documentation you references is just slight on details (well, 
that could be said about lots of projects these days). 
Does puppet put such lenses in its own directory? Does puppet ensure such 
lenses override the "default" ones mentioned in the augtool page? All that 
is mentioned is "Facts and Augeas lenses are used solely by Puppet agent." 
 But that's not really true of facts, as their visibility, once installed, 
are global.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9d03a137-c8b6-493f-80ad-5d7ebc4af642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas help

2016-06-10 Thread mike r
Hello, Im tryign to use Augeas in my manifest to manage /etc/fstab file

specifically I want to make sure my /etc/fstab file has the following line

/tmp /tmp nodev,noexec 0 0


Augeas syntax is like learning Chinese, Im trying to make my manifest 
figure out whether 

1) /etc/fstab has a line ^/tmp, if not add a new line with /tmp

2) if this line exists, then if it has nodev option, if not, append the 
'nodev' to this line (/tmp nodev)

3) if this line exists, check if noexec option is there, of not, append to 
the line (/tmp nodev, noexec)

anyone have idea how to actually write this out? Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/48405a04-ab52-4b78-bb05-64d4c3f59a1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas type: Removing an entry from /etc/hosts

2015-10-08 Thread Seth Rice
I know this is way late, by 5 years or so, but I wanted to share what I 
just discovered, related to your post. Since your post did help me discover 
it after all.  I only got into augeas 4 days ago, and puppet about a month 
ago. 

Though augeas is a harsh mistress, I found that you can do some good 
sudoers stuff with it. Also how to specify if you want it to wipe a 
matching entry and replace it, or just replace pieces of it. 

I have a module that has it's own user that will be created, and 
permissions granted in sudoers and locked down. Here is what I found works 
on the current opensource puppet today. 

This augeas (awe-geez) excerpt below is from the user manifest in that 
module. Above I have all the regular puppet jazz to create a user, it's 
home path, create keys, etc. It all references back to a params.pp file for 
the variables. I found that with puppet, things work more consistently if 
you use this type of setup for a variable. 

"${User}"

Double quotes, and braces between the $ and the actual variable. However 
Augeas doesn't like that setup. so once you start getting to the 'changes 
=> [ ' part, you need to change your variable statements to be what you'd 
have in bash. 

$User

Also note, as seen below, I use the double quotes for my commands when 
using a variable. Otherwise use single quotes. 

  augeas { "sudoers user ${User}":
   context  => '/files/etc/sudoers',
   changes  => [
"set spec[user = '$User']/user $User",
"set spec[user = '$User']/host_group/host ALL",
"set spec[user = '$User']/host_group/command ALL",
"set spec[user = '$User']/host_group/command/runas_user ALL",
"set spec[user = '$User']/host_group/command/tag NOPASSWD",
   ],
   require  => [ User[$User] ],
  }

  augeas { "sudoers user ${User} TTY":
   context  => '/files/etc/sudoers',
   changes  => [
"set Defaults[type = ':$User']/type :$User",
"set Defaults[type = ':$User']/requiretty/negate ''",
   ],
   require => [ augeas["sudoers user $User"] ],
  }

  augeas { "sudoers Cmnd_Alias ${CMNDALIAS}":
   context => '/files/etc/sudoers',
   changes => [
"rm  Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[.]",
"set Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/name $CMNDALIAS",
"set Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[1] 
/bin/cp",
"set Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[2] 
/bin/grep",
"set Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[3] 
/bin/date",
"set Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[4] 
/bin/ls",
"set Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[5] 
/bin/rm",
"set Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[6] 
/bin/mv",
   ],
   require => File['/etc/sudoers'],
  }


Now the key thing I wanted to point out that I just discovered in all this, 
is this line in the Cmnd_Alias section. 

"rm  Cmnd_Alias[alias/name = '$CMNDALIAS']/alias/command[.]",

There is a subtle difference between using a [.] or a [*]. Because I'm 
declaring which command goes in what order, the dot will match any command, 
and the * will match only the ones stated in this manifest, and ignore the 
rest. So I went to [6] in my command listing above. This means with a dot 
[.], it will blow away 1-6, as well as any others, like 7-999, or however 
high it can go. If I use the star [*], then it only replace 1-6, and leave 
7-999 or however high, well alone. 

Here is a command I've been running on the system I want to apply the 
changes on, to show me what augeas sees while I work. 

watch -n3 "augtool print /files/etc/sudoers | grep -Ei '(use 
r|host_group|alias|defaults\[11\])' | grep -Ev '(spec\[(1|2)\]|comment)'"

that output for me looks like this:

Every 3.0s: augtool print /files/etc/sudoers | grep ...  Thu Oct  8 
11:23:52 2015

/files/etc/sudoers/Defaults[6]/env_keep/var[5] = "USERNAME"
/files/etc/sudoers/spec[3]/user = "dude"
/files/etc/sudoers/spec[3]/host_group
/files/etc/sudoers/spec[3]/host_group/host = "ALL"
/files/etc/sudoers/spec[3]/host_group/command = "ALL"
/files/etc/sudoers/spec[3]/host_group/command/runas_user = "ALL"
/files/etc/sudoers/spec[3]/host_group/command/tag = "NOPASSWD"
/files/etc/sudoers/Defaults[11]
/files/etc/sudoers/Defaults[11]/type = ":dude"
/files/etc/sudoers/Defaults[11]/requiretty
/files/etc/sudoers/Defaults[11]/requiretty/negate
/files/etc/sudoers/Cmnd_Alias
/files/etc/sudoers/Cmnd_Alias/alias
/files/etc/sudoers/Cmnd_Alias/alias/name = "DUDEADMIN"
/files/etc/sudoers/Cmnd_Alias/alias/command[1] = "/bin/cp"
/files/etc/sudoers/Cmnd_Alias/alias/command[2] = "/bin/grep"
/files/etc/sudoers/Cmnd_Alias/alias/command[3] = "/bin/date"
/files/etc/sudoers/Cmnd_Alias/alias/command[4] = "/bin/ls"
/files/etc/sudoers/Cmnd_Alias/alias/command[5] = "/bin/rm"
/files/etc/sudoers/Cmnd_Alias/alias/command[6] = "/bin/mv"

So why does all this matter? As far as I can tell 

Re: [Puppet Users] Augeas failing when acting on smb.conf

2015-08-04 Thread Martin
Hi,

While no help at all for Augeas: Why don't you simply use a template? It
would also get rid of the exec at the end?

/Martin
On Mon 3 Aug 2015 at 23:04 Fabrizio Zelaya fabr...@gmail.com wrote:

 Hello everyone!

 I am trying to run puppet agent on a SL-6 Machine and one action I'm
 trying to apply is to add the machine to our domain. However I ran into an
 issue when running puppet agent -t

 Debug: Augeas[global](provider=augeas): Opening augeas with root /, lens
 path /var/lib/puppet/lib/augeas/lenses, flags 64
 Debug: Augeas[global](provider=augeas): Augeas version 1.0.0 is installed
 Warning: Augeas[global](provider=augeas): Loading failed for one or more
 files, see debug for /augeas//error output
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error = parse_failed
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/pos = 2545
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/line = 67
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/char = 0
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/lens =
 /usr/share/augeas/lenses/dist/inifile.aug:391.25-.43:
 Debug: Augeas[global](provider=augeas):
 /augeas/files/etc/samba/smb.conf/error/message = Get did not match entire
 input


 Unfortunately I am very new to augeas and don't really understand the
 references on this messages. So far I've seen that
  /usr/share/augeas/lenses/dist/inifile.aug:391.25-.43: refers to this
 piece of code   # *= comment* . record**


 I'm right now trying to understand if this is a permissions error or
 augeas version or syntax error but I haven't found much about what I'm
 reading on the debug output.

 Here's the versions of what I'm running.

 On Puppet Master

 ruby-augeas-0.4.1-3.el6.x86_64
 augeas-libs-1.0.0-7.el6.x86_64
 augeas-1.0.0-7.el6.x86_64

 puppet-3.8.1-1.el6.noarch
 puppetlabs-release-6-11.noarch
 puppet-server-3.8.1-1.el6.noarch


 On the agent

 taugeas-libs-1.0.0-7.el6.x86_64
 augeas-1.0.0-7.el6.x86_64
 ruby-augeas-0.4.1-3.el6.x86_64

 pe-puppet-enterprise-release-3.8.0.3-1.pe.el6.noarch
 puppet-3.8.1-1.el6.noarch
 puppetlabs-release-6-11.noarch

 Here's the code I'm using

 Samba init.pp

 # Samba base module.
 #
 class samba (
   $workgroup,
   $realm,
   $ensure = 'installed',
   $common_package = $samba::params::common_package,
   $server_pacakge = $samba::params::server_package,
   $winbind_package = $samba::params::winbind_package,
   $conf = $samba::params::conf,
   $winbind_service = $samba::params::winbind_service,
   $krb_package = $samba::params::krb_package,
   $krb_conf = $samba::params::krb_conf,
   $krb_keytab = $samba::params::krb_keytab,
 ) inherits samba::params {

   package { $common_package:
 ensure = $ensure,
   }

   augeas { 'global':
 incl= $conf,
 lens= 'Samba.lns',
 context = /files${conf}/*[. = \global\],
 changes = [
   set 'workgroup' ${workgroup},
   set 'realm' ${realm},
   set 'password server' *,
   set 'security' ads,
   set 'template shell' /bin/bash,
   set 'winbind use default domain' true,
   set 'winbind offline logon' true,
   set 'winbind rpc only' true,
   set 'winbind normalize names' true,
   set 'winbind refresh tickets' true,
   set 'idmap config * : backend' rid,
   set 'idmap config * : range' 16777216-33554431,
   set 'kerberos method' 'secrets and keytab',
   set 'local master' no,
   rm 'idmap uid',
   rm 'idmap gid',
   rm 'idmap backend',
 ],
   }

   exec { /bin/sed -i -r -e \/^\\s*([;#].*)?\$/ d\ -e \s/^\\s*([^[])/
  \\1/\ -e \s/^[[].*/\\n/\ ${conf}:
 refreshonly = true,
 subscribe   = Augeas['global'],
   }

 }

 For Samba param.pp
 # Samba module parameters.
 #
 class samba::params {

   case $::osfamily {

 'RedHat': {

   if $::operatingsystemmajrelease == '5' {
 $base_name = 'samba3x'
   } else {
 $base_name = 'samba'
   }

   $server_package = $base_name
   $common_package = ${base_name}-common
   $winbind_package = ${base_name}-winbind

   $conf = '/etc/samba/smb.conf'

   $winbind_service = 'winbind'

   $krb_package = 'krb5-workstation'
   $krb_conf = '/etc/krb5.conf'
   $krb_keytab = '/etc/krb5.keytab'

 }

 default: {
   fail('Unsupported operating system')
 }

   }

 }


 Would appreciate any help you can give me. Thanks in advance







 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/2fab346b-e0a4-42eb-85c3-d81fc37f6b0e%40googlegroups.com
 

[Puppet Users] Augeas failing when acting on smb.conf

2015-08-03 Thread Fabrizio Zelaya
Hello everyone!

I am trying to run puppet agent on a SL-6 Machine and one action I'm trying 
to apply is to add the machine to our domain. However I ran into an issue 
when running puppet agent -t

Debug: Augeas[global](provider=augeas): Opening augeas with root /, lens 
path /var/lib/puppet/lib/augeas/lenses, flags 64
Debug: Augeas[global](provider=augeas): Augeas version 1.0.0 is installed
Warning: Augeas[global](provider=augeas): Loading failed for one or more 
files, see debug for /augeas//error output
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error = parse_failed
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/pos = 2545
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/line = 67
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/char = 0
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/lens = 
/usr/share/augeas/lenses/dist/inifile.aug:391.25-.43:
Debug: Augeas[global](provider=augeas): 
/augeas/files/etc/samba/smb.conf/error/message = Get did not match entire 
input


Unfortunately I am very new to augeas and don't really understand the 
references on this messages. So far I've seen that 
 /usr/share/augeas/lenses/dist/inifile.aug:391.25-.43: refers to this piece 
of code   # *= comment* . record**


I'm right now trying to understand if this is a permissions error or augeas 
version or syntax error but I haven't found much about what I'm reading on 
the debug output.

Here's the versions of what I'm running.

On Puppet Master

ruby-augeas-0.4.1-3.el6.x86_64
augeas-libs-1.0.0-7.el6.x86_64
augeas-1.0.0-7.el6.x86_64

puppet-3.8.1-1.el6.noarch
puppetlabs-release-6-11.noarch
puppet-server-3.8.1-1.el6.noarch


On the agent

taugeas-libs-1.0.0-7.el6.x86_64
augeas-1.0.0-7.el6.x86_64
ruby-augeas-0.4.1-3.el6.x86_64

pe-puppet-enterprise-release-3.8.0.3-1.pe.el6.noarch
puppet-3.8.1-1.el6.noarch
puppetlabs-release-6-11.noarch

Here's the code I'm using

Samba init.pp

# Samba base module.
#
class samba (
  $workgroup,
  $realm,
  $ensure = 'installed',
  $common_package = $samba::params::common_package,
  $server_pacakge = $samba::params::server_package,
  $winbind_package = $samba::params::winbind_package,
  $conf = $samba::params::conf,
  $winbind_service = $samba::params::winbind_service,
  $krb_package = $samba::params::krb_package,
  $krb_conf = $samba::params::krb_conf,
  $krb_keytab = $samba::params::krb_keytab,
) inherits samba::params {

  package { $common_package:
ensure = $ensure,
  }

  augeas { 'global':
incl= $conf,
lens= 'Samba.lns',
context = /files${conf}/*[. = \global\],
changes = [
  set 'workgroup' ${workgroup},
  set 'realm' ${realm},
  set 'password server' *,
  set 'security' ads,
  set 'template shell' /bin/bash,
  set 'winbind use default domain' true,
  set 'winbind offline logon' true,
  set 'winbind rpc only' true,
  set 'winbind normalize names' true,
  set 'winbind refresh tickets' true,
  set 'idmap config * : backend' rid,
  set 'idmap config * : range' 16777216-33554431,
  set 'kerberos method' 'secrets and keytab',
  set 'local master' no,
  rm 'idmap uid',
  rm 'idmap gid',
  rm 'idmap backend',
],
  }

  exec { /bin/sed -i -r -e \/^\\s*([;#].*)?\$/ d\ -e \s/^\\s*([^[])/ 
 \\1/\ -e \s/^[[].*/\\n/\ ${conf}:
refreshonly = true,
subscribe   = Augeas['global'],
  }

}

For Samba param.pp
# Samba module parameters.
#
class samba::params {

  case $::osfamily {

'RedHat': {

  if $::operatingsystemmajrelease == '5' {
$base_name = 'samba3x'
  } else {
$base_name = 'samba'
  }

  $server_package = $base_name
  $common_package = ${base_name}-common
  $winbind_package = ${base_name}-winbind

  $conf = '/etc/samba/smb.conf'

  $winbind_service = 'winbind'

  $krb_package = 'krb5-workstation'
  $krb_conf = '/etc/krb5.conf'
  $krb_keytab = '/etc/krb5.keytab'

}

default: {
  fail('Unsupported operating system')
}

  }

}


Would appreciate any help you can give me. Thanks in advance







-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2fab346b-e0a4-42eb-85c3-d81fc37f6b0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas: Skipping because no files were changed

2015-07-08 Thread Chris Lee
Thanks Ian,

I had tried with and without the context, also tried with set and setm, 
tried to include the values first... but nothing worked.

I was about to go insane and through to remove the trailing slash in the 
changes... 

augeas { 'grub.conf/8250_LAR':
incl = '/etc/grub.conf',
lens= 'Grub.lns',
changes = [
'set title[1]/kernel/8250.nr_uarts 4',
'set title[1]/kernel/8250_core.nr_uarts 4',
],
}
 and now it works, with and without the context.. but I'll put it back in 
anyway just in case.

Thanks!

Chris


On Wednesday, 8 July 2015 05:23:59 UTC+2, ianm wrote:



 Actually in this case it needs: 

context = '/files/boot/grub/grub.conf', 

 or: 

context = '/files/etc/grub.conf', 
incl = '/etc/grub.conf', 


 -- 
 Ian 


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/789e685d-04b9-4918-b044-34e6f96e9b7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas: Skipping because no files were changed

2015-07-07 Thread Ian Mortimer
On Tue, 2015-07-07 at 07:33 -0700, Chris Lee wrote:

 I am trying to add two new options to grub.conf using augeas.
 The code is as follows:
 
 augeas { 'grub.conf/8250_LAR':
 tag = chris1,
 incl= '/boot/grub/grub.conf',
 lens= 'Grub.lns',
 changes = [
 'set /title[1]/kernel/8250.nr_uarts 8',
 'set /title[1]/kernel/8250_core.nr_uarts 8',
 ],
 }

This needs:

   context = '/files/etc/grub.conf',


-- 
Ian

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1436324375.3994.75.camel%40its-ep-84lxwx1.its.uq.edu.au.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas: Skipping because no files were changed

2015-07-07 Thread Ian Mortimer
On Tue, 2015-07-07 at 07:33 -0700, Chris Lee wrote:

 I am trying to add two new options to grub.conf using augeas.
 The code is as follows:
 
 augeas { 'grub.conf/8250_LAR':
 tag = chris1,
 incl= '/boot/grub/grub.conf',
 lens= 'Grub.lns',
 changes = [
 'set /title[1]/kernel/8250.nr_uarts 8',
 'set /title[1]/kernel/8250_core.nr_uarts 8',
 ],
 }

Actually in this case it needs:

   context = '/files/boot/grub/grub.conf',

or:

   context = '/files/etc/grub.conf',
   incl = '/etc/grub.conf',


-- 
Ian

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/1436325812.3994.77.camel%40its-ep-84lxwx1.its.uq.edu.au.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas: Skipping because no files were changed

2015-07-07 Thread Chris Lee
I am trying to add two new options to grub.conf using augeas.
The code is as follows:

augeas { 'grub.conf/8250_LAR':
tag = chris1,
incl= '/boot/grub/grub.conf',
lens= 'Grub.lns',
changes = [
'set /title[1]/kernel/8250.nr_uarts 8',
'set /title[1]/kernel/8250_core.nr_uarts 8',
],
}


However nothing is added to /etc/grub.conf at all, and the puppet run 
completes as follows with debug.

Debug: Augeas[grub.conf/8250_LAR](provider=augeas): Augeas version 1.0.0 is 
installed
Debug: Augeas[grub.conf/8250_LAR](provider=augeas): Will attempt to save and 
only run if files changed
Debug: Augeas[grub.conf/8250_LAR](provider=augeas): sending command 'set' 
with params [/title[*]/kernel/8250.nr_uarts, 8]
Debug: Augeas[grub.conf/8250_LAR](provider=augeas): sending command 'set' 
with params [/title[*]/kernel/8250_core.nr_uarts, 8]
Debug: Augeas[grub.conf/8250_LAR](provider=augeas): Skipping because no 
files were changed
Debug: Augeas[grub.conf/8250_LAR](provider=augeas): Closed the augeas 
connection

Manually, Augeas appears to work fine:

augtool set /files/boot/grub/grub.conf/title[1]/kernel/8250_core.nr_uarts 8
augtool save
Saved 1 file(s)

I'd appreciate any ideas?


Thanks
Chris

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/9f4a854d-e3b3-4be1-b7f2-5d495dba21d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas resource type for Windows?

2015-06-04 Thread Josh Cooper
On Wed, Jun 3, 2015 at 8:38 AM, Charlie Baum charlieb...@gmail.com wrote:

 I want to use Augeas to manage/change some XML files using my puppet
 manifest.  I'd really prefer not to use templates, and Augeas seems like it
 does what I want.

 However when I try it, my Windows event log says there is no suitable
 provider for Augeas.  Is that provider not supported on Windows?  Is any
 Augeas provider available for Windows boxes?  I see some in puppetforge but
 none claim to support Windows.



  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/e66b2285-700b-40af-9396-ca47b15964e3%40googlegroups.com
 https://groups.google.com/d/msgid/puppet-users/e66b2285-700b-40af-9396-ca47b15964e3%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


From puppet's perspective, the augeas provider is only suitable if puppet
can load the ruby-augeas bindings, which in turn load the augeas native
libraries.

In the default Puppet MSI install, neither the ruby-augeas bindings nor
augeas native libraries are provided, so the provider is not suitable out
of the box. However, you may be able to compile augeas for windows and
install the ruby-augeas gem... I haven't done that myself, so I'm not sure
how well that'll work out.

Josh

-- 
Josh Cooper
Developer, Puppet Labs

*PuppetConf 2015 http://2015.puppetconf.com/ is coming to Portland,
Oregon! Join us October 5-9.*
*Register now to take advantage of the Early Adopter discount
https://www.eventbrite.com/e/puppetconf-2015-october-5-9-tickets-13115894995?discount=EarlyAdopter
*
*—**save $349!*

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2Bu97umitTf7iEgv5J-fgMTONX9eu86dEun5T1%2B1p3FMgBSN4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas resource type for Windows?

2015-06-03 Thread Charlie Baum
I want to use Augeas to manage/change some XML files using my puppet 
manifest.  I'd really prefer not to use templates, and Augeas seems like it 
does what I want.

However when I try it, my Windows event log says there is no suitable 
provider for Augeas.  Is that provider not supported on Windows?  Is any 
Augeas provider available for Windows boxes?  I see some in puppetforge but 
none claim to support Windows.  



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e66b2285-700b-40af-9396-ca47b15964e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas editing of fstab

2015-03-23 Thread Wil Cooley
On Fri, Mar 20, 2015 at 7:20 AM Anthony Clark dizzysau...@gmail.com wrote:

 Hi there,

 I'm trying to add the nobarrier option to our XFS mount options in
 /etc/fstab using Augeas.  I've tried this:


Could you perhaps post working and failing examples of fstab entries?

Wil

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMmm3r7BnYySLJhjG%2BwZu3Qr46BfY-Dmz%3DDBNPvxwAP74Yqycg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas editing of fstab

2015-03-20 Thread Anthony Clark
Hi there,

I'm trying to add the nobarrier option to our XFS mount options in 
/etc/fstab using Augeas.  I've tried this:

augeas { 'fstabxfsnobarrier': context = '/files/etc/fstab', changes = [ 
'rm /*[vfstype=xfs]/opt', 'ins opt after vfstype=xfs', 'set 
/*[vfstype=xfs]/opt[last()] defaults', 'ins opt after vfstype=xfs', 
'set /*[vfstype=xfs]/opt[last()] nobarrier', ], }

But that isn't working. Now in the past I've done something similar with 
ext4 and /var, which does work:

if defined(Package['mysql55-server']) { augeas { 'fstabvarext4entry': 
context = '/files/etc/fstab/*[file=/var][vfstype=ext4]', changes = [ 
'rm opt', 'ins opt after vfstype[last()]', 'set opt[last()] defaults', 
'ins opt after opt[last()]', 'set opt[last()] noatime', 'ins opt after 
opt[last()]', 'set opt[last()] data', 'set opt[last()]/value 
writeback', 'ins opt after opt[last()]', 'set opt[last()] barrier', 
'set opt[last()]/value 0', 'ins opt after opt[last()]', 'set opt[last()] 
nobh', 'ins opt after opt[last()]', 'set opt[last()] errors', 'set 
opt[last()]/value remount-ro', ], } }

Can Augeas only edit one line at a time, i.e. am I not allowed to do add 
this option to every matching line?

Any help would be greatly appreciated!

Anthony

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/b35760e2-37d6-4d07-9c2d-b0cecd2c05bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas fstab - removing all opt nodes then rebuilding

2015-02-04 Thread Anthony Clark
Hello All,

I have a requirement to mount /var with specific options if mysql-server is 
installed and the filesystem is ext4.  So far I have this:

  if defined(Package['mysql55-server']) {
notice found mysql server

augeas { 'fstabvarentry':
  context = '/files/etc/fstab/*[file=/var][vfstype=ext4]',
  changes = [
'', # remove all opt nodes
'ins opt[1] defaults',
'ins opt[2] noatime',
# etc etc to build 
defaults,noatime,data=writeback,barrier=0,nobh,errors=remount-ro
  ],
  onlyif  = 'match /files/etc/fstab/*[file=/var][vfstype=ext4]',
}
  }

Now, my problem is how to deal with all possible opt entries for the /var 
partition.  I want to start off by removing *all* opt nodes then adding the 
ones I need, but I am having trouble finding the syntax on how to remove 
all opt nodes.

How can I write rm opt* ?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/156ba202-76f4-4d91-8e92-dfed187da948%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas failure - any ideas?

2014-12-10 Thread James Green
  augeas { 'postfix-master-smtp-inet' :
context = /files/etc/postfix/master.cf,
changes = [
  set smtp[type = inet]/private n,
  set smtp[type = inet]/unprivileged -,
  set smtp[type = inet]/chroot n,
  set smtp[type = inet]/wakeup -,
  set smtp[type = inet]/limit 10,
  'set smtp[type = inet]/command smtpd -o
content_filter=smtptorestgw:dummy',
],
require = Package['postfix'],
notify  = Service['postfix'],
  }

On the server:

Debug: Augeas[postfix-master-smtp-inet](provider=augeas): Opening augeas
with root /, lens path , flags 32
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): Augeas version
1.2.0 is installed
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): Will attempt to
save and only run if files changed
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): sending command
'set' with params [/files/etc/postfix/master.cf/smtp[type =
inet]/private, n]
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): sending command
'set' with params [/files/etc/postfix/master.cf/smtp[type =
inet]/unprivileged, -]
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): sending command
'set' with params [/files/etc/postfix/master.cf/smtp[type = inet]/chroot,
n]
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): sending command
'set' with params [/files/etc/postfix/master.cf/smtp[type = inet]/wakeup,
-]
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): sending command
'set' with params [/files/etc/postfix/master.cf/smtp[type = inet]/limit,
10]
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): sending command
'set' with params [/files/etc/postfix/master.cf/smtp[type =
inet]/command, smtpd -o content_filter=smtptorestgw:dummy]
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): Put failed on one
or more files, output from /augeas//error:
Debug: Augeas[postfix-master-smtp-inet](provider=augeas):
/augeas/files/etc/postfix/master.cf/error = put_failed
Debug: Augeas[postfix-master-smtp-inet](provider=augeas):
/augeas/files/etc/postfix/master.cf/error/path = /files/etc/postfix/
master.cf/smtp
Debug: Augeas[postfix-master-smtp-inet](provider=augeas):
/augeas/files/etc/postfix/master.cf/error/lens =
/usr/share/augeas/lenses/dist/postfix_master.aug:39.18-47.21:
Debug: Augeas[postfix-master-smtp-inet](provider=augeas):
/augeas/files/etc/postfix/master.cf/error/message = Failed to match
{ /type/ = /inet|unix|fifo|pass/ }{ /private/ = /y|n|-/ }{
/unprivileged/ = /y|n|-/ }{ /chroot/ = /y|n|-/ }{ /wakeup/ =
/([0-9]+|-)\\??/ }{ /limit/ = /([0-9]+|-)\\??/ }{ /command/ =
/[!$,-.0-:=@-Z_a-{}]([!$,-.0-:=@-Z_a-{}]|[]\/[]|
)*([!$,-.0-:=@-Z_a-{}]|[]\/[])([\t ]*\n[\t
]+[!$,-.0-:=@-Z_a-{}]([!$,-.0-:=@-Z_a-{}]|[]\/[]|
)*([!$,-.0-:=@-Z_a-{}]|[]\/[]))*/ }
  with tree
{ private = n }
Debug: Augeas[postfix-master-smtp-inet](provider=augeas): Closed the augeas
connection
Error: /Stage[main]/custom_postfix::Sasl/Augeas[postfix-master-smtp-inet]:
Could not evaluate: Saving failed, see debug

Any ideas?

Thanks,

James

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMH6%2BayVPziXijP1A67rubah_iE-ryski6RF8Er3z4QfD2FR0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas inittab whitespaces and single/double quotes, backslash

2014-11-03 Thread Oleksandr Yudin
Hi everyone.   I am attempting to add this line to /etc/inittab:

TS0:23:respawn:/sbin/mgetty -m ' \d\dAT OK' ttyS0


Here is the puppet manifest I am trying to make:

  augeas {/etc/inittab:
context = /files/etc/inittab,
changes = [
set TS0/runlevels 23,
set TS0/action respawn,
set TS0/process '/sbin/mgetty -m \'\\ \\d\\dAT OK\' ttyS0',
],
}


Here is the pertinent debug output from a manual run feeding that code to 
puppet:

debug: Augeas[/etc/inittab](provider=augeas): Opening augeas with root /, 
lens path , flags 0
debug: Augeas[/etc/inittab](provider=augeas): Augeas version 0.10.0 is 
installed
debug: Augeas[/etc/inittab](provider=augeas): Will attempt to save and only 
run if files changed
debug: Augeas[/etc/inittab](provider=augeas): sending command 'set' with 
params [/files/etc/inittab/TS0/runlevels, 23]
debug: Augeas[/etc/inittab](provider=augeas): sending command 'set' with 
params [/files/etc/inittab/TS0/action, respawn]
debug: Augeas[/etc/inittab](provider=augeas): sending command 'set' with 
params [/files/etc/inittab/TS0/process, /sbin/mgetty -m ]
debug: Augeas[/etc/inittab](provider=augeas): Executing 'diff -u 
/etc/inittab /etc/inittab.augnew'
notice: Augeas[/etc/inittab](provider=augeas): 
--- /etc/inittab2014-11-03 13:38:21.644041304 +
+++ /etc/inittab.augnew 2014-11-03 13:40:56.088022067 +
@@ -71,3 +71,4 @@
 #
 #
 #
+TS0:23:respawn:/sbin/mgetty -m 

debug: Augeas[/etc/inittab](provider=augeas): Files changed, should execute
debug: Augeas[/etc/inittab](provider=augeas): sending command 'set' with 
params [/files/etc/inittab/TS0/runlevels, 23]
debug: Augeas[/etc/inittab](provider=augeas): sending command 'set' with 
params [/files/etc/inittab/TS0/action, respawn]
debug: Augeas[/etc/inittab](provider=augeas): sending command 'set' with 
params [/files/etc/inittab/TS0/process, /sbin/mgetty -m ]
debug: Augeas[/etc/inittab](provider=augeas): Closed the augeas connection


Can anyone show me the proper way to shape this line with whitespaces and 
single/double quotes into inittab using augeas and puppet?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/474bdc13-b2c3-48e4-a87a-55f98a046dab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas and idempotency

2014-10-20 Thread Kenton Brede
I'd like to add a this file managed by puppet line to the top of the
files I manage with augeas.

This works but is not idempotent.  I could add an onlyif but then if I want
to change SELINUX to off I won't be able to, since the comment will
always exist.

augeas { 'selinux_config':
  context = '/files/etc/selinux/config',
  changes = [
'ins #comment before #comment[1]',
'set #comment[1] TEST',
'set SELINUX on',
  ],
}


I I tried the following but get error Error:
/Stage[main]/Test_module/Augeas[selinux_config]: Could not evaluate: Saving
failed, see debug

If I remove the 'ins' line the comment is added and it's idempotent, but of
course the comment is at the bottom of the file.

augeas { 'selinux_config':
  context = '/files/etc/selinux/config',
  changes = [
'ins #comment before #comment[1]',
'set #comment[. = TEST ] TEST',
'set SELINUX on',
  ],
}

Is there any way to get this to work or am I just beating my head against
the wall for nothing?
Thanks,

-- 
Kent Brede

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas and idempotency

2014-10-20 Thread Trevor Vaughan
Being a file with only two options, do you need to use Augeas? Why not just
manage the whole file?

The only time you wouldn't do this is if you expect someone to
independently change variables in the file either by hand or with another
tool later and you do not want to change them back.

Trevor

On Mon, Oct 20, 2014 at 11:26 AM, Kenton Brede kbr...@gmail.com wrote:

 I'd like to add a this file managed by puppet line to the top of the
 files I manage with augeas.

 This works but is not idempotent.  I could add an onlyif but then if I
 want to change SELINUX to off I won't be able to, since the comment will
 always exist.

 augeas { 'selinux_config':
   context = '/files/etc/selinux/config',
   changes = [
 'ins #comment before #comment[1]',
 'set #comment[1] TEST',
 'set SELINUX on',
   ],
 }


 I I tried the following but get error Error:
 /Stage[main]/Test_module/Augeas[selinux_config]: Could not evaluate: Saving
 failed, see debug

 If I remove the 'ins' line the comment is added and it's idempotent, but
 of course the comment is at the bottom of the file.

 augeas { 'selinux_config':
   context = '/files/etc/selinux/config',
   changes = [
 'ins #comment before #comment[1]',
 'set #comment[. = TEST ] TEST',
 'set SELINUX on',
   ],
 }

 Is there any way to get this to work or am I just beating my head against
 the wall for nothing?
 Thanks,

 --
 Kent Brede

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaug...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CANs%2BFoUpdNjfBg8anYasU-dF-DqC74sgme4LHHbs7aUwnv4qcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas and idempotency

2014-10-20 Thread Kenton Brede
This is a proof of concept if you will.  Just using this as a simple
example.  I've got a lot of files I'd like to add a managed by Puppet
header to.

There's two camps.  Manage the whole file or edit in place.  I realize
Puppet users are mostly of the former.  I'm of the latter.
Thanks,
Kent

On Mon, Oct 20, 2014 at 3:37 PM, Trevor Vaughan tvaug...@onyxpoint.com
wrote:

 Being a file with only two options, do you need to use Augeas? Why not
 just manage the whole file?

 The only time you wouldn't do this is if you expect someone to
 independently change variables in the file either by hand or with another
 tool later and you do not want to change them back.

 Trevor

 On Mon, Oct 20, 2014 at 11:26 AM, Kenton Brede kbr...@gmail.com wrote:

 I'd like to add a this file managed by puppet line to the top of the
 files I manage with augeas.

 This works but is not idempotent.  I could add an onlyif but then if I
 want to change SELINUX to off I won't be able to, since the comment will
 always exist.

 augeas { 'selinux_config':
   context = '/files/etc/selinux/config',
   changes = [
 'ins #comment before #comment[1]',
 'set #comment[1] TEST',
 'set SELINUX on',
   ],
 }


 I I tried the following but get error Error:
 /Stage[main]/Test_module/Augeas[selinux_config]: Could not evaluate: Saving
 failed, see debug

 If I remove the 'ins' line the comment is added and it's idempotent, but
 of course the comment is at the bottom of the file.

 augeas { 'selinux_config':
   context = '/files/etc/selinux/config',
   changes = [
 'ins #comment before #comment[1]',
 'set #comment[. = TEST ] TEST',
 'set SELINUX on',
   ],
 }

 Is there any way to get this to work or am I just beating my head against
 the wall for nothing?
 Thanks,

 --
 Kent Brede

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




 --
 Trevor Vaughan
 Vice President, Onyx Point, Inc
 (410) 541-6699
 tvaug...@onyxpoint.com

 -- This account not approved for unencrypted proprietary information --

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CANs%2BFoUpdNjfBg8anYasU-dF-DqC74sgme4LHHbs7aUwnv4qcg%40mail.gmail.com
 https://groups.google.com/d/msgid/puppet-users/CANs%2BFoUpdNjfBg8anYasU-dF-DqC74sgme4LHHbs7aUwnv4qcg%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
Kent Brede

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE39OgGKh4myQKA-KE%2BB7NASTjjnyZmY5o4YW-PifVa%2BFXw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas and idempotency

2014-10-20 Thread Trevor Vaughan
It comes down to your use case.

You may find that writing custom types/providers is easier than using
Augeas (it certainly is for me in general).

Also, remember that editing LOTS of files creates LOTS of resources and
relationships which means a longer compile time (fewer nodes able to be
managed) and longer runs/more resources used on your clients.

I prefer to keep things as efficient as possible and only edit parts of
files when I have requirements from other users to do so. Otherwise, you
could end up with (quite literally) tens of thousands of resources and
relationships. Then you'll be back asking why everything is so slow ;-).

Trevor

On Mon, Oct 20, 2014 at 5:31 PM, Kenton Brede kbr...@gmail.com wrote:

 This is a proof of concept if you will.  Just using this as a simple
 example.  I've got a lot of files I'd like to add a managed by Puppet
 header to.

 There's two camps.  Manage the whole file or edit in place.  I realize
 Puppet users are mostly of the former.  I'm of the latter.
 Thanks,
 Kent

 On Mon, Oct 20, 2014 at 3:37 PM, Trevor Vaughan tvaug...@onyxpoint.com
 wrote:

 Being a file with only two options, do you need to use Augeas? Why not
 just manage the whole file?

 The only time you wouldn't do this is if you expect someone to
 independently change variables in the file either by hand or with another
 tool later and you do not want to change them back.

 Trevor

 On Mon, Oct 20, 2014 at 11:26 AM, Kenton Brede kbr...@gmail.com wrote:

 I'd like to add a this file managed by puppet line to the top of the
 files I manage with augeas.

 This works but is not idempotent.  I could add an onlyif but then if I
 want to change SELINUX to off I won't be able to, since the comment will
 always exist.

 augeas { 'selinux_config':
   context = '/files/etc/selinux/config',
   changes = [
 'ins #comment before #comment[1]',
 'set #comment[1] TEST',
 'set SELINUX on',
   ],
 }


 I I tried the following but get error Error:
 /Stage[main]/Test_module/Augeas[selinux_config]: Could not evaluate: Saving
 failed, see debug

 If I remove the 'ins' line the comment is added and it's idempotent,
 but of course the comment is at the bottom of the file.

 augeas { 'selinux_config':
   context = '/files/etc/selinux/config',
   changes = [
 'ins #comment before #comment[1]',
 'set #comment[. = TEST ] TEST',
 'set SELINUX on',
   ],
 }

 Is there any way to get this to work or am I just beating my head
 against the wall for nothing?
 Thanks,

 --
 Kent Brede

  --
 You received this message because you are subscribed to the Google
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3904TTdfbuwBNpkykUtLEBY01201h7aTNWGkWYLYg34NQ%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




 --
 Trevor Vaughan
 Vice President, Onyx Point, Inc
 (410) 541-6699
 tvaug...@onyxpoint.com

 -- This account not approved for unencrypted proprietary information --

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CANs%2BFoUpdNjfBg8anYasU-dF-DqC74sgme4LHHbs7aUwnv4qcg%40mail.gmail.com
 https://groups.google.com/d/msgid/puppet-users/CANs%2BFoUpdNjfBg8anYasU-dF-DqC74sgme4LHHbs7aUwnv4qcg%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




 --
 Kent Brede




  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE39OgGKh4myQKA-KE%2BB7NASTjjnyZmY5o4YW-PifVa%2BFXw%40mail.gmail.com
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE39OgGKh4myQKA-KE%2BB7NASTjjnyZmY5o4YW-PifVa%2BFXw%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




-- 
Trevor Vaughan
Vice President, Onyx Point, Inc
(410) 541-6699
tvaug...@onyxpoint.com

-- This account not approved for unencrypted proprietary information --

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: [Puppet Users] augeas, sshd and multiple onlyif requirements

2014-10-12 Thread Chris

On 10/10/14 16:29, John Warburton wrote:

On 10 October 2014 13:34, Chris dmag...@gmail.com
mailto:dmag...@gmail.com wrote:


Any help, suggestions, alternatives would be greatly appreciated.


Stop using Augeas and start using templates
https://docs.puppetlabs.com/guides/templating.html


I didn't want to go that far, so I persisted with the other approach.

Instead of doing this:

augeas{'sshd-config-client-alive-interval':
  context = '/files/etc/ssh/sshd_config',
  changes = [
'ins ClientAliveInterval before Match',
'set ClientAliveInterval 3600',
  ],
  onlyif = [
'match ClientAliveInterval size == 0',
'match Match size  0',
  ],
}

I did this:

augeas{'sshd-config-client-alive-interval':
  context = '/files/etc/ssh/sshd_config',
  changes = [
'rm ClientAliveInterval', # Make sure it's gone so it won't be 
set multiple times

'ins ClientAliveInterval before Match',
'set ClientAliveInterval 3600',
  ],
  onlyif = [
'match Match size  0',
  ],
}

and augeas is smart enough (much smarter than me) to only run that once 
(subsequent runs don't keep removing it and re-adding it).


Cheers,
--
Postgresql  php tutorials
http://www.designmagick.com/

--
You received this message because you are subscribed to the Google Groups Puppet 
Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/543B540F.5040002%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas, sshd and multiple onlyif requirements

2014-10-09 Thread Chris

Hi all,

I'm trying to insert a ClientAliveInterval setting into sshd_config with 
augeas. Some servers have a Match User line (so the new setting needs 
to come before the Match User line), and some don't. Some already have 
a ClientAliveInterval setting, and some don't.


My first attempt was this:

augeas{'sshd-config-client-alive-interval':
  context = '/files/etc/ssh/sshd_config',
  changes = [
'ins ClientAliveInterval before Match',
'set ClientAliveInterval 3600',
  ],
  onlyif = [
'match ClientAliveInterval size == 0',
'match Match size  0',
  ],
}

But it's not checking both onlyif requirements before trying to add the 
new setting. Reversing the order tries to add it to configs with the 
option already set which also causes a failure.



I've read a few posts that suggest putting both match requirements into 
one setting, but I can't get the syntax right.


augeas{'sshd-config-client-alive-interval':
  context = '/files/etc/ssh/sshd_config',
  changes = [
'ins ClientAliveInterval before Match',
'set ClientAliveInterval 3600',
  ],
  onlyif = [
'match /files/etc/ssh/sshd_config[(match 
/files/etc/ssh/sshd_config include ClientAliveInterval) size == 0 and 
(match /files/etc/ssh/sshd_config include Match) size  0] size  0',

  ],
}

Any help, suggestions, alternatives would be greatly appreciated.

Using augeas 1.0.0 from scientific linux 6, puppet 2.7.

Thanks!
--
Postgresql  php tutorials
http://www.designmagick.com/

--
You received this message because you are subscribed to the Google Groups Puppet 
Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/543745AC.80108%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] augeas, sshd and multiple onlyif requirements

2014-10-09 Thread John Warburton
On 10 October 2014 13:34, Chris dmag...@gmail.com wrote:


 Any help, suggestions, alternatives would be greatly appreciated.


Stop using Augeas and start using templates
https://docs.puppetlabs.com/guides/templating.html

Here's an extreme example from the the most popular SSH module
https://forge.puppetlabs.com/saz/ssh on the forge -
https://github.com/saz/puppet-ssh/blob/master/templates/sshd_config.erb,
although I find Garrett's easier to read if you were new to templating -
https://github.com/ghoneycutt/puppet-module-ssh/blob/master/templates/sshd_config.erb

John

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAAJLFxUJdfFy0JUrQNV%2B%2BXhqNE9hjUS6xRh29XzXKTGOeaizzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas and multiple values attribute

2014-08-19 Thread Vadym Chepkov
Hi,

How can I use puppet's augeas type to configure parameters with multiple values?
For instance, sshd_config can have multiple HostKeys parameters:

augtool print /files/etc/ssh/sshd_config/HostKey
/files/etc/ssh/sshd_config/HostKey[1] = /etc/ssh/ssh_host_rsa_key
/files/etc/ssh/sshd_config/HostKey[2] = /etc/ssh/ssh_host_dsa_key

How would puppet's manifest look like to have only two HostKey and configured 
the way shown?

Thanks,
Vadym

smime.p7s
Description: S/MIME cryptographic signature


Re: [Puppet Users] Augeas hates me!!!

2014-08-14 Thread Poil

Hi,

I think you can use file_line from stdlib 
https://forge.puppetlabs.com/puppetlabs/stdlib#file_line

It's really more simple than Augeas and it works better.

For multi-line I also use editfile a custom module, but you need to be 
good with regex =) https://github.com/mstrauss/puppet-editfile


Best regards,

Le 12/08/2014 22:22, randal cobb a écrit :

Hello, all!

I am trying to add some new modules to an openSuse 13.1 host with 
Puppet and Augeas with no luck.  The modules themselves are already 
installed by the example42/apache module, but I can't get the 
apache::module syntax to properly add the modules to the proper 
openSuse config files.  So, I'm opting for Augeas to do the 
dirty-work.  I have the following definition in the server's manifest 
(dev-apache.pp) file (the apache::module command are still there, but 
don't work, so the augeas section is the brute-force attempt; I just 
included them both so you can see the current state of this class 
manifest):


|
...

apache::module{'status':}
apache::module{'asis':}
apache::module{'auth_digest':}
apache::module{'headers':}
apache::module{'proxy':}
apache::module{'proxy_http':}
apache::module{'rewrite':}
apache::module{'vhost_alias':}
apache::module{'authz_default':}
apache::module{'proxy_balancer':}

augeas {'apache2':
context =/files/etc/sysconfig/apache2,
lens =sysconfig.lns,
incl ='/usr/share/augeas/lenses/dist/',
changes =
'set APACHE_MODULES actions alias auth_basic authn_file
authz_host authz_groupfile authz_user autoindex cgi dir env
expires include log_config mime negotiation setenvif ssl userdir
reqtimeout authn_core authz_core status asis auth_digest headers
proxy proxy_http rewrite vhost_alias authz_default proxy_balancer',
}
...
|


When running the agent in --debug --verbose --test, I get this debug 
output from augeas:


|
Debug:Augeas[apache2](provider=augeas):Openingaugeas withroot /,lens 
path ,flags 64

Debug:Augeas[apache2](provider=augeas):Augeasversion 1.0.0isinstalled
Debug:Augeas[apache2](provider=augeas):Willattempt to save andonly run 
iffiles changed
Debug:Augeas[apache2](provider=augeas):sending command 
'set'withparams[/files/etc/sysconfig/apache2/APACHE_MODULES,actions 
alias auth_basic authn_file authz_host authz_groupfile authz_user 
autoindex cgi dir env expires include log_config mime negotiation 
setenvif ssl userdir reqtimeout authn_core authz_core status asis 
auth_digest headers proxy proxy_http rewrite vhost_alias authz_default 
proxy_balancer]
Debug:Augeas[apache2](provider=augeas):Skippingbecause nofiles were 
changed

Debug:Augeas[apache2](provider=augeas):Closedthe augeas connection
|


No errors, but the file is marked as unchanged.

Before the puppet run, /etc/sysconfig/apache2 contains this line:
APACHE_MODULES=foo
and obviously, it's the same afterwards.

Any insight into what I may be doing wrong?

--
You received this message because you are subscribed to the Google 
Groups Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to puppet-users+unsubscr...@googlegroups.com 
mailto:puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3d666f47-8b6e-436a-8791-a15e50ab9771%40googlegroups.com 
https://groups.google.com/d/msgid/puppet-users/3d666f47-8b6e-436a-8791-a15e50ab9771%40googlegroups.com?utm_medium=emailutm_source=footer.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups Puppet 
Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/53EC545D.1000709%40quake.fr.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas hates me!!!

2014-08-12 Thread randal cobb
Hello, all!

I am trying to add some new modules to an openSuse 13.1 host with Puppet 
and Augeas with no luck.  The modules themselves are already installed by 
the example42/apache module, but I can't get the apache::module syntax to 
properly add the modules to the proper openSuse config files.  So, I'm 
opting for Augeas to do the dirty-work.  I have the following definition in 
the server's manifest (dev-apache.pp) file (the apache::module command are 
still there, but don't work, so the augeas section is the brute-force 
attempt; I just included them both so you can see the current state of this 
class manifest):
 

 ...

 apache::module { 'status': }
 apache::module { 'asis': }
 apache::module { 'auth_digest': }
 apache::module { 'headers': }
 apache::module { 'proxy': }
 apache::module { 'proxy_http': }
 apache::module { 'rewrite': }
 apache::module { 'vhost_alias': }
 apache::module { 'authz_default': }
 apache::module { 'proxy_balancer': }

 augeas { 'apache2':
 context = /files/etc/sysconfig/apache2,
 lens= sysconfig.lns,
 incl= '/usr/share/augeas/lenses/dist/',
 changes =
 'set APACHE_MODULES actions alias auth_basic authn_file 
 authz_host authz_groupfile authz_user autoindex cgi dir env expires include 
 log_config mime negotiation setenvif ssl userdir reqtimeout authn_core 
 authz_core status asis auth_digest headers proxy proxy_http rewrite 
 vhost_alias authz_default proxy_balancer',
 }
 ...


When running the agent in --debug --verbose --test, I get this debug output 
from augeas:

Debug: Augeas[apache2](provider=augeas): Opening augeas with root /, lens 
path , flags 64
Debug: Augeas[apache2](provider=augeas): Augeas version 1.0.0 is installed
Debug: Augeas[apache2](provider=augeas): Will attempt to save and only run 
if files changed
Debug: Augeas[apache2](provider=augeas): sending command 'set' with params [
/files/etc/sysconfig/apache2/APACHE_MODULES, actions alias auth_basic 
authn_file authz_host authz_groupfile authz_user autoindex cgi dir env 
expires include log_config mime negotiation setenvif ssl userdir reqtimeout 
authn_core authz_core status asis auth_digest headers proxy proxy_http 
rewrite vhost_alias authz_default proxy_balancer]
Debug: Augeas[apache2](provider=augeas): Skipping because no files were 
changed
Debug: Augeas[apache2](provider=augeas): Closed the augeas connection


No errors, but the file is marked as unchanged.  

Before the puppet run, /etc/sysconfig/apache2 contains this line:
APACHE_MODULES=foo
and obviously, it's the same afterwards.

Any insight into what I may be doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/3d666f47-8b6e-436a-8791-a15e50ab9771%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] augeas error with erwbgy/system module

2014-07-02 Thread Dominic Cleal
On 01/07/14 21:38, Arpin Dominique (Nter) wrote:
 Hi,
 
 I install the erwbgy/system module, I have those errors :
 
 Debug: Augeas[ntp-servers](provider=augeas): Opening augeas with root /, lens 
 path , flags 64
 Debug: Augeas[ntp-servers](provider=augeas): Augeas version 1.2.0 is installed
 Warning: Augeas[ntp-servers](provider=augeas): Loading failed for one or more 
 files, see debug for /augeas//error output
 Debug: Augeas[ntp-servers](provider=augeas): /augeas/files/etc/ntp.conf/error 
 = parse_failed
 Debug: Augeas[ntp-servers](provider=augeas): 
 /augeas/files/etc/ntp.conf/error/pos = 163
 Debug: Augeas[ntp-servers](provider=augeas): 
 /augeas/files/etc/ntp.conf/error/line = 8
 Debug: Augeas[ntp-servers](provider=augeas): 
 /augeas/files/etc/ntp.conf/error/char = 0
 Debug: Augeas[ntp-servers](provider=augeas): 
 /augeas/files/etc/ntp.conf/error/lens = 
 /usr/share/augeas/lenses/dist/ntp.aug:126.14-129.45:
 Debug: Augeas[ntp-servers](provider=augeas): 
 /augeas/files/etc/ntp.conf/error/message = Iterated lens matched less than it 
 should
 Debug: Augeas[ntp-servers](provider=augeas): Will attempt to save and only 
 run if files changed
 Debug: Augeas[ntp-servers](provider=augeas): Closed the augeas connection
 Error: /Stage[main]/Ntp::Config/Augeas[ntp-servers]: Could not evaluate: 
 Unknown command
 
 I'm using Puppet 3.6.2 with RHEL 5 32bits clients...
 
 Someone had this error?

It's a problem parsing ntp.conf on line 8.  Please open a ticket at
https://github.com/hercules-team/augeas/issues and include a copy of
ntp.conf so we can see the issue.

Cheers,

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/53B41781.8080001%40redhat.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas error with erwbgy/system module

2014-07-01 Thread Arpin Dominique (Nter)
Hi,

I install the erwbgy/system module, I have those errors :

Debug: Augeas[ntp-servers](provider=augeas): Opening augeas with root /, lens 
path , flags 64
Debug: Augeas[ntp-servers](provider=augeas): Augeas version 1.2.0 is installed
Warning: Augeas[ntp-servers](provider=augeas): Loading failed for one or more 
files, see debug for /augeas//error output
Debug: Augeas[ntp-servers](provider=augeas): /augeas/files/etc/ntp.conf/error = 
parse_failed
Debug: Augeas[ntp-servers](provider=augeas): 
/augeas/files/etc/ntp.conf/error/pos = 163
Debug: Augeas[ntp-servers](provider=augeas): 
/augeas/files/etc/ntp.conf/error/line = 8
Debug: Augeas[ntp-servers](provider=augeas): 
/augeas/files/etc/ntp.conf/error/char = 0
Debug: Augeas[ntp-servers](provider=augeas): 
/augeas/files/etc/ntp.conf/error/lens = 
/usr/share/augeas/lenses/dist/ntp.aug:126.14-129.45:
Debug: Augeas[ntp-servers](provider=augeas): 
/augeas/files/etc/ntp.conf/error/message = Iterated lens matched less than it 
should
Debug: Augeas[ntp-servers](provider=augeas): Will attempt to save and only run 
if files changed
Debug: Augeas[ntp-servers](provider=augeas): Closed the augeas connection
Error: /Stage[main]/Ntp::Config/Augeas[ntp-servers]: Could not evaluate: 
Unknown command

I'm using Puppet 3.6.2 with RHEL 5 32bits clients...

Someone had this error?

Regards,


 Dominique Arpin
 Administrateur de systèmes
 Infrastructure et Exploitation - Support

 [cid:image001.jpg@01CF954A.DE5E6340]
 1801 Mc Gill Collège, Montréal Qc, H3A 2N4
 T 514 285.2929 Poste 140-4156

 S.V.P. PENSEZ À L'ENVIRONNEMENT AVANT D'IMPRIMER CE MESSAGE

Mise en garde concernant la confidentialité : Le présent message, comprenant 
tout fichier qui y est joint, est envoyé à l'intention exclusive de son 
destinataire; il est de nature confidentielle et peut constituer une 
information protégée par le secret professionnel. Si vous n'êtes pas le 
destinataire, nous vous avisons que toute impression, copie, distribution ou 
autre utilisation de ce message est strictement interdite. Si vous avez reçu ce 
courriel par erreur, veuillez en aviser immédiatement l'expéditeur par retour 
de courriel et supprimer le courriel. Merci!

Confidentiality Warning: This message, including any attachment, is sent only 
for the use of the intended recipient; it is confidential and may constitute 
privileged information. If you are not the intended recipient, you are hereby 
notified that any printing, copying, distribution or other use of this message 
is strictly prohibited. If you have received this email in error, please notify 
the sender immediately by return email, and delete it. Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/C2F62CDF5915D0458F0528664315BAE756FCB254%40MTL1EXC01.scqmtl.loto-quebec.com.
For more options, visit https://groups.google.com/d/optout.
attachment: winmail.dat

Re: [Puppet Users] augeas for setting URIEncoding variable in tomcat, server.xml file.

2014-05-08 Thread Kenton Brede
Try something like this:

augeas { 'update_server.xml':
  lens= 'Xml.lns',
  context   =
'/files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*]/#attribute/',

  incl = /opt/apphome/apache-tomcat-7.0.53/conf/server.xml,
  changes = ['ins URIEncoding after port[. = 8080]',
   'set URIEncoding UTF-8',
  ],
}

The context is actually the path as augeas sees it.  I wildcarded
Connector because there can be more than one.  For example Connector[1]
and Connector[2].

For changes its actually doing this:

Insert URIEncoding after, Connector with port=8080, and set URIEncoding
to UTF-8.

It helps to use augtool if you haven't.  Try something like:

$ augtool --transform Xml.lns incl
/opt/apphome/apache-tomcat-7.0.53/conf/server.xml
augtool print /files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml
augtool print
/files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*]

Kent




On Wed, May 7, 2014 at 3:40 PM, Pradeep Reddy pradeep.nars...@gmail.comwrote:

 Hi Team,

 I am using below info in my manifest.  URIEncoding=UTF-8 is not present
 in server.xml.  Trying to inject URIEncoding using below augeas syntax.

  augeas { 'update_server.xml':
 lens= 'Xml.lns',
 incl =
 /opt/apphome/apache-tomcat-7.0.53/conf/server.xml,
 context=
 '/opt/apphome/apache-tomcat-7.0.53/conf/server.xml'/Connector port=8080',
 changes   = flatten([
   set
 Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding
 UTF-8,]),
   }

 After executing getting below information.  URIEncoding=UTF-8 is not
 getting appended in server.xml.

 Could someone please check and let me know, wehther i am using a wrong
 syntax.


 Debug: Augeas[update_server.xml](provider=augeas): Opening augeas with
 root /, lens path , flags 64
 Debug: Augeas[update_server.xml](provider=augeas): Augeas version 1.0.0 is
 installed
 Debug: Augeas[update_server.xml](provider=augeas): Will attempt to save
 and only run if files changed
 Debug: Augeas[update_server.xml](provider=augeas): sending command 'set'
 with params
 [\${brand::tomcat_installdir}/${brand::tomcat_version}/conf/server.xml\/Connector
 port=\8080\/Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding,
 UTF-8]
 Debug: Augeas[update_server.xml](provider=augeas): Skipping because no
 files were changed
 Debug: Augeas[update_server.xml](provider=augeas): Closed the augeas
 connection

 Regards,
 Pradeeo.

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
Kent Brede

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] augeas for setting URIEncoding variable in tomcat, server.xml file.

2014-05-08 Thread Pradeep Reddy
Thx Kent.
 On 8 May 2014 18:25, Kenton Brede kbr...@gmail.com wrote:

 Try something like this:

 augeas { 'update_server.xml':
   lens= 'Xml.lns',
   context   =
 '/files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*]/#attribute/',

   incl = /opt/apphome/apache-tomcat-7.0.53/conf/server.xml,
   changes = ['ins URIEncoding after port[. = 8080]',
'set URIEncoding UTF-8',
   ],
 }

 The context is actually the path as augeas sees it.  I wildcarded
 Connector because there can be more than one.  For example Connector[1]
 and Connector[2].

 For changes its actually doing this:

 Insert URIEncoding after, Connector with port=8080, and set URIEncoding
 to UTF-8.

 It helps to use augtool if you haven't.  Try something like:

 $ augtool --transform Xml.lns incl
 /opt/apphome/apache-tomcat-7.0.53/conf/server.xml
 augtool print /files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml
 augtool print
 /files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*]

 Kent




 On Wed, May 7, 2014 at 3:40 PM, Pradeep Reddy 
 pradeep.nars...@gmail.comwrote:

 Hi Team,

 I am using below info in my manifest.  URIEncoding=UTF-8 is not present
 in server.xml.  Trying to inject URIEncoding using below augeas syntax.

  augeas { 'update_server.xml':
 lens= 'Xml.lns',
 incl =
 /opt/apphome/apache-tomcat-7.0.53/conf/server.xml,
 context=
 '/opt/apphome/apache-tomcat-7.0.53/conf/server.xml'/Connector port=8080',
 changes   = flatten([
   set
 Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding
 UTF-8,]),
   }

 After executing getting below information.  URIEncoding=UTF-8 is not
 getting appended in server.xml.

 Could someone please check and let me know, wehther i am using a wrong
 syntax.


 Debug: Augeas[update_server.xml](provider=augeas): Opening augeas with
 root /, lens path , flags 64
 Debug: Augeas[update_server.xml](provider=augeas): Augeas version 1.0.0
 is installed
 Debug: Augeas[update_server.xml](provider=augeas): Will attempt to save
 and only run if files changed
 Debug: Augeas[update_server.xml](provider=augeas): sending command 'set'
 with params
 [\${brand::tomcat_installdir}/${brand::tomcat_version}/conf/server.xml\/Connector
 port=\8080\/Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding,
 UTF-8]
 Debug: Augeas[update_server.xml](provider=augeas): Skipping because no
 files were changed
 Debug: Augeas[update_server.xml](provider=augeas): Closed the augeas
 connection

 Regards,
 Pradeeo.

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




 --
 Kent Brede




  --
 You received this message because you are subscribed to a topic in the
 Google Groups Puppet Users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/puppet-users/9h5JjWZpOYM/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.comhttps://groups.google.com/d/msgid/puppet-users/CA%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CALk7d%2BfSu_SQ8j7rcxr%2BnkYTGhzR78A4ud3qwXNTXr9u8dtu_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] augeas for setting URIEncoding variable in tomcat, server.xml file.

2014-05-08 Thread Kenton Brede
And that's not going to work so hot because you're going to keep getting
this on every run:

Error: /Stage[main]/Test_module/Augeas[update_server.xml]: Could not
evaluate: Saving failed, see debug

To avoid this you can use an onlyif.

onlyif  = 'match URIEncoding[. = UTF-8] size == 0',

This will match any URIEncoding=UTF-8 in any Connector section.  So it
won't work properly if you already have URIEncoding=UTF-8 defined for
another Connector.

What a person needs to do is match port=8080 and URIEncoding=UTF-8.
But I'm pressed for time and need to get going.

Hopefully this will get you down the road a bit further.  Someone else may
chime in here with a better solution.
Kent


On Thu, May 8, 2014 at 11:29 AM, Pradeep Reddy pradeep.nars...@gmail.comwrote:

 Thx Kent.
  On 8 May 2014 18:25, Kenton Brede kbr...@gmail.com wrote:

 Try something like this:

 augeas { 'update_server.xml':
   lens= 'Xml.lns',
   context   =
 '/files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*]/#attribute/',

   incl = /opt/apphome/apache-tomcat-7.0.53/conf/server.xml,
   changes = ['ins URIEncoding after port[. = 8080]',
'set URIEncoding UTF-8',
   ],
 }

 The context is actually the path as augeas sees it.  I wildcarded
 Connector because there can be more than one.  For example Connector[1]
 and Connector[2].

 For changes its actually doing this:

 Insert URIEncoding after, Connector with port=8080, and set
 URIEncoding to UTF-8.

 It helps to use augtool if you haven't.  Try something like:

 $ augtool --transform Xml.lns incl
 /opt/apphome/apache-tomcat-7.0.53/conf/server.xml
 augtool print /files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml
 augtool print
 /files/opt/apphome/apache-tomcat-7.0.53/conf/server.xml/Server/Service/Connector[*]

 Kent




 On Wed, May 7, 2014 at 3:40 PM, Pradeep Reddy 
 pradeep.nars...@gmail.comwrote:

 Hi Team,

 I am using below info in my manifest.  URIEncoding=UTF-8 is not
 present in server.xml.  Trying to inject URIEncoding using below augeas
 syntax.

  augeas { 'update_server.xml':
 lens= 'Xml.lns',
 incl =
 /opt/apphome/apache-tomcat-7.0.53/conf/server.xml,
 context=
 '/opt/apphome/apache-tomcat-7.0.53/conf/server.xml'/Connector port=8080',
 changes   = flatten([
   set
 Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding
 UTF-8,]),
   }

 After executing getting below information.  URIEncoding=UTF-8 is not
 getting appended in server.xml.

 Could someone please check and let me know, wehther i am using a wrong
 syntax.


 Debug: Augeas[update_server.xml](provider=augeas): Opening augeas with
 root /, lens path , flags 64
 Debug: Augeas[update_server.xml](provider=augeas): Augeas version 1.0.0
 is installed
 Debug: Augeas[update_server.xml](provider=augeas): Will attempt to save
 and only run if files changed
 Debug: Augeas[update_server.xml](provider=augeas): sending command 'set'
 with params
 [\${brand::tomcat_installdir}/${brand::tomcat_version}/conf/server.xml\/Connector
 port=\8080\/Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding,
 UTF-8]
 Debug: Augeas[update_server.xml](provider=augeas): Skipping because no
 files were changed
 Debug: Augeas[update_server.xml](provider=augeas): Closed the augeas
 connection

 Regards,
 Pradeeo.

  --
 You received this message because you are subscribed to the Google
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




 --
 Kent Brede




  --
 You received this message because you are subscribed to a topic in the
 Google Groups Puppet Users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/puppet-users/9h5JjWZpOYM/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CA%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.comhttps://groups.google.com/d/msgid/puppet-users/CA%2BnSE3-%3D_xA2eP65yy95o2%3DZGEkH4ZhSj%3DhhUUWb%3Dvm5wMNpww%40mail.gmail.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion 

[Puppet Users] augeas for setting URIEncoding variable in tomcat, server.xml file.

2014-05-07 Thread Pradeep Reddy
Hi Team,

I am using below info in my manifest.  URIEncoding=UTF-8 is not present 
in server.xml.  Trying to inject URIEncoding using below augeas syntax.

 augeas { 'update_server.xml':
lens= 'Xml.lns',
incl = /opt/apphome/apache-tomcat-7.0.53/conf/server.xml,
context= 
'/opt/apphome/apache-tomcat-7.0.53/conf/server.xml'/Connector port=8080',
changes   = flatten([
  set 
Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding
 
UTF-8,]),
  }

After executing getting below information.  URIEncoding=UTF-8 is not 
getting appended in server.xml.

Could someone please check and let me know, wehther i am using a wrong 
syntax.


Debug: Augeas[update_server.xml](provider=augeas): Opening augeas with root 
/, lens path , flags 64
Debug: Augeas[update_server.xml](provider=augeas): Augeas version 1.0.0 is 
installed
Debug: Augeas[update_server.xml](provider=augeas): Will attempt to save and 
only run if files changed
Debug: Augeas[update_server.xml](provider=augeas): sending command 'set' 
with params 
[\${brand::tomcat_installdir}/${brand::tomcat_version}/conf/server.xml\/Connector
 
port=\8080\/Server/Service/Connector[1][#attribute/redirectport='8443']/#attribute/URIEncoding,
 
UTF-8]
Debug: Augeas[update_server.xml](provider=augeas): Skipping because no 
files were changed
Debug: Augeas[update_server.xml](provider=augeas): Closed the augeas 
connection

Regards,
Pradeeo.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/6a327ad9-347a-493a-b32a-89b46645e22b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas Question

2014-04-28 Thread Pete Hartman
I hope this is an appropriate place for this question; if not, any 
redirection to a more appropriate place is appreciated.

So: I'm trying to set up puppet + augeas on an opensolaris system.  There 
are certain files I have that are under RCS version control--this is not 
all my doing, so some of these things I cannot change.  This creates files 
under /etc/ that are like filename,v.

I'm using puppet 2.7.22 and augeas 1.0.0.

Well, augtool, and apparently augeas invoked via puppet throw up on this. 
 Augtool reports

Failed to initialize Augeas
error: Invalid path expression
error: garbage at end of path expression
/augeas/files/etc/default/nfs|=|,v

I just want augeas to ignore these files...

I think the answer is to modify the 
/usr/local/share/augeas/lenses/dist/*.aug files that refer to things that 
are causing this grief and add excl clauses to explicitly exclude anything 
*,v. 

For example in shellvars.aug we have

let filter_default = incl /etc/default/*
. excl /etc/default/grub_installdevice*
. excl /etc/default/whoopsie

I've added 
. excl /etc/default/*,v

This appears to work.  But I'm not sure this is the right solution -- 
should I perhaps be making a copy of this to somewhere else and override 
the dist version?  Is there a more global way I could say ignore all files 
that have ,v after them ?

Thanks

Pete

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/017535fd-ff18-48e5-83eb-50d5f35b1a9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas Question

2014-04-28 Thread Kenton Brede
Not ab augeas expert but IIRC what I did in a similar situation is force
puppet/augeas to point to only one file.

Try adding context, incl, and lens to your augeas definition, like
the example below.  By specifying the lens, I think it helps speed up the
augeas type also.  At least I read that somewhere.  :)

  augeas { 'selinux_config':
context = '/files/etc/selinux/config',
incl= '/etc/selinux/config',
lens= 'Shellvars.lns',
changes = set SELINUX ${selinux_state},
  }

If I need to customize a lens, I stick it in /usr/share/augeas/lenses and
manage it with puppet.  I leave the lenses in /dist/ alone.
Kent


On Mon, Apr 28, 2014 at 2:56 PM, Pete Hartman pete.hart...@gmail.comwrote:

 I hope this is an appropriate place for this question; if not, any
 redirection to a more appropriate place is appreciated.

 So: I'm trying to set up puppet + augeas on an opensolaris system.  There
 are certain files I have that are under RCS version control--this is not
 all my doing, so some of these things I cannot change.  This creates files
 under /etc/ that are like filename,v.

 I'm using puppet 2.7.22 and augeas 1.0.0.

 Well, augtool, and apparently augeas invoked via puppet throw up on this.
  Augtool reports

 Failed to initialize Augeas
 error: Invalid path expression
 error: garbage at end of path expression
 /augeas/files/etc/default/nfs|=|,v

 I just want augeas to ignore these files...

 I think the answer is to modify the
 /usr/local/share/augeas/lenses/dist/*.aug files that refer to things that
 are causing this grief and add excl clauses to explicitly exclude anything
 *,v.

 For example in shellvars.aug we have

 let filter_default = incl /etc/default/*
 . excl /etc/default/grub_installdevice*
 . excl /etc/default/whoopsie

 I've added
 . excl /etc/default/*,v

 This appears to work.  But I'm not sure this is the right solution --
 should I perhaps be making a copy of this to somewhere else and override
 the dist version?  Is there a more global way I could say ignore all files
 that have ,v after them ?

 Thanks

 Pete

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/017535fd-ff18-48e5-83eb-50d5f35b1a9e%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/017535fd-ff18-48e5-83eb-50d5f35b1a9e%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
Kent Brede

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE38O8YSwLa9fbA1NCihs6DaHqkZedShiHPd_%2B%2BgdZ1z%2BKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] augeas with puppet : cannot update line

2014-04-23 Thread Kenton Brede
First, it looks to me like you have a typo.  I don't have a my.cnf handy
ATM but I'd think setbind-adress should be setbind-address.

Second, do you have augeas-libs installed on your target system?  The
system you wish the changes to be made need
/usr/share/augeas/lenses/dist/* in place.

I successfully executed your enable-ip-forwarding augeas type and it
works fine.

Kent


On Tue, Apr 22, 2014 at 11:31 AM, cheniour ghassen ghacheni...@gmail.comwrote:

 Hi everyone,
 I am new in puppet. In fact i am trying to update bind-address in the
 mysql file '/etc/mysql/my.cnf
 i wrote the this code in manifests/nodes.pp


 augeas {  'update-bind-address':
 context   = '/files/etc/mysql/my.cnf',
 changes = ['setbind-adress 192.168.80.135'],
 }


 when i tape the papply command :puppet ignore this code and do not
 compile it. I tried other examples by changing the files but puppet keeps
 ignoring them.
 The only example that works is this one

 augeas {  'enable-ip-forwarding':
   context   = '/files/etc/sysctl.conf',
   changes = ['set net.ipv4.ip_forward 1'],
 }


 I really don't know what is going on here. I have quite a while now.
 Any help would be apperciated.Thanks.

 sincerely,
 ghassen Cheniour

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/f335c2d7-b41f-4d65-9a83-0bdc65ac23dc%40googlegroups.comhttps://groups.google.com/d/msgid/puppet-users/f335c2d7-b41f-4d65-9a83-0bdc65ac23dc%40googlegroups.com?utm_medium=emailutm_source=footer
 .
 For more options, visit https://groups.google.com/d/optout.




-- 
Kent Brede

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE38S-LyfUUU%2B%3DfAm%2BRpEBX7tDRk83vS8fpbyzkRtR_BELA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas with puppet : cannot update line

2014-04-22 Thread cheniour ghassen
Hi everyone,
I am new in puppet. In fact i am trying to update bind-address in the mysql 
file '/etc/mysql/my.cnf
i wrote the this code in manifests/nodes.pp


augeas {  'update-bind-address':
 context   = '/files/etc/mysql/my.cnf',
 changes = ['setbind-adress 192.168.80.135'],
 }


when i tape the papply command :puppet ignore this code and do not 
compile it. I tried other examples by changing the files but puppet keeps 
ignoring them.
The only example that works is this one 

augeas {  'enable-ip-forwarding':
   context   = '/files/etc/sysctl.conf',
   changes = ['set net.ipv4.ip_forward 1'],
 }


I really don't know what is going on here. I have quite a while now.
Any help would be apperciated.Thanks.

sincerely,
ghassen Cheniour

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/f335c2d7-b41f-4d65-9a83-0bdc65ac23dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] Augeas lens to change an arbitrary line in a file?

2014-04-21 Thread Joachim Schrod
Hi,

I'm new to Puppet, and also new to Augeas.

I want to change a line in a file. In particular, the file is
  /usr/share/ghostscript/${gs_version}/Resource/Init/gs_init.ps
and the line is
  % /DEFAULTPAPERSIZE (a4) def
that I want to change into
  /DEFAULTPAPERSIZE (a4) def

Is Augeas the right tool for such a task? I looked through its
available lenses, but there ain't no Postscript lens.

Of course, the other approach would be to use an exec resource to
change that line.

What is best practice?

Joachim

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod, Roedermark, Germany
Email: jsch...@acm.org

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/lj45s9%24t7q%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas, syslog and defining numbered items.

2014-03-13 Thread trey85stang
How can one change an existing entry with augeas on a numbered entry list?

specifically I want to add entries in syslog to the entry that has file = 
/var/log/messages

I can use this search string to find the entry:


augtool print /files/etc/syslog.conf/*/action/file[. = 
/var/log/messages] 
/files/etc/syslog.conf/entry[1]/action/file = /var/log/messages 

The augeas examples really only show editing values that would be below 
file.  I need to edit a a lower level then file. i.e. 
/files/etc/syslog.conf/entry[1]/selector[last() + 1]?

How can this be done from augeas and puppet?  (also should this go the the 
augeas list instead?)

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a57c5719-3321-49e2-a68a-c880b9f8a55f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Puppet Users] augeas, ntp.conf and iburst

2014-03-12 Thread Kenton Brede
I want to add a server on top of the stack in ntp.conf like:

server time.example.com iburst
server 0.rhel.pool.ntp.org iburst
...

I came up with this:

  augeas { 'ntp.conf':
context = '/files/etc/ntp.conf',
changes = [
  'ins server before server[1]',
  'set server[1] time.example.com' ,
],
onlyif  = 'match server[. = time.example.com] size == 0',
  }

This in fact adds time.example.com on top of 0.rhel.pool.ntp.org iburst
but excludes iburst at the end of the line.

server time.example.com
server 0.rhel.pool.ntp.org iburst
...

I tried 'set server[1] time.example.com iburst' but get error Could not
evaluate: Save failed with return code false.

augtool prints this:
/files/etc/ntp.conf/server[1] = 0.rhel.pool.ntp.org
/files/etc/ntp.conf/server[1]/iburst

So the iburst line doesn't really have a variable.

How do I append iburst at the end of time.example.com?

Thanks,

-- 
Kent

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BnSE387szbuxeLyAEW40YB4as2CuGDxQiEaghnUDXiLSKnwOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Augeas with puppet 3.4.2

2014-02-18 Thread Ryan Anderson
Excellent catch, the error was indeed an improperly-formatted /etc/group 
entry (on line 51). Thanks for your help! I've learned a lot about augeas 
through this.

The old adage applies: garbage in, garbage out.

On Monday, February 17, 2014 10:18:46 AM UTC-6, Dominic Cleal wrote:

 The fix that Marcelo pointed out isn't relevant here, it's to fix a 
 false positive log message.  The log message is actually correct in this 
 instance, no need to update augeas.rb. 

 The Augeas library is unable to parse something on line 51 of your 
 /etc/group file.  From the debug: augeas/files/etc/group/error/line = 51 

 Look to see what's there and maybe you can edit the file to workaround 
 the problem.  If the file is still valid, then please file a bug either 
 with your distribution or upstream 
 (https://github.com/hercules-team/augeas/issues). 

 -- 
 Dominic Cleal 
 Red Hat Engineering 

 On 13/02/14 20:54, Ryan Anderson wrote: 
  Cool. Does this mean I need to update augeas.rb from github.com 
  http://github.com/ or wait for it to make it into a future release? 
  What should I do to fix it now? 
  
  In case it helps, here are the problem bits from the debug output: 
  ^[[0;32mInfo: Applying configuration version '1392322307'^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Opening 
  augeas with root /, lens path , flags 32^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Augeas 
  version 1.0.0 is installed^[[0m 
  ^[[1;31mWarning: Augeas[myuser_in_logingroup](provider=augeas): Loading 
  failed for one or more files, see debug for /augeas//error output^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
  /augeas/files/etc/group/error = parse_failed^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
  /augeas/files/etc/group/error/pos = 670^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
  /augeas/files/etc/group/error/line = 51^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
  /augeas/files/etc/group/error/char = 0^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
  /augeas/files/etc/group/error/lens = 
  /usr/share/augeas/lenses/dist/group.aug:44.17-.40:^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
  /augeas/files/etc/group/error/message = Iterated lens matched less than 
  it should^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Will 
  attempt to save and only run if files changed^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): sending 
  command 'set' with params [/files/etc/group/mygroup/user[last()+1], 
  myuser]^[[0m 
  ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Closed the 
  augeas connection^[[0m 
  ^[[1;31mError: 
  /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: Could not 
  evaluate: Save failed with return code false, see debug 
  /usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:97:in `fail' 
  /usr/lib/ruby/site_ruby/1.8/puppet/provider/augeas/augeas.rb:388:in 
  `need_to_run?' 
  /usr/lib/ruby/site_ruby/1.8/puppet/type/augeas.rb:175:in `retrieve' 
  
  On Thursday, February 13, 2014 1:18:27 PM UTC-6, Marcelo Frota wrote: 
  
  Hi, 
  
  I had the same problem,  the solution of the problem is in : 
  
  
 https://github.com/puppetlabs/puppet/commit/644fc99193dd5e2beed3facbccb949caf8d6501f
  
  
 https://github.com/puppetlabs/puppet/commit/644fc99193dd5e2beed3facbccb949caf8d6501f,
  

  
  Best  regards, 
  Marcelo Frota 
  
  
  2014-02-13 14:23 GMT-02:00 Rob Reynolds r...@puppetlabs.com 
  javascript:: 
  
  
  
  
  On Thu, Feb 13, 2014 at 9:54 AM, Ryan Anderson 
  ryan.c@gmail.com javascript: wrote: 
  
  I have some augeas code that works flawlessly with puppet 
  2.6.17, but when running the identical code on 3.4.2, I get 
  an error. 
  
  The code: 
 augeas { 'myuser_in_logingroup': 
context = '/files/etc/group', 
changes = [ set ${hostname}/user[last()+1] 
  myuser, ], 
onlyif  = match ${hostname}/*[.='myuser'] size 
  == 0, 
require = Group['local_login_group'], 
  } 
  
  The error from running 'puppet agent -tv': 
  Warning: Augeas[myuser_in_logingroup](provider=augeas): 
  Loading failed for one or more files, see debug for 
  /augeas//error output 
  Error: 
  /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: 
  Could not evaluate: Save failed with return code false, see 
  debug 
  
  I'm having a difficult time finding/understanding clues from 
  debug output. Any ideas? 
  
  
  Ryan, would you mind running 'puppet agent --trace --verbose 
  

Re: [Puppet Users] Augeas with puppet 3.4.2

2014-02-17 Thread Dominic Cleal
The fix that Marcelo pointed out isn't relevant here, it's to fix a
false positive log message.  The log message is actually correct in this
instance, no need to update augeas.rb.

The Augeas library is unable to parse something on line 51 of your
/etc/group file.  From the debug: augeas/files/etc/group/error/line = 51

Look to see what's there and maybe you can edit the file to workaround
the problem.  If the file is still valid, then please file a bug either
with your distribution or upstream
(https://github.com/hercules-team/augeas/issues).

-- 
Dominic Cleal
Red Hat Engineering

On 13/02/14 20:54, Ryan Anderson wrote:
 Cool. Does this mean I need to update augeas.rb from github.com
 http://github.com/ or wait for it to make it into a future release?
 What should I do to fix it now?
 
 In case it helps, here are the problem bits from the debug output:
 ^[[0;32mInfo: Applying configuration version '1392322307'^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Opening
 augeas with root /, lens path , flags 32^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Augeas
 version 1.0.0 is installed^[[0m
 ^[[1;31mWarning: Augeas[myuser_in_logingroup](provider=augeas): Loading
 failed for one or more files, see debug for /augeas//error output^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas):
 /augeas/files/etc/group/error = parse_failed^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas):
 /augeas/files/etc/group/error/pos = 670^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas):
 /augeas/files/etc/group/error/line = 51^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas):
 /augeas/files/etc/group/error/char = 0^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas):
 /augeas/files/etc/group/error/lens =
 /usr/share/augeas/lenses/dist/group.aug:44.17-.40:^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas):
 /augeas/files/etc/group/error/message = Iterated lens matched less than
 it should^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Will
 attempt to save and only run if files changed^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): sending
 command 'set' with params [/files/etc/group/mygroup/user[last()+1],
 myuser]^[[0m
 ^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Closed the
 augeas connection^[[0m
 ^[[1;31mError:
 /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: Could not
 evaluate: Save failed with return code false, see debug
 /usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:97:in `fail'
 /usr/lib/ruby/site_ruby/1.8/puppet/provider/augeas/augeas.rb:388:in
 `need_to_run?'
 /usr/lib/ruby/site_ruby/1.8/puppet/type/augeas.rb:175:in `retrieve'
 
 On Thursday, February 13, 2014 1:18:27 PM UTC-6, Marcelo Frota wrote:
 
 Hi, 
 
 I had the same problem,  the solution of the problem is in : 
 
 
 https://github.com/puppetlabs/puppet/commit/644fc99193dd5e2beed3facbccb949caf8d6501f
 
 https://github.com/puppetlabs/puppet/commit/644fc99193dd5e2beed3facbccb949caf8d6501f,
  
 
 Best  regards, 
 Marcelo Frota
 
 
 2014-02-13 14:23 GMT-02:00 Rob Reynolds r...@puppetlabs.com
 javascript::
 
 
 
 
 On Thu, Feb 13, 2014 at 9:54 AM, Ryan Anderson
 ryan.c@gmail.com javascript: wrote:
 
 I have some augeas code that works flawlessly with puppet
 2.6.17, but when running the identical code on 3.4.2, I get
 an error.
 
 The code:
augeas { 'myuser_in_logingroup':
   context = '/files/etc/group',
   changes = [ set ${hostname}/user[last()+1]
 myuser, ],
   onlyif  = match ${hostname}/*[.='myuser'] size
 == 0,
   require = Group['local_login_group'],
 }
 
 The error from running 'puppet agent -tv':
 Warning: Augeas[myuser_in_logingroup](provider=augeas):
 Loading failed for one or more files, see debug for
 /augeas//error output
 Error:
 /Stage[main]/Group_management/Augeas[myuser_in_logingroup]:
 Could not evaluate: Save failed with return code false, see
 debug
 
 I'm having a difficult time finding/understanding clues from
 debug output. Any ideas?
 
 
 Ryan, would you mind running 'puppet agent --trace --verbose
 --debug' and posting the output here?
 
  
 
 
 -- 
 You received this message because you are subscribed to the
 Google Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails
 from it, send an email to puppet-users...@googlegroups.com
 javascript:.
 To view this discussion on the web visit
 
 

[Puppet Users] Augeas with puppet 3.4.2

2014-02-13 Thread Ryan Anderson
I have some augeas code that works flawlessly with puppet 2.6.17, but when 
running the identical code on 3.4.2, I get an error.

The code:
   augeas { 'myuser_in_logingroup':
  context = '/files/etc/group',
  changes = [ set ${hostname}/user[last()+1] myuser, ],
  onlyif  = match ${hostname}/*[.='myuser'] size == 0,
  require = Group['local_login_group'],
}

The error from running 'puppet agent -tv':
Warning: Augeas[myuser_in_logingroup](provider=augeas): Loading failed for 
one or more files, see debug for /augeas//error output
Error: /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: Could 
not evaluate: Save failed with return code false, see debug

I'm having a difficult time finding/understanding clues from debug output. 
Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/0daa274a-6978-41e5-8812-be05d13dfa39%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas with puppet 3.4.2

2014-02-13 Thread Rob Reynolds
On Thu, Feb 13, 2014 at 9:54 AM, Ryan Anderson ryan.c.ander...@gmail.comwrote:

 I have some augeas code that works flawlessly with puppet 2.6.17, but when
 running the identical code on 3.4.2, I get an error.

 The code:
augeas { 'myuser_in_logingroup':
   context = '/files/etc/group',
   changes = [ set ${hostname}/user[last()+1] myuser, ],
   onlyif  = match ${hostname}/*[.='myuser'] size == 0,
   require = Group['local_login_group'],
 }

 The error from running 'puppet agent -tv':
 Warning: Augeas[myuser_in_logingroup](provider=augeas): Loading failed for
 one or more files, see debug for /augeas//error output
 Error: /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: Could
 not evaluate: Save failed with return code false, see debug

 I'm having a difficult time finding/understanding clues from debug output.
 Any ideas?


Ryan, would you mind running 'puppet agent --trace --verbose --debug' and
posting the output here?




  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/0daa274a-6978-41e5-8812-be05d13dfa39%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Rob Reynolds
Developer, Puppet Labs

*Join us at PuppetConf 2014, September 23-24 in San Francisco - *
http://bit.ly/pupconf14

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAMJiBK5F1GgFyBMTZQmyND7zrfaRpyPe5jKXS3%3DupdVzO8RVpw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas with puppet 3.4.2

2014-02-13 Thread gter marcelo
Hi,

I had the same problem,  the solution of the problem is in :

https://github.com/puppetlabs/puppet/commit/644fc99193dd5e2beed3facbccb949caf8d6501f
,

Best  regards,
Marcelo Frota


2014-02-13 14:23 GMT-02:00 Rob Reynolds r...@puppetlabs.com:




 On Thu, Feb 13, 2014 at 9:54 AM, Ryan Anderson 
 ryan.c.ander...@gmail.comwrote:

 I have some augeas code that works flawlessly with puppet 2.6.17, but
 when running the identical code on 3.4.2, I get an error.

 The code:
augeas { 'myuser_in_logingroup':
   context = '/files/etc/group',
   changes = [ set ${hostname}/user[last()+1] myuser, ],
   onlyif  = match ${hostname}/*[.='myuser'] size == 0,
   require = Group['local_login_group'],
 }

 The error from running 'puppet agent -tv':
 Warning: Augeas[myuser_in_logingroup](provider=augeas): Loading failed
 for one or more files, see debug for /augeas//error output
 Error: /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: Could
 not evaluate: Save failed with return code false, see debug

 I'm having a difficult time finding/understanding clues from debug
 output. Any ideas?


 Ryan, would you mind running 'puppet agent --trace --verbose --debug' and
 posting the output here?




  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/0daa274a-6978-41e5-8812-be05d13dfa39%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 Rob Reynolds
 Developer, Puppet Labs

 *Join us at PuppetConf 2014, September 23-24 in San Francisco - *
 http://bit.ly/pupconf14

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CAMJiBK5F1GgFyBMTZQmyND7zrfaRpyPe5jKXS3%3DupdVzO8RVpw%40mail.gmail.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CA%2BhR_Oegiq_zbJEAvXVv1tnqibTzf9%3DP2YyXXoN7Eg%3DYO_4SZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas with puppet 3.4.2

2014-02-13 Thread Ryan Anderson
Cool. Does this mean I need to update augeas.rb from github.com or wait for 
it to make it into a future release? What should I do to fix it now?

In case it helps, here are the problem bits from the debug output:
^[[0;32mInfo: Applying configuration version '1392322307'^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Opening 
augeas with root /, lens path , flags 32^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Augeas 
version 1.0.0 is installed^[[0m
^[[1;31mWarning: Augeas[myuser_in_logingroup](provider=augeas): Loading 
failed for one or more files, see debug for /augeas//error output^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error = parse_failed^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/pos = 670^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/line = 51^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/char = 0^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/lens = 
/usr/share/augeas/lenses/dist/group.aug:44.17-.40:^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/message = Iterated lens matched less than it 
should^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Will attempt 
to save and only run if files changed^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): sending 
command 'set' with params [/files/etc/group/mapls042/user[last()+1], 
myuser]^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Closed the 
augeas connection^[[0m
^[[1;31mError: /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: 
Could not evaluate: Save failed with return code false, see debug
/usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:97:in `fail'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/augeas/augeas.rb:388:in 
`need_to_run?'
/usr/lib/ruby/site_ruby/1.8/puppet/type/augeas.rb:175:in `retrieve'

On Thursday, February 13, 2014 1:18:27 PM UTC-6, Marcelo Frota wrote:

 Hi, 

 I had the same problem,  the solution of the problem is in : 


 https://github.com/puppetlabs/puppet/commit/644fc99193dd5e2beed3facbccb949caf8d6501f
 , 

 Best  regards, 
 Marcelo Frota


 2014-02-13 14:23 GMT-02:00 Rob Reynolds r...@puppetlabs.com javascript:
 :




 On Thu, Feb 13, 2014 at 9:54 AM, Ryan Anderson 
 ryan.c@gmail.comjavascript:
  wrote:

 I have some augeas code that works flawlessly with puppet 2.6.17, but 
 when running the identical code on 3.4.2, I get an error.

 The code:
augeas { 'myuser_in_logingroup':
   context = '/files/etc/group',
   changes = [ set ${hostname}/user[last()+1] myuser, ],
   onlyif  = match ${hostname}/*[.='myuser'] size == 0,
   require = Group['local_login_group'],
 }

 The error from running 'puppet agent -tv':
 Warning: Augeas[myuser_in_logingroup](provider=augeas): Loading failed 
 for one or more files, see debug for /augeas//error output
 Error: /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: Could 
 not evaluate: Save failed with return code false, see debug

 I'm having a difficult time finding/understanding clues from debug 
 output. Any ideas?


 Ryan, would you mind running 'puppet agent --trace --verbose --debug' and 
 posting the output here?
  
  


  -- 
 You received this message because you are subscribed to the Google 
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/0daa274a-6978-41e5-8812-be05d13dfa39%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Rob Reynolds
 Developer, Puppet Labs

 *Join us at PuppetConf 2014, September 23-24 in San Francisco - *
 http://bit.ly/pupconf14
  
 -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/CAMJiBK5F1GgFyBMTZQmyND7zrfaRpyPe5jKXS3%3DupdVzO8RVpw%40mail.gmail.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/bd0971bf-d48e-44bd-b5a9-7027f059507b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas with puppet 3.4.2

2014-02-13 Thread Ryan Anderson
Cool. Does this mean I need to update augeas.rb from github.com or wait for 
it to make it into a future release? What should I do to fix it now?

In case it helps, here are the problem bits from the debug output:
^[[0;32mInfo: Applying configuration version '1392322307'^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Opening 
augeas with root /, lens path , flags 32^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Augeas 
version 1.0.0 is installed^[[0m
^[[1;31mWarning: Augeas[myuser_in_logingroup](provider=augeas): Loading 
failed for one or more files, see debug for /augeas//error output^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error = parse_failed^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/pos = 670^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/line = 51^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/char = 0^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/lens = 
/usr/share/augeas/lenses/dist/group.aug:44.17-.40:^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): 
/augeas/files/etc/group/error/message = Iterated lens matched less than it 
should^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Will attempt 
to save and only run if files changed^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): sending 
command 'set' with params [/files/etc/group/mygroup/user[last()+1], 
myuser]^[[0m
^[[0;36mDebug: Augeas[myuser_in_logingroup](provider=augeas): Closed the 
augeas connection^[[0m
^[[1;31mError: /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: 
Could not evaluate: Save failed with return code false, see debug
/usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:97:in `fail'
/usr/lib/ruby/site_ruby/1.8/puppet/provider/augeas/augeas.rb:388:in 
`need_to_run?'
/usr/lib/ruby/site_ruby/1.8/puppet/type/augeas.rb:175:in `retrieve'

On Thursday, February 13, 2014 1:18:27 PM UTC-6, Marcelo Frota wrote:

 Hi, 

 I had the same problem,  the solution of the problem is in : 


 https://github.com/puppetlabs/puppet/commit/644fc99193dd5e2beed3facbccb949caf8d6501f
 , 

 Best  regards, 
 Marcelo Frota


 2014-02-13 14:23 GMT-02:00 Rob Reynolds r...@puppetlabs.com javascript:
 :




 On Thu, Feb 13, 2014 at 9:54 AM, Ryan Anderson 
 ryan.c@gmail.comjavascript:
  wrote:

 I have some augeas code that works flawlessly with puppet 2.6.17, but 
 when running the identical code on 3.4.2, I get an error.

 The code:
augeas { 'myuser_in_logingroup':
   context = '/files/etc/group',
   changes = [ set ${hostname}/user[last()+1] myuser, ],
   onlyif  = match ${hostname}/*[.='myuser'] size == 0,
   require = Group['local_login_group'],
 }

 The error from running 'puppet agent -tv':
 Warning: Augeas[myuser_in_logingroup](provider=augeas): Loading failed 
 for one or more files, see debug for /augeas//error output
 Error: /Stage[main]/Group_management/Augeas[myuser_in_logingroup]: Could 
 not evaluate: Save failed with return code false, see debug

 I'm having a difficult time finding/understanding clues from debug 
 output. Any ideas?


 Ryan, would you mind running 'puppet agent --trace --verbose --debug' and 
 posting the output here?
  
  


  -- 
 You received this message because you are subscribed to the Google 
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/0daa274a-6978-41e5-8812-be05d13dfa39%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 Rob Reynolds
 Developer, Puppet Labs

 *Join us at PuppetConf 2014, September 23-24 in San Francisco - *
 http://bit.ly/pupconf14
  
 -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/CAMJiBK5F1GgFyBMTZQmyND7zrfaRpyPe5jKXS3%3DupdVzO8RVpw%40mail.gmail.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/96e850f6-4909-4162-9f16-6af9f7b40be8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas: Duplicate declaration

2014-01-20 Thread Reinaldo Lima
Almost there! =)

My only change was 'host_entry_${name} :' like you suggested,

everything else in the code is like my first post, and the error now is:

*Could not evaluate: uninitialized constant Augeas::NO_MODL_AUTOLOAD*


*By the way, thank you so much for the help, this topic made me learn a lot 
about puppet =)*


On Saturday, January 18, 2014 10:18:06 PM UTC-2, Nick Cammorato wrote:

 Sorry, didn't realize it was a hash of hashes.  You just need the augeas 
 resource to have a unique name - entry[$name][hostname] or ipaddress should 
 work.

 IE:
 define a_thing {
   augeas { 'host_entry': }
 }

 a_thing { 'a': }
 a_thing { 'b': }

 Will generate an error like you are seeing.

 define a_thing {
   augeas { host_entry_${name}: }
 }
 a_thing {'a': }
 a_thing {'b': }

 Will not.


 On Fri, Jan 17, 2014 at 1:07 PM, Andrey Kozichev 
 akoz...@gmail.comjavascript:
  wrote:

 ah, right you are supplying entire hash in your defined resource. Missed 
 it.

 If your defined resource would accept: name, iphost and hostname - then 
 you can use create_resources to define all 3 entry.
 On 17 Jan 2014 15:21, Reinaldo Lima reim...@gmail.com javascript: 
 wrote:

 With create_resources the error is:

 *Invalid parameter hostName on node*


 And including the entry[name] in the resource name:

 *Resource title must be a String, not Hash*

  

 =(

 On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote:

 another option to use create_resources('hostinclude',$netentry)
 On 16 Jan 2014 23:47, Nick Cammorato nick.ca...@gmail.com wrote:

 Your augeas resource is always called hosts_include which is why it's 
 doing that.  Try including the entry[name] in that resource name.
 On Jan 16, 2014 4:15 PM, Reinaldo Lima reim...@gmail.com wrote:

 Hi Everyone,

 I'm trying to write a class that put some entries in /etc/hosts 
 file as follow below:

 *class hosts {*

 *$netentry = {*
 *host01 = { iphost = '192.168.10.1', hostName = 
 host01 },*
 *host02 = { iphost = '192.168.10.2', hostName = 
 host02 },*
 *host03 = { iphost = '192.168.10.3', hostName = 
 host03 },*
 *}*

 *define hostsinclude ($entry) {*
 *   augeas { hosts_include:*
 *   incl = /etc/hosts,*
 *   lens = Hosts.lns,*
 *   changes = [*
 *   set /files/etc/hosts/01/ipaddr 
 $entry[$name]['iphost'],*
 *   set 
 /files/etc/hosts/01/canonical$entry[$name]['hostName'],*
 *   ],*
 *   onlyif = match */ipaddr[ . = 
 $entry[$name]['iphost'] ] size == 0*
 *   }*
 *}*

 *hostsinclude { [*
 *'host01',*
 *'host02',*
 *'host03'*
 *]:*
 *entry = $netentry*
 *}*

 *}*


 and, when puppet compiles the manifest, I get the following error: 

 *err: Could not retrieve catalog from remote server: Error 400 on 
 SERVER: Duplicate declaration: Augeas[hosts_include] is already declared 
 in 
 file 
 /puppet/environments/production/modules/checklist/manifests/hosts.pp 
 at line 10; cannot redeclare at 
 /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 
 on 
 node*

 Someone can help me?

 Thanks

 -- 
 You received this message because you are subscribed to the Google 
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, 
 send an email to puppet-users...@googlegroups.com.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%
 40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  -- 
 You received this message because you are subscribed to the Google 
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to puppet-users...@googlegroups.com.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_
 GvAAXM%2BC8t3FC9xA%40mail.gmail.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  -- 
 You received this message because you are subscribed to the Google 
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 

Re: [Puppet Users] Augeas: Duplicate declaration

2014-01-18 Thread Nick Cammorato
Sorry, didn't realize it was a hash of hashes.  You just need the augeas
resource to have a unique name - entry[$name][hostname] or ipaddress should
work.

IE:
define a_thing {
  augeas { 'host_entry': }
}

a_thing { 'a': }
a_thing { 'b': }

Will generate an error like you are seeing.

define a_thing {
  augeas { host_entry_${name}: }
}
a_thing {'a': }
a_thing {'b': }

Will not.


On Fri, Jan 17, 2014 at 1:07 PM, Andrey Kozichev akozic...@gmail.comwrote:

 ah, right you are supplying entire hash in your defined resource. Missed
 it.

 If your defined resource would accept: name, iphost and hostname - then
 you can use create_resources to define all 3 entry.
 On 17 Jan 2014 15:21, Reinaldo Lima reiml...@gmail.com wrote:

 With create_resources the error is:

 *Invalid parameter hostName on node*


 And including the entry[name] in the resource name:

 *Resource title must be a String, not Hash*



 =(

 On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote:

 another option to use create_resources('hostinclude',$netentry)
 On 16 Jan 2014 23:47, Nick Cammorato nick.ca...@gmail.com wrote:

 Your augeas resource is always called hosts_include which is why it's
 doing that.  Try including the entry[name] in that resource name.
 On Jan 16, 2014 4:15 PM, Reinaldo Lima reim...@gmail.com wrote:

 Hi Everyone,

 I'm trying to write a class that put some entries in /etc/hosts file
 as follow below:

 *class hosts {*

 *$netentry = {*
 *host01 = { iphost = '192.168.10.1', hostName =
 host01 },*
 *host02 = { iphost = '192.168.10.2', hostName =
 host02 },*
 *host03 = { iphost = '192.168.10.3', hostName =
 host03 },*
 *}*

 *define hostsinclude ($entry) {*
 *   augeas { hosts_include:*
 *   incl = /etc/hosts,*
 *   lens = Hosts.lns,*
 *   changes = [*
 *   set /files/etc/hosts/01/ipaddr
 $entry[$name]['iphost'],*
 *   set
 /files/etc/hosts/01/canonical$entry[$name]['hostName'],*
 *   ],*
 *   onlyif = match */ipaddr[ . =
 $entry[$name]['iphost'] ] size == 0*
 *   }*
 *}*

 *hostsinclude { [*
 *'host01',*
 *'host02',*
 *'host03'*
 *]:*
 *entry = $netentry*
 *}*

 *}*


 and, when puppet compiles the manifest, I get the following error:

 *err: Could not retrieve catalog from remote server: Error 400 on
 SERVER: Duplicate declaration: Augeas[hosts_include] is already declared 
 in
 file /puppet/environments/production/modules/checklist/manifests/hosts.pp
 at line 10; cannot redeclare at
 /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on
 node*

 Someone can help me?

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to puppet-users...@googlegroups.com.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%
 40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to the Google
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to puppet-users...@googlegroups.com.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_
 GvAAXM%2BC8t3FC9xA%40mail.gmail.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CACzr%3DFdwj-bmkdUzMoutEBLPMa%2BZA%3Dt7v98COQfT%2Bk%2BjBrUzGg%40mail.gmail.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: [Puppet Users] Augeas: Duplicate declaration

2014-01-17 Thread Reinaldo Lima
With create_resources the error is:

*Invalid parameter hostName on node*


And including the entry[name] in the resource name:

*Resource title must be a String, not Hash*

 

=(

On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote:

 another option to use create_resources('hostinclude',$netentry)
 On 16 Jan 2014 23:47, Nick Cammorato nick.ca...@gmail.com javascript: 
 wrote:

 Your augeas resource is always called hosts_include which is why it's 
 doing that.  Try including the entry[name] in that resource name.
 On Jan 16, 2014 4:15 PM, Reinaldo Lima reim...@gmail.com javascript: 
 wrote:

 Hi Everyone,

 I'm trying to write a class that put some entries in /etc/hosts file 
 as follow below:

 *class hosts {*

 *$netentry = {*
 *host01 = { iphost = '192.168.10.1', hostName = 
 host01 },*
 *host02 = { iphost = '192.168.10.2', hostName = 
 host02 },*
 *host03 = { iphost = '192.168.10.3', hostName = 
 host03 },*
 *}*

 *define hostsinclude ($entry) {*
 *   augeas { hosts_include:*
 *   incl = /etc/hosts,*
 *   lens = Hosts.lns,*
 *   changes = [*
 *   set /files/etc/hosts/01/ipaddr 
 $entry[$name]['iphost'],*
 *   set 
 /files/etc/hosts/01/canonical$entry[$name]['hostName'],*
 *   ],*
 *   onlyif = match */ipaddr[ . = 
 $entry[$name]['iphost'] ] size == 0*
 *   }*
 *}*

 *hostsinclude { [*
 *'host01',*
 *'host02',*
 *'host03'*
 *]:*
 *entry = $netentry*
 *}*

 *}*


 and, when puppet compiles the manifest, I get the following error: 

 *err: Could not retrieve catalog from remote server: Error 400 on 
 SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in 
 file /puppet/environments/production/modules/checklist/manifests/hosts.pp 
 at line 10; cannot redeclare at 
 /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on 
 node*

 Someone can help me?

 Thanks

 -- 
 You received this message because you are subscribed to the Google 
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to puppet-users...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_GvAAXM%2BC8t3FC9xA%40mail.gmail.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas: Duplicate declaration

2014-01-17 Thread Andrey Kozichev
ah, right you are supplying entire hash in your defined resource. Missed it.

If your defined resource would accept: name, iphost and hostname - then you
can use create_resources to define all 3 entry.
On 17 Jan 2014 15:21, Reinaldo Lima reiml...@gmail.com wrote:

 With create_resources the error is:

 *Invalid parameter hostName on node*


 And including the entry[name] in the resource name:

 *Resource title must be a String, not Hash*



 =(

 On Friday, January 17, 2014 5:10:16 AM UTC-2, Andrew wrote:

 another option to use create_resources('hostinclude',$netentry)
 On 16 Jan 2014 23:47, Nick Cammorato nick.ca...@gmail.com wrote:

 Your augeas resource is always called hosts_include which is why it's
 doing that.  Try including the entry[name] in that resource name.
 On Jan 16, 2014 4:15 PM, Reinaldo Lima reim...@gmail.com wrote:

 Hi Everyone,

 I'm trying to write a class that put some entries in /etc/hosts file
 as follow below:

 *class hosts {*

 *$netentry = {*
 *host01 = { iphost = '192.168.10.1', hostName =
 host01 },*
 *host02 = { iphost = '192.168.10.2', hostName =
 host02 },*
 *host03 = { iphost = '192.168.10.3', hostName =
 host03 },*
 *}*

 *define hostsinclude ($entry) {*
 *   augeas { hosts_include:*
 *   incl = /etc/hosts,*
 *   lens = Hosts.lns,*
 *   changes = [*
 *   set /files/etc/hosts/01/ipaddr
 $entry[$name]['iphost'],*
 *   set
 /files/etc/hosts/01/canonical$entry[$name]['hostName'],*
 *   ],*
 *   onlyif = match */ipaddr[ . =
 $entry[$name]['iphost'] ] size == 0*
 *   }*
 *}*

 *hostsinclude { [*
 *'host01',*
 *'host02',*
 *'host03'*
 *]:*
 *entry = $netentry*
 *}*

 *}*


 and, when puppet compiles the manifest, I get the following error:

 *err: Could not retrieve catalog from remote server: Error 400 on
 SERVER: Duplicate declaration: Augeas[hosts_include] is already declared in
 file /puppet/environments/production/modules/checklist/manifests/hosts.pp
 at line 10; cannot redeclare at
 /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on
 node*

 Someone can help me?

 Thanks

 --
 You received this message because you are subscribed to the Google
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to puppet-users...@googlegroups.com.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%
 40googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to the Google
 Groups Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to puppet-users...@googlegroups.com.
 To view this discussion on the web visit https://groups.google.com/d/
 msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_
 GvAAXM%2BC8t3FC9xA%40mail.gmail.com.
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/4f31358c-652d-4afc-9919-aae783afa36c%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CACzr%3DFdwj-bmkdUzMoutEBLPMa%2BZA%3Dt7v98COQfT%2Bk%2BjBrUzGg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Augeas: Duplicate declaration

2014-01-16 Thread Reinaldo Lima
Hi Everyone,

I'm trying to write a class that put some entries in /etc/hosts file as 
follow below:

*class hosts {*

*$netentry = {*
*host01 = { iphost = '192.168.10.1', hostName = host01 
},*
*host02 = { iphost = '192.168.10.2', hostName = host02 
},*
*host03 = { iphost = '192.168.10.3', hostName = host03 
},*
*}*

*define hostsinclude ($entry) {*
*   augeas { hosts_include:*
*   incl = /etc/hosts,*
*   lens = Hosts.lns,*
*   changes = [*
*   set /files/etc/hosts/01/ipaddr 
$entry[$name]['iphost'],*
*   set 
/files/etc/hosts/01/canonical$entry[$name]['hostName'],*
*   ],*
*   onlyif = match */ipaddr[ . = 
$entry[$name]['iphost'] ] size == 0*
*   }*
*}*

*hostsinclude { [*
*'host01',*
*'host02',*
*'host03'*
*]:*
*entry = $netentry*
*}*

*}*


and, when puppet compiles the manifest, I get the following error: 

*err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Duplicate declaration: Augeas[hosts_include] is already declared in file 
/puppet/environments/production/modules/checklist/manifests/hosts.pp at 
line 10; cannot redeclare at 
/puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on 
node*

Someone can help me?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas: Duplicate declaration

2014-01-16 Thread Nick Cammorato
Your augeas resource is always called hosts_include which is why it's doing
that.  Try including the entry[name] in that resource name.
On Jan 16, 2014 4:15 PM, Reinaldo Lima reiml...@gmail.com wrote:

 Hi Everyone,

 I'm trying to write a class that put some entries in /etc/hosts file as
 follow below:

 *class hosts {*

 *$netentry = {*
 *host01 = { iphost = '192.168.10.1', hostName = host01
 },*
 *host02 = { iphost = '192.168.10.2', hostName = host02
 },*
 *host03 = { iphost = '192.168.10.3', hostName = host03
 },*
 *}*

 *define hostsinclude ($entry) {*
 *   augeas { hosts_include:*
 *   incl = /etc/hosts,*
 *   lens = Hosts.lns,*
 *   changes = [*
 *   set /files/etc/hosts/01/ipaddr
 $entry[$name]['iphost'],*
 *   set
 /files/etc/hosts/01/canonical$entry[$name]['hostName'],*
 *   ],*
 *   onlyif = match */ipaddr[ . =
 $entry[$name]['iphost'] ] size == 0*
 *   }*
 *}*

 *hostsinclude { [*
 *'host01',*
 *'host02',*
 *'host03'*
 *]:*
 *entry = $netentry*
 *}*

 *}*


 and, when puppet compiles the manifest, I get the following error:

 *err: Could not retrieve catalog from remote server: Error 400 on SERVER:
 Duplicate declaration: Augeas[hosts_include] is already declared in file
 /puppet/environments/production/modules/checklist/manifests/hosts.pp at
 line 10; cannot redeclare at
 /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on
 node*

 Someone can help me?

 Thanks

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_GvAAXM%2BC8t3FC9xA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas: Duplicate declaration

2014-01-16 Thread Andrey Kozichev
another option to use create_resources('hostinclude',$netentry)
On 16 Jan 2014 23:47, Nick Cammorato nick.cammor...@gmail.com wrote:

 Your augeas resource is always called hosts_include which is why it's
 doing that.  Try including the entry[name] in that resource name.
 On Jan 16, 2014 4:15 PM, Reinaldo Lima reiml...@gmail.com wrote:

 Hi Everyone,

 I'm trying to write a class that put some entries in /etc/hosts file as
 follow below:

 *class hosts {*

 *$netentry = {*
 *host01 = { iphost = '192.168.10.1', hostName = host01
 },*
 *host02 = { iphost = '192.168.10.2', hostName = host02
 },*
 *host03 = { iphost = '192.168.10.3', hostName = host03
 },*
 *}*

 *define hostsinclude ($entry) {*
 *   augeas { hosts_include:*
 *   incl = /etc/hosts,*
 *   lens = Hosts.lns,*
 *   changes = [*
 *   set /files/etc/hosts/01/ipaddr
 $entry[$name]['iphost'],*
 *   set
 /files/etc/hosts/01/canonical$entry[$name]['hostName'],*
 *   ],*
 *   onlyif = match */ipaddr[ . =
 $entry[$name]['iphost'] ] size == 0*
 *   }*
 *}*

 *hostsinclude { [*
 *'host01',*
 *'host02',*
 *'host03'*
 *]:*
 *entry = $netentry*
 *}*

 *}*


 and, when puppet compiles the manifest, I get the following error:

 *err: Could not retrieve catalog from remote server: Error 400 on SERVER:
 Duplicate declaration: Augeas[hosts_include] is already declared in file
 /puppet/environments/production/modules/checklist/manifests/hosts.pp at
 line 10; cannot redeclare at
 /puppet/environments/production/modules/checklist/manifests/hosts.pp:29 on
 node*

 Someone can help me?

 Thanks

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/fe9040f2-54de-4f9c-9787-4736b37219d9%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/puppet-users/CAKJ8awc5X%2B97jtxwbe%3DpjqhjqyuF8S_dR_GvAAXM%2BC8t3FC9xA%40mail.gmail.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CACzr%3DFemrZtFMUnyU6SUbvFE9KyVrjK7s19YpOFmLnMeJyUE0g%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas onlyif problem

2013-11-14 Thread Jist Anidiot


On Monday, November 11, 2013 5:06:30 PM UTC-5, Dominic Cleal wrote:

 On 11/11/13 15:18, Jist Anidiot wrote: 
  
  
  On Friday, November 8, 2013 12:23:11 PM UTC-5, Dominic Cleal wrote: 
  
  On 06/11/13 21:17, Jist Anidiot wrote: 
   I'm trying to make sure a specific user has a special ssh key used 
 as 
   his identity file. 
   
   so I'm trying something like: 
   
augeas{user_second_key: 
   context = /files/home/user/.ssh/config, 
   changes = [ ins IdentityFile after 
   /files/home/user/.ssh/config/IdentityFile[last()], 
 set 
  /files/home/user/.ssh/config/IdentityFile[last()] 
   ~/.ssh/user2nd_rsa, 
], 
   onlyif = match /files/home/user/.ssh/config/IdentityFile 
   not_include ~/.ssh/user2nd_rsa, 
   
 } 
   
   However it adds the line every puppet run.  I'm wondering what I 
  might 
   be doing wrong. 
  
  Try: 
  
  onlyif = match 
  /files/home/user/.ssh/config/IdentityFile[.='~/.ssh/user2nd_rsa'] 
  size == 0 
  
  
  
  Thanks that works.   
  
  So what's the point of include and not_include if you have to do this 
  weird size thing? 

 include/not_include check the return value of the match arg command 
 and whether it includes or doesn't include the argument. 

 A match API call in Augeas' API returns a list of paths that match the 
 argument you pass, so you're actually checking whether those paths 
 include or don't include a certain value.  It doesn't return the values 
 of those nodes, which is what you expected. 


Well I expected match /files/home/user/.ssh/config/IdentityFile 
not_include ~/.ssh/user2nd_rsa to be true if ~/.ssh/user2nd_rsa wasn't 
one of the values found with the match (and false if it was).  That 
obviously isn't how it works in practice.  

In augtool match /files/home/user/.ssh/config/IdentityFile returns:

/files/home/user/.ssh/config/IdentityFile[1] = ~/.ssh/id_rsa
/files/home/user/.ssh/config/IdentityFile[2] = ~/.ssh/user2nd_rsa
/files/home/user/.ssh/config/IdentityFile[3] = ~/.ssh/git_user_rsa

so I'm still not understanding why the not_include in the onlyif returns 
false in my case -- Unless it is trying to check against the entire line 
where I'll never be certain if it is [2] or [3] or something else so it 
will be fairly useless for me in this case.  

On the bright side the size thing works (just that I would have never 
thought of trying it.).

 

 It's possible the get arg command would work better with 
 include/not_include, except that API call will only match a single path 
 and return one value value - so isn't much help with include. 

 We could do with something better here in the provider for sure, care to 
 raise a feature request?  Please add me to the watchlist if you do. 


I suspect the only features I need are more examples in the documentation.  
 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e8e76f79-00d2-47ca-b2c2-2b230fbd1cbc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas JSON example?

2013-11-14 Thread John Simpson

On 2013-11-13, at 1456, David Lutterkort lut...@puppetlabs.com wrote:

 I don't have any examples handy, but the easiest way to try out managing the 
 file with Puppet is to store it somewhere, say /tmp/file.json and then play 
 around with it in augtool:

That's what I eventually ended up doing, and after several hours of tinkering 
with it I was able to come up with most of what I need - I have puppet 
templates which store strings and numbers in the top-level dict within the 
JSON file.

The last part is being able to maintain an array of dictionaries within the 
top-level dict (in particular, an array of LDAP DN's.) In the file, it looks 
like this:

{
  server : hostname.domain.xyz ,
  port   : 12345 ,
  groups : [
{ dn : cn=Users,dc=domain,dc=xyz } ,
{ dn : cn=Admins,dc=domain,dc=xyz }
  ]
}

In augtool, I am able to do the following:

set /augeas/load/Json/lens Json.lns
set /augeas/load/Json/incl /tmp/file.json
load
set /files/tmp/file.json/dict/entry[last()+1] 'groups'
touch /files/tmp/file.json/dict/entry[last()]/array

However, when I try to do it in Puppet:

  augeas { groups_array :
incl= '/tmp/file.json' ,
lens= 'Json.lns' ,
changes = [
  set dict/entry[last()+1] 'groups' ,
  touch dict/entry[last()]/array ,
] ,
onlyif  = match dict/entry[*][.='groups'] size == 0 ,
require = File['/tmp/file.json'] ,
  }

I get the following error:

Error: /Stage[main]/Module::Groups/Augeas[groups_array]: Could not evaluate: 
Unknown command touch

Does the Puppet augeas module not support the touch command at all? If not, 
is there a way to declare an array like this, without declaring a member of the 
array at the same time? The class itself declares the array, and it also 
defines a template that another class will call one or more times to add items 
to the array. Different machines will need different numbers of items in the 
array, and some machines may not need any items at all.

The most frustrating thing to me is how little documentation there seems to be 
out there, about using the JSON lens. The augeas web site doesn't list it with 
the other lenses, and on the list of core lenses page it's there but the link 
goes to a page which doesn't exist. I think it's amazing that I was able to 
cobble together what I already have, and I think once I get this all figured 
out, I'll have to write a page on my personal web site explaining it.

--
John Simpson j...@voalte.com
Unix System/VM Developer and Engineering Operations, Voalte
+1 (941) 312-2830 x148

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/2534C0B3-444A-4F88-86A7-A67D6A57EC5B%40voalte.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas onlyif problem

2013-11-11 Thread Jist Anidiot


On Friday, November 8, 2013 12:23:11 PM UTC-5, Dominic Cleal wrote:

 On 06/11/13 21:17, Jist Anidiot wrote: 
  I'm trying to make sure a specific user has a special ssh key used as 
  his identity file. 
  
  so I'm trying something like: 
  
   augeas{user_second_key: 
  context = /files/home/user/.ssh/config, 
  changes = [ ins IdentityFile after 
  /files/home/user/.ssh/config/IdentityFile[last()], 
set /files/home/user/.ssh/config/IdentityFile[last()] 
  ~/.ssh/user2nd_rsa, 
   ], 
  onlyif = match /files/home/user/.ssh/config/IdentityFile 
  not_include ~/.ssh/user2nd_rsa, 
  
} 
  
  However it adds the line every puppet run.  I'm wondering what I might 
  be doing wrong. 

 Try: 

 onlyif = match 
 /files/home/user/.ssh/config/IdentityFile[.='~/.ssh/user2nd_rsa'] size == 
 0 



Thanks that works.  

So what's the point of include and not_include if you have to do this weird 
size thing? 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/88458230-d854-4d01-a548-0294357de04c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas onlyif problem

2013-11-11 Thread Dominic Cleal
On 11/11/13 15:18, Jist Anidiot wrote:
 
 
 On Friday, November 8, 2013 12:23:11 PM UTC-5, Dominic Cleal wrote:
 
 On 06/11/13 21:17, Jist Anidiot wrote:
  I'm trying to make sure a specific user has a special ssh key used as
  his identity file.
 
  so I'm trying something like:
 
   augeas{user_second_key:
  context = /files/home/user/.ssh/config,
  changes = [ ins IdentityFile after
  /files/home/user/.ssh/config/IdentityFile[last()],
set
 /files/home/user/.ssh/config/IdentityFile[last()]
  ~/.ssh/user2nd_rsa,
   ],
  onlyif = match /files/home/user/.ssh/config/IdentityFile
  not_include ~/.ssh/user2nd_rsa,
 
}
 
  However it adds the line every puppet run.  I'm wondering what I
 might
  be doing wrong.
 
 Try:
 
 onlyif = match
 /files/home/user/.ssh/config/IdentityFile[.='~/.ssh/user2nd_rsa']
 size == 0
 
 
 
 Thanks that works.  
 
 So what's the point of include and not_include if you have to do this
 weird size thing? 

include/not_include check the return value of the match arg command
and whether it includes or doesn't include the argument.

A match API call in Augeas' API returns a list of paths that match the
argument you pass, so you're actually checking whether those paths
include or don't include a certain value.  It doesn't return the values
of those nodes, which is what you expected.

It's possible the get arg command would work better with
include/not_include, except that API call will only match a single path
and return one value value - so isn't much help with include.

We could do with something better here in the provider for sure, care to
raise a feature request?  Please add me to the watchlist if you do.

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/528154E6.2060206%40redhat.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas onlyif problem

2013-11-08 Thread Dominic Cleal
On 06/11/13 21:17, Jist Anidiot wrote:
 I'm trying to make sure a specific user has a special ssh key used as
 his identity file.
 
 so I'm trying something like:
 
  augeas{user_second_key:
 context = /files/home/user/.ssh/config,
 changes = [ ins IdentityFile after
 /files/home/user/.ssh/config/IdentityFile[last()],
   set /files/home/user/.ssh/config/IdentityFile[last()]
 ~/.ssh/user2nd_rsa,
  ],
 onlyif = match /files/home/user/.ssh/config/IdentityFile
 not_include ~/.ssh/user2nd_rsa, 
 
   }
 
 However it adds the line every puppet run.  I'm wondering what I might
 be doing wrong. 

Try:

onlyif = match
/files/home/user/.ssh/config/IdentityFile[.='~/.ssh/user2nd_rsa'] size == 0

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/527D1DFF.60906%40redhat.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] augeas onlyif problem

2013-11-06 Thread Jist Anidiot
I'm trying to make sure a specific user has a special ssh key used as his 
identity file.

so I'm trying something like:

 augeas{user_second_key:
context = /files/home/user/.ssh/config,
changes = [ ins IdentityFile after 
/files/home/user/.ssh/config/IdentityFile[last()],
  set /files/home/user/.ssh/config/IdentityFile[last()] 
~/.ssh/user2nd_rsa,
 ],
onlyif = match /files/home/user/.ssh/config/IdentityFile not_include 
~/.ssh/user2nd_rsa, 

  }

However it adds the line every puppet run.  I'm wondering what I might be 
doing wrong. 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/84ee6cf2-0e49-41ee-84b4-5a960335bee9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Augeas JSON example?

2013-11-01 Thread John Simpson
Greetings.

I'm trying to find a few concrete examples of how to use augeas within a Puppet 
module, to make changes to a JSON file. I've been googling for the past hour 
and a half, and while I have found several pages which provide reference-type 
documentation, I have yet to see a single usable example. All of the augeas 
examples seem to demonstrate how to maintain a file for which some other lens 
applies, such as /etc/hosts or /etc/ssh/sshd_config.

My situation: I have a system-wide JSON file which contains a series of 
key-value pairs, like so:

{
  svc_host : server.domain.xyz ,
  svc_port : 12345 ,
  svc_user : username ,
  svc_pass : password ,

  versions : [ 1.0 , 1.0.1 , 1.0.2 ] ,

  agent_installed : 1383331588 ,

  comment  : This is a gratuitous comment.
}

I know that JSON is probably not be the best format for the file, but it's 
human readable, and it saves us having to write and debug configuration file 
parsing routines in seven different languages on four platforms.

I would like to be able to use Puppet modules to maintain the file. My first 
thought, of course, was to use a template, but there are several different 
components of the system which all store data in the one file, so different 
modules need to maintain different sets of keys within the file.

Is anybody doing something similar, and if so, would you mind sharing the 
relevant bits of your manifests? Or point me to an example of a WORKING augeas 
resource which adds or 

--
John Simpson j...@voalte.com
Unix System/VM Developer and Engineering Operations, Voalte
+1 (941) 312-2830 x148

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/8A01C2C3-83D6-4FBA-9EB3-CEE69C7D8E3D%40voalte.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas umask and /etc/sysconfig/init

2013-10-29 Thread Sven vd
I have the same problem. The goal is to append umask 027 without the = 
to the end of the /etc/sysconfig/init file according to NIST rules. However 
the augeas lens is not made to handle this, only shell vars syntax is 
allowed.
If you want to workaround this via a erb template and you have other augeas 
resources defined, they will fail as augeas will fail to parse the new 
/etc/sysconfig/init set by the template.

How to best resolve this?

Thanks

On Tuesday, June 25, 2013 4:36:22 PM UTC+2, Dominic Cleal wrote:

 On 24/06/13 12:22, David Sandilands wrote: 
  We are working on a replacing our current build set by ksh scripts with 
  puppet manifests and I'm having some difficulty setting umask in 
  /etc/sysconfig/init for RHEL 6 
  
  Ideally I would like to just do 
  
  augeas { 'augsysconfiginitumask': 
 context = '/files/etc/sysconfig/init', 
 changes = set umask 027; 
  } 
  
  but that just sets a line to umask=027, we use augeas to update this 
  file from other places so ideally wouldn't like to use templates. 
  
  Any ideas or thoughts? 

 I don't follow your question.  What did you expect or want it to do? 

 -- 
 Dominic Cleal 
 Red Hat Engineering 


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/ef50aa6a-9549-4582-9bb9-d4f5048a3d6f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas umask and /etc/sysconfig/init

2013-10-29 Thread Dominic Cleal
On 29/10/13 12:07, Sven vd wrote:
 I have the same problem. The goal is to append umask 027 without the
 = to the end of the /etc/sysconfig/init file according to NIST rules.
 However the augeas lens is not made to handle this, only shell vars
 syntax is allowed.
 If you want to workaround this via a erb template and you have other
 augeas resources defined, they will fail as augeas will fail to parse
 the new /etc/sysconfig/init set by the template.
 
 How to best resolve this?

Please file a bug against Augeas' shellvars lens in order to support
parsing it: https://fedorahosted.org/augeas/newticket

In the meantime, perhaps use file_line or similar tools.

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/526FAF55.9030207%40redhat.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas XML trouble

2013-10-11 Thread Neil
On 11 Oct 2013 01:04, Thilo-Alexander Ginkel th...@ginkel.com wrote:

 Hello everyone,

 I am currently trying to add elements to an XML file (a libvirt network
definition) using Puppet (2.7.23)/Augeas (0.10). The XML looks like this
Hello
I think you need to upgrade augeas.  The xml stuff does not work, for me at
least, in 0.10
I upgraded to 1.1 and my troubles went away.
Neil

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] Augeas XML trouble

2013-10-11 Thread Puppet List
On 11 Oct 2013 01:04, Thilo-Alexander Ginkel th...@ginkel.com wrote:

 Hello everyone,

 I am currently trying to add elements to an XML file (a libvirt network
definition) using Puppet (2.7.23)/Augeas (0.10). The XML looks like this

Hello
upgrade augeas I use 1.1 as the xml features do not work in 0.1
Neil

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Augeas XML trouble

2013-10-10 Thread Thilo-Alexander Ginkel
Hello everyone,

I am currently trying to add elements to an XML file (a libvirt network 
definition) using Puppet (2.7.23)/Augeas (0.10). The XML looks like this:

network
namevirbr0/name
uuid57fdc6e3-cba1-4110-88ef-850f1b71ee39/uuid
forward dev='eth0' mode='nat'/
bridge name='virbr0' stp='on' delay='0' /
ip address=172.20.20.1 netmask=255.255.255.0
dhcp
range start=172.20.20.100 end=172.20.20.254 /
host mac=52:54:00:54:1e:00 name=host1.domain 
ip=172.20.20.121 /
/dhcp
/ip
/network

Specifically, I would like to add elements to the dhcp element (using the 
name attribute as a uniqueness constraint). So far, I tried this definition:

augeas { libvirt-dhcp-config-$name:
lens= 'Xml.lns',
incl= '/etc/libvirt/qemu/networks/virbr0.xml',
changes = [
set 
network/ip/dhcp/host[#attribute/name='$name.domain']/#attribute/ip $ip,
 ],
 notify  = Service['libvirtd'],
}

Unfortunately, this just fails to execute:

debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Opening augeas 
with root /, lens path , flags 64
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Augeas version 
0.10.0 is installed
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Will attempt to 
save and only run if files changed
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): sending command 
'set' with params 
[/files/etc/libvirt/qemu/networks/virbr0.xml/network/ip/dhcp/host[#attribute/name='host.domain']/#attribute/ip,
 
172.20.20.120]
debug: Augeas[libvirt-dhcp-config-mysql](provider=augeas): Closed the 
augeas connection
/usr/lib/ruby/vendor_ruby/puppet/util/errors.rb:60:in `fail'
/usr/lib/ruby/vendor_ruby/puppet/provider/augeas/augeas.rb:313:in 
`need_to_run?'
/usr/lib/ruby/vendor_ruby/puppet/type/augeas.rb:205:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:720:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:715:in `each'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:715:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:728:in `retrieve_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:32:in 
`perform_changes'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:133:in 
`evaluate'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:49:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:84:in `eval_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:509:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:508:in `thinmark'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:104:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:386:in `traverse'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:99:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:141:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:122:in 
`retrieve_and_apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:121:in 
`retrieve_and_apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:152:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:229:in `main'
/usr/lib/ruby/vendor_ruby/puppet/application/apply.rb:149:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:309:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:416:in `hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:309:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:407:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:309:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:69:in `execute'
/usr/bin/puppet:4
err: 
/Stage[main]//Node[node_name]/Vm[mysql]/Augeas[libvirt-dhcp-config-mysql]: 
Could not evaluate: Save failed with return code false

Any ideas? I tried locating some Xml lens documentation, but so far did not 
find anything useful.

Thanks,
Thilo

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-24 Thread Greg Coit
I've decided to not be blocked by this issue and to have puppet manage the 
config file.  It's not an ideal solution, but good enough until I learn 
more about either augeas or inifile.

Greg

On Monday, September 23, 2013 3:48:05 PM UTC-7, Greg Coit wrote:

 Nathan,

 Thanks for the response - I did not know about inifile.

 I unfortunately seem to be having trouble with ini_setting - the following 
 causes a new line to be added every time puppet gets run:

   ini_setting { 'anonymous_enable':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'anonymous_enable',
 value   = 'NO',
 ensure  = present,
   }

   ini_setting { 'chroot_local_user':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'chroot_local_user',
 value   = 'YES',
 ensure  = present,
   }

 BTW, still playing with augeas too - the most recent code is:

   augeas { 'vsftpd.conf':
 context   = '/files/vsftpd/vsftpd.conf',
 incl  = '/etc/vsftpd/vsftpd.conf',
 load_path = '/usr/share/augeas/lenses/dist/',
 lens  = 'vsftpd',
 changes   = [ 'set anonymous_enable NO', 'set chroot_local_user YES', 
 ],
   }

 Turns out that augeas has an unwelcome behavior - it tries to load all 
 files that match the lens - if any are non-standard, it errors out.  

 Greg

 On Monday, September 23, 2013 3:00:36 PM UTC-7, Nathan Valentine wrote:

 Greg, 

 I believe resource ini_setting would be appropriate here but I do 
 understand the desire to learn about Puppet + Augeas. 

augeas { 'vsftpd.conf':
  context = '/etc/vsftpd/vsftpd.conf',
  changes = [ 'set anonymous_enable=NO', 'set 
 chroot_local_user=YES', ],
  require = File['/etc/vsftpd/vsftpd.conf'],
}


 context = '*/files*/vsftpd/vsftpd.conf',

 ?

 I'm lazy and haven't tested with a Puppet apply but I think this might 
 just be an issue of understanding the namespace-y Augeas stuff. You can 
 test like so with augtool:

 $ augtool ls */files*/vsftpd/vsftpd.conf

 -- 
 ---
 Nathan Valentine - nat...@puppetlabs.com
 Puppet Labs Professional Services
 GV: 415.504.2173
 Skype: nrvale0



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-24 Thread Greg Coit

LOL - or I could just use one of the 2 vsftpd modules on puppetforge...  I 
never *intend* to do things the hard way.  :)

Greg

On Tuesday, September 24, 2013 9:32:53 AM UTC-7, Greg Coit wrote:

 I've decided to not be blocked by this issue and to have puppet manage the 
 config file.  It's not an ideal solution, but good enough until I learn 
 more about either augeas or inifile.

 Greg

 On Monday, September 23, 2013 3:48:05 PM UTC-7, Greg Coit wrote:

 Nathan,

 Thanks for the response - I did not know about inifile.

 I unfortunately seem to be having trouble with ini_setting - the 
 following causes a new line to be added every time puppet gets run:

   ini_setting { 'anonymous_enable':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'anonymous_enable',
 value   = 'NO',
 ensure  = present,
   }

   ini_setting { 'chroot_local_user':
 path= '/etc/vsftpd/vsftpd.conf',
 setting = 'chroot_local_user',
 value   = 'YES',
 ensure  = present,
   }

 BTW, still playing with augeas too - the most recent code is:

   augeas { 'vsftpd.conf':
 context   = '/files/vsftpd/vsftpd.conf',
 incl  = '/etc/vsftpd/vsftpd.conf',
 load_path = '/usr/share/augeas/lenses/dist/',
 lens  = 'vsftpd',
 changes   = [ 'set anonymous_enable NO', 'set chroot_local_user 
 YES', ],
   }

 Turns out that augeas has an unwelcome behavior - it tries to load all 
 files that match the lens - if any are non-standard, it errors out.  

 Greg

 On Monday, September 23, 2013 3:00:36 PM UTC-7, Nathan Valentine wrote:

 Greg, 

 I believe resource ini_setting would be appropriate here but I do 
 understand the desire to learn about Puppet + Augeas. 

augeas { 'vsftpd.conf':
  context = '/etc/vsftpd/vsftpd.conf',
  changes = [ 'set anonymous_enable=NO', 'set 
 chroot_local_user=YES', ],
  require = File['/etc/vsftpd/vsftpd.conf'],
}


 context = '*/files*/vsftpd/vsftpd.conf',

 ?

 I'm lazy and haven't tested with a Puppet apply but I think this might 
 just be an issue of understanding the namespace-y Augeas stuff. You can 
 test like so with augtool:

 $ augtool ls */files*/vsftpd/vsftpd.conf

 -- 
 ---
 Nathan Valentine - nat...@puppetlabs.com
 Puppet Labs Professional Services
 GV: 415.504.2173
 Skype: nrvale0



-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-24 Thread Werner Flamme
Greg Coit [24.09.2013 00:48]:
 
 BTW, still playing with augeas too - the most recent code is:
 
   augeas { 'vsftpd.conf':
 context   = '/files/vsftpd/vsftpd.conf',

Greg,

shouldn't this be '/files/etc/vsftpd/vsftpd.conf'?

Just a guess from a novice...

Regards,
Werner
-- 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] augeas question

2013-09-23 Thread Greg Coit
Hello,

I'm trying to learn how to use augeas in puppet.  One of the packages we 
have puppet installing is vsftpd.  Rather than putting the vsftpd conf file 
in puppet (in case the config file is updated by the upstream maintainers) 
I'd like to use augeas to make sure the correct lines exist in the config 
file.

Currently, the default vsftpd config file contains the following 21 lines 
(among others of course):

anonymous_enable=YES
#chroot_local_user=YES

I'd like to change this to:

anonymous_enable=NO
chroot_local_user=YES

I have the following in a module:

  #vsftpd
  package { 'vsftpd':
ensure = installed,
  }

  file { '/etc/vsftpd/vsftpd.conf':
ensure  = file,
mode= 600,
require = Package['vsftpd'],
  }

  augeas { 'vsftpd.conf':
context = '/etc/vsftpd/vsftpd.conf',
changes = [ 'set anonymous_enable=NO', 'set chroot_local_user=YES', ],
require = File['/etc/vsftpd/vsftpd.conf'],
  }

But I'm having no luck changing either line.

Any suggestions are welcome - thanks!

Greg

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-23 Thread Nathan Valentine
Greg,

I believe resource ini_setting would be appropriate here but I do
understand the desire to learn about Puppet + Augeas.

   augeas { 'vsftpd.conf':
 context = '/etc/vsftpd/vsftpd.conf',
 changes = [ 'set anonymous_enable=NO', 'set chroot_local_user=YES',
],
 require = File['/etc/vsftpd/vsftpd.conf'],
   }


context = '*/files*/vsftpd/vsftpd.conf',

?

I'm lazy and haven't tested with a Puppet apply but I think this might just
be an issue of understanding the namespace-y Augeas stuff. You can test
like so with augtool:

$ augtool ls */files*/vsftpd/vsftpd.conf

-- 
---
Nathan Valentine - nat...@puppetlabs.com
Puppet Labs Professional Services
GV: 415.504.2173
Skype: nrvale0

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Puppet Users] augeas question

2013-09-23 Thread Greg Coit
Nathan,

Thanks for the response - I did not know about inifile.

I unfortunately seem to be having trouble with ini_setting - the following 
causes a new line to be added every time puppet gets run:

  ini_setting { 'anonymous_enable':
path= '/etc/vsftpd/vsftpd.conf',
setting = 'anonymous_enable',
value   = 'NO',
ensure  = present,
  }

  ini_setting { 'chroot_local_user':
path= '/etc/vsftpd/vsftpd.conf',
setting = 'chroot_local_user',
value   = 'YES',
ensure  = present,
  }

BTW, still playing with augeas too - the most recent code is:

  augeas { 'vsftpd.conf':
context   = '/files/vsftpd/vsftpd.conf',
incl  = '/etc/vsftpd/vsftpd.conf',
load_path = '/usr/share/augeas/lenses/dist/',
lens  = 'vsftpd',
changes   = [ 'set anonymous_enable NO', 'set chroot_local_user YES', 
],
  }

Turns out that augeas has an unwelcome behavior - it tries to load all 
files that match the lens - if any are non-standard, it errors out.  

Greg

On Monday, September 23, 2013 3:00:36 PM UTC-7, Nathan Valentine wrote:

 Greg, 

 I believe resource ini_setting would be appropriate here but I do 
 understand the desire to learn about Puppet + Augeas. 

augeas { 'vsftpd.conf':
  context = '/etc/vsftpd/vsftpd.conf',
  changes = [ 'set anonymous_enable=NO', 'set chroot_local_user=YES', 
 ],
  require = File['/etc/vsftpd/vsftpd.conf'],
}


 context = '*/files*/vsftpd/vsftpd.conf',

 ?

 I'm lazy and haven't tested with a Puppet apply but I think this might 
 just be an issue of understanding the namespace-y Augeas stuff. You can 
 test like so with augtool:

 $ augtool ls */files*/vsftpd/vsftpd.conf

 -- 
 ---
 Nathan Valentine - nat...@puppetlabs.com javascript:
 Puppet Labs Professional Services
 GV: 415.504.2173
 Skype: nrvale0


-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


[Puppet Users] Augeas, fstab and duplicate lines: How to test ? (onlyif ? not_include ?) ... Examples ?

2013-07-29 Thread haraldchris
Hi,

I am trying to define a new type that will insert a new filesystem line 
into /etc/fstab.

However, no matter what I tried, it will insert a new line each time.

Something like this doesn't work 

augeas { $title:
context = '/files/etc/fstab',
changes = [
set 01/spec $fs_dev,
set 01/file $fs_mount,
set 01/vfstype  $fs_type,
set 01/opt  $fs_opts,
set 01/dump $fs_dump,
set 01/passno   $fs_fsck,
set 01/#comment $fs_comment,
],
onlyif = match */spec[. = $fs_dev] size == 0# also 
tried match *[spec] not_include $fs_dev
}

The not_include option doesn't seem to work either ... or maybe I din't 
know how to use it (very few examples around to say the least)

unless is not available with augeas (I believe)

Any suggestions ?

(I already know about the available fstab module but I want to understand 
what is going on here)

Many thanks.

Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] augeas umask and /etc/sysconfig/init

2013-06-25 Thread Dominic Cleal
On 24/06/13 12:22, David Sandilands wrote:
 We are working on a replacing our current build set by ksh scripts with
 puppet manifests and I'm having some difficulty setting umask in
 /etc/sysconfig/init for RHEL 6
 
 Ideally I would like to just do
 
 augeas { 'augsysconfiginitumask':
context = '/files/etc/sysconfig/init',
changes = set umask 027;
 }
 
 but that just sets a line to umask=027, we use augeas to update this
 file from other places so ideally wouldn't like to use templates.
 
 Any ideas or thoughts?

I don't follow your question.  What did you expect or want it to do?

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] augeas umask and /etc/sysconfig/init

2013-06-24 Thread David Sandilands
We are working on a replacing our current build set by ksh scripts with 
puppet manifests and I'm having some difficulty setting umask in 
/etc/sysconfig/init for RHEL 6

Ideally I would like to just do 

augeas { 'augsysconfiginitumask':
   context = '/files/etc/sysconfig/init',
   changes = set umask 027;
}

but that just sets a line to umask=027, we use augeas to update this file 
from other places so ideally wouldn't like to use templates.

Any ideas or thoughts?

ruby-augeas-0.4.1-1.el6.x86_64
augeas-libs-0.9.0-4.el6.x86_64
puppet-3.1.1-1.el6.noarch
puppet-server-3.1.1-1.el6.noarch

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] augeas umask and /etc/sysconfig/init

2013-06-24 Thread David Sandilands
Hello,

I'm trying to add a line for umask setting to /etc/sysconfig/init with 
something like

augeas { 'augsysconfiginitumask':
context = '/files/etc/sysconfig/init',
changes = 'set umask 027';
}

but this just produces  umask=027 in the file we could use a template but 
we have multiple modules that could perform augeas changes against it. 

Is there a good way of doing this?

ruby-augeas-0.4.1-1.el6.x86_64
augeas-libs-0.9.0-4.el6.x86_64
puppet-3.1.1-1.el6.noarch
puppet-server-3.1.1-1.el6.noarch

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] augeas

2013-06-19 Thread Dominic Cleal
On 18/06/13 23:07, Charles Mean wrote:
 Hello guys, I am facing a problem with puppet client installed via gem
 due Ruby EE.
 The problem is the following:
 
 puppetd -vt
 info: Caching catalog for #FQDN
 err: Could not run Puppet configuration client: Could not find a default
 provider for augeas
 
 I have tried to install ruby-augeas(gem install ruby-augeas) but it
 returns an error while compiling(make can not compile it).
 
 My ruby version is: ruby 1.8.7 (2009-12-24 patchlevel 248)
 [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.01
 And my puppet client version is: 2.6.2
 
 Do you guys have any idea on how to solve this problem ?

You said you had an error while compiling, what was the error?

At a guess you'll need to ensure you have at least gcc and augeas-devel
available.

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] augeas

2013-06-19 Thread Charles Mean
Hello Dominic, thank you for your reply.
The make error is the following:

* gem install ruby-augeas*
Building native extensions.  This could take a while...
ERROR:  Error installing ruby-augeas:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/usr/local/lib/ruby/1.8/x86_64-linux
-I/usr/local/lib/ruby/1.8/x86_64-linux -I.   -fPIC -g -O2
-I/usr/include/libxml2-c _augeas.c
_augeas.c: In function 'Init__augeas':
_augeas.c:504: error: 'AUG_ENABLE_SPAN' undeclared (first use in this
function)
_augeas.c:504: error: (Each undeclared identifier is reported only once
_augeas.c:504: error: for each function it appears in.)
_augeas.c:519: error: 'AUG_ENOSPAN' undeclared (first use in this function)
_augeas.c:520: error: 'AUG_ECMDRUN' undeclared (first use in this function)
make: *** [_augeas.o] Error 1

Gem files will remain installed in
/usr/local/lib/ruby/gems/1.8/gems/ruby-augeas-0.5.0 for inspection.
Results logged to
/usr/local/lib/ruby/gems/1.8/gems/ruby-augeas-0.5.0/ext/augeas/gem_make.out



* cat
/usr/local/lib/ruby/gems/1.8/gems/ruby-augeas-0.5.0/ext/augeas/gem_make.out*
/usr/local/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I/usr/local/lib/ruby/1.8/x86_64-linux
-I/usr/local/lib/ruby/1.8/x86_64-linux -I.   -fPIC -g -O2
-I/usr/include/libxml2-c _augeas.c
_augeas.c: In function 'Init__augeas':
_augeas.c:504: error: 'AUG_ENABLE_SPAN' undeclared (first use in this
function)
_augeas.c:504: error: (Each undeclared identifier is reported only once
_augeas.c:504: error: for each function it appears in.)
_augeas.c:519: error: 'AUG_ENOSPAN' undeclared (first use in this function)
_augeas.c:520: error: 'AUG_ECMDRUN' undeclared (first use in this function)
make: *** [_augeas.o] Error 1

And about your suggest, I have these versions of gcc and augeas-dev:
* gcc --version*
gcc (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



* aptitude show libaugeas-dev*
Package: libaugeas-dev
State: installed
Automatically installed: no
Version: 0.7.2-1
Priority: optional
Section: libdevel
Maintainer: Nicolas Valcárcel Scerpella (Canonical) 
nicolas.valcar...@canonical.com
Uncompressed Size: 90.1 k
Depends: libaugeas0 (= 0.7.2-1)
Description: Development files for writing applications based on libaugeas0
 Augeas is a configuration editing tool. It parses configuration files in
their native formats and transforms them into a tree. Configuration changes
are made by manipulating this tree and saving it back into native config
files.

 This package includes the development files to write programs using the
Augeas API.
Homepage: http://augeas.net/


Do you have a clue how to solve it ?


On Wed, Jun 19, 2013 at 6:28 AM, Dominic Cleal dcl...@redhat.com wrote:

 On 18/06/13 23:07, Charles Mean wrote:
  Hello guys, I am facing a problem with puppet client installed via gem
  due Ruby EE.
  The problem is the following:
 
  puppetd -vt
  info: Caching catalog for #FQDN
  err: Could not run Puppet configuration client: Could not find a default
  provider for augeas
 
  I have tried to install ruby-augeas(gem install ruby-augeas) but it
  returns an error while compiling(make can not compile it).
 
  My ruby version is: ruby 1.8.7 (2009-12-24 patchlevel 248)
  [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.01
  And my puppet client version is: 2.6.2
 
  Do you guys have any idea on how to solve this problem ?

 You said you had an error while compiling, what was the error?

 At a guess you'll need to ensure you have at least gcc and augeas-devel
 available.

 --
 Dominic Cleal
 Red Hat Engineering

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To post to this group, send email to puppet-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/puppet-users.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] augeas

2013-06-19 Thread Dominic Cleal
On 19/06/13 17:46, Charles Mean wrote:
 Hello Dominic, thank you for your reply.

[snip]
 make
 gcc -I. -I/usr/local/lib/ruby/1.8/x86_64-linux
 -I/usr/local/lib/ruby/1.8/x86_64-linux -I.   -fPIC -g -O2
 -I/usr/include/libxml2-c _augeas.c
 _augeas.c: In function 'Init__augeas':
 _augeas.c:504: error: 'AUG_ENABLE_SPAN' undeclared (first use in this
 function)
 _augeas.c:504: error: (Each undeclared identifier is reported only once
 _augeas.c:504: error: for each function it appears in.)
 _augeas.c:519: error: 'AUG_ENOSPAN' undeclared (first use in this function)
 _augeas.c:520: error: 'AUG_ECMDRUN' undeclared (first use in this function)
 make: *** [_augeas.o] Error 1 
 [snip]

 * aptitude show libaugeas-dev*
 Package: libaugeas-dev
 State: installed
 Automatically installed: no
 Version: 0.7.2-1
 [snip]
 
 Do you have a clue how to solve it ?

Looks like a version problem, the latest version of ruby-augeas requires
augeas 0.8.0 or higher, but your OS version is too old.

You probably want to use ruby-augeas 0.3.0 to match Debian 6's version,
but that's not published on rubygems.org.  Try downloading this and
running gem install against it:
http://download.augeas.net/ruby/ruby-augeas-0.3.0.gem

Else you could try Raphael's Ubuntu packages, maybe the 12.04 ones are a
close match for Debian:
https://launchpad.net/~raphink/+archive/augeas/

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] augeas

2013-06-19 Thread Charles Mean
Great Dominic, this version solved the problem.
I have just installed ruby-augeas-0.3.0.gem and puppet is working now =)
Thank you for your help.


On Wed, Jun 19, 2013 at 2:19 PM, Dominic Cleal dcl...@redhat.com wrote:

 On 19/06/13 17:46, Charles Mean wrote:
  Hello Dominic, thank you for your reply.
 
 [snip]
  make
  gcc -I. -I/usr/local/lib/ruby/1.8/x86_64-linux
  -I/usr/local/lib/ruby/1.8/x86_64-linux -I.   -fPIC -g -O2
  -I/usr/include/libxml2-c _augeas.c
  _augeas.c: In function 'Init__augeas':
  _augeas.c:504: error: 'AUG_ENABLE_SPAN' undeclared (first use in this
  function)
  _augeas.c:504: error: (Each undeclared identifier is reported only once
  _augeas.c:504: error: for each function it appears in.)
  _augeas.c:519: error: 'AUG_ENOSPAN' undeclared (first use in this
 function)
  _augeas.c:520: error: 'AUG_ECMDRUN' undeclared (first use in this
 function)
  make: *** [_augeas.o] Error 1
  [snip]
 
  * aptitude show libaugeas-dev*
  Package: libaugeas-dev
  State: installed
  Automatically installed: no
  Version: 0.7.2-1
  [snip]
 
  Do you have a clue how to solve it ?

 Looks like a version problem, the latest version of ruby-augeas requires
 augeas 0.8.0 or higher, but your OS version is too old.

 You probably want to use ruby-augeas 0.3.0 to match Debian 6's version,
 but that's not published on rubygems.org.  Try downloading this and
 running gem install against it:
 http://download.augeas.net/ruby/ruby-augeas-0.3.0.gem

 Else you could try Raphael's Ubuntu packages, maybe the 12.04 ones are a
 close match for Debian:
 https://launchpad.net/~raphink/+archive/augeas/

 --
 Dominic Cleal
 Red Hat Engineering

 --
 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to puppet-users+unsubscr...@googlegroups.com.
 To post to this group, send email to puppet-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/puppet-users.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] augeas

2013-06-18 Thread Charles Mean
Hello guys, I am facing a problem with puppet client installed via gem due
Ruby EE.
The problem is the following:

 puppetd -vt
info: Caching catalog for #FQDN
err: Could not run Puppet configuration client: Could not find a default
provider for augeas

I have tried to install ruby-augeas(gem install ruby-augeas) but it returns
an error while compiling(make can not compile it).

My ruby version is: ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux],
MBARI 0x6770, Ruby Enterprise Edition 2010.01
And my puppet client version is: 2.6.2

Do you guys have any idea on how to solve this problem ?

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] augeas for hosts.allow

2013-05-29 Thread mohammad kashif
Hi

I am trying to configure hosts.allow using augeas with puppet. I can add a
ip range if process exists with this code

 augeas { Add ${name} to ${process}:
   context = /files/etc/hosts.allow,
   changes = set *[process='${process}']/client[last()+1] ${name},
   onlyif  = match *[process='${process}']/client[.='${name}'] size == 0,

but if a process doesn't exist then  I can't do it  dynamically, some thing
like this works

augeas { Add ${name} - ${process}:
   context = /files/etc/hosts.allow,
   changes = [ set 02/process ${process}, set 02/client[.='{$name}']
${name} ],
   onlyif  = match *[process='${process}'] size == 0,
  }

But I have to provide node number (02 here) . The above code is mostly
based on
https://gist.github.com/rodjek/18c50d8800840696bac0

Can some one give a better option. What I want is that I can define
different process and ip range in node manifest file like this

ssh::hosts_allow { [ '1.1.1.1', '2.2.2.2',  ]:
   process = 'sshd',

ssh::hosts_allow { [ '3.3.3.3 ]:
   process = 'nrpe',

Thanks
Kashif

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] augeas

2013-04-29 Thread Stanislas LEVEAU
Hello

I use augeas to replace a value in a config file:

example (this example is good) :

/etc/ssh/sshd_config file

LogLevel INFO


class ssh::redhat {
augeas { sshd_config:
  context = /files/etc/ssh/sshd_config,
  changes = [
set LogLevel VERBOSE,
  ],
  notify = Service[sshd],
}

This configuration is good

but how do when the file is written like this:

parameter = value (with =)


/etc/webmin/config file

lang = us


class webmin::redhat {
augeas { config:
  context = /files/etc/webmin/config,
  changes = [
set lang = fr],
  ],
}
}

this configuration is not good, did you have an idea?
regards

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Augeas lens dependency on valid config file parsing

2013-03-28 Thread Dominic Cleal
On 22/03/13 23:22, Gonzalo Servat wrote:
 On Sat, Mar 23, 2013 at 9:47 AM, Gonzalo Servat gser...@gmail.com
 mailto:gser...@gmail.com wrote:
 
 On Fri, Mar 22, 2013 at 9:11 PM, Dominic Cleal dcl...@redhat.com
 mailto:dcl...@redhat.com wrote:
 
 Perhaps ideally, lenses could be bundled with the software
 responsible
 for the config file formats themselves so they're more easily
 kept in
 sync.  There are a small number of projects that do this (libvirt,
 libguestfs, corosync), but it needs a supportive upstream.
 
 
 Hi Dominic,
 
 Thanks for replying. I haven't got my head around the lens syntax
 just yet but I will have a go at it and see if I can submit a patch.
 
 I think your last paragraph is spot on -- the lenses should be
 bundled with the software responsible for the config file formats.
 Perhaps augeas should look in /etc/augeas.d/ or something for the
 lenses and packages can include a lens file that goes in that
 directory. It makes sense, as a change in a config file has to
 include a review of the lens before releasing a new package.

Yes, Augeas supports two directories it simply reads from to find all
lenses.  These are typically /usr/share/augeas/lenses and
/usr/share/augeas/lenses/dist.  Usually when software shipping lenses
itself is packaged, they get installed to the former directory while
Augeas' own go in dist/.

 I had a go at modifying the lens and got it working to accept any
 option. For anyone that runs into the same problem, I've opened a ticket
 and submitted a patch:
 
 https://fedorahosted.org/augeas/ticket/334 

Thank you very much, I'll review it when I get the opportunity.

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Augeas lens dependency on valid config file parsing

2013-03-27 Thread Nikola Petrov
I think that this is mostly because of lens that are written this way.
We shouldn't blame them that this is poorly written in my opinion.
It is just more restrictive. Lens that I have written accept a
regular expression as an identifier instead of listing them.

Best, Nikola

On Fri, Mar 22, 2013 at 03:02:51PM +1100, Gonzalo Servat wrote:
 Hi All,
 
 I just ran into a frustrating Augeas problem, which I thought I'd share
 with you all.
 
 We run a cron every morning to fetch the latest RPMs (for the packages
 we're interested in) from various places such as rpmforge, EPEL, etc.
 
 This morning I tried to build a VM and it failed. What happened was that
 last night, a new version of nagios-nrpe was downloaded so the VM that was
 built had this latest version. The RPM includes nrpe.cfg which had a new
 option added to it:
 
 allow_bash_command_substitution=0
 
 In the manifest, I have an augeas block to modify the allowed_hosts line in
 the nrpe.cfg file. Puppet was failing giving a Save failed error message,
 so I went in via augtool to see what's going on.
 
 I noticed that it could not parse nrpe.cfg (i.e. ls /files/etc/nagios
 returned nothing). I had the previous config file saved for NRPE somewhere,
 so I diff'ed them and noticed the only new option is the option I mentioned
 above. After removing this new option, augtool could parse the file again
 and Puppet was happy.
 
 After having a quick read of the nrpe.lns file inside augeas-libs, I
 noticed it actually lists each of the options that it will recognise from
 the config file, and evidently fails if it finds new options that it
 doesn't recognise.
 
 Anyway, it hit me that there is quite a big dependency between config files
 and augeas lenses. A change in one config file can affect Augeas which
 affects Puppet runs. Or is this just a poorly written lens?
 
 - Gonzalo
 
 -- 
 You received this message because you are subscribed to the Google Groups 
 Puppet Users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to puppet-users+unsubscr...@googlegroups.com.
 To post to this group, send email to puppet-users@googlegroups.com.
 Visit this group at http://groups.google.com/group/puppet-users?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Augeas lens dependency on valid config file parsing

2013-03-22 Thread Dominic Cleal
On 22/03/13 04:02, Gonzalo Servat wrote:
 Hi All,
 
 I just ran into a frustrating Augeas problem, which I thought I'd share
 with you all.
 
 We run a cron every morning to fetch the latest RPMs (for the packages
 we're interested in) from various places such as rpmforge, EPEL, etc.
 
 This morning I tried to build a VM and it failed. What happened was that
 last night, a new version of nagios-nrpe was downloaded so the VM that
 was built had this latest version. The RPM includes nrpe.cfg which had a
 new option added to it:
 
 allow_bash_command_substitution=0
 
 In the manifest, I have an augeas block to modify the allowed_hosts line
 in the nrpe.cfg file. Puppet was failing giving a Save failed error
 message, so I went in via augtool to see what's going on.
 
 I noticed that it could not parse nrpe.cfg (i.e. ls /files/etc/nagios
 returned nothing). I had the previous config file saved for NRPE
 somewhere, so I diff'ed them and noticed the only new option is the
 option I mentioned above. After removing this new option, augtool could
 parse the file again and Puppet was happy.
 
 After having a quick read of the nrpe.lns file inside augeas-libs, I
 noticed it actually lists each of the options that it will recognise
 from the config file, and evidently fails if it finds new options that
 it doesn't recognise.
 
 Anyway, it hit me that there is quite a big dependency between config
 files and augeas lenses. A change in one config file can affect Augeas
 which affects Puppet runs. Or is this just a poorly written lens?

You might better off directing this at augeas-de...@redhat.com (CCed).

Lenses can be written either to match a file format very specifically
(as in this case) or quite loosely.  There are pros and cons to each.

Clearly writing a fairly loose definition for the file which accepts
something like [a-z_]+ for the name of a setting is useful when new
settings are added, as then the lens doesn't stop parsing when it comes
across the new name.

The downside is if the new setting has data that requires a different or
more complex representation in the Augeas tree.  A loose lens might
interpret a setting that's made up of multiple space-separated values as
a single value, meaning it's not as useful to people as they can't alter
a single value using Augeas (which is the point of the library).  This
situation is worsened when somebody goes to fix it, as they will likely
to have to change the format of the tree for that entry, which is an
incompatible change between Augeas versions.

A recent example of this is the Postfix main.cf lens, which treats
everything as a simple value, but then don't split up settings like
virtual_user_maps which are made up of multiple values:
https://www.redhat.com/archives/augeas-devel/2012-November/msg00049.html

Some lenses are of the former type and some of the latter, depending on
the original contributor's viewpoint and the type of file they're
parsing, how the format is being developed etc.

I think on balance we're preferring the former type in Augeas, so if you
wanted to change this to a regex that matches all key names except for
include and command (which have special formats in the lens), a patch
would probably be accepted.  At the very least, a bug report would be
appreciated:

https://fedorahosted.org/augeas/

Perhaps ideally, lenses could be bundled with the software responsible
for the config file formats themselves so they're more easily kept in
sync.  There are a small number of projects that do this (libvirt,
libguestfs, corosync), but it needs a supportive upstream.

Regards,

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Augeas lens dependency on valid config file parsing

2013-03-22 Thread Gonzalo Servat
On Fri, Mar 22, 2013 at 9:11 PM, Dominic Cleal dcl...@redhat.com wrote:

 Perhaps ideally, lenses could be bundled with the software responsible
 for the config file formats themselves so they're more easily kept in
 sync.  There are a small number of projects that do this (libvirt,
 libguestfs, corosync), but it needs a supportive upstream.


Hi Dominic,

Thanks for replying. I haven't got my head around the lens syntax just yet
but I will have a go at it and see if I can submit a patch.

I think your last paragraph is spot on -- the lenses should be bundled with
the software responsible for the config file formats. Perhaps augeas should
look in /etc/augeas.d/ or something for the lenses and packages can include
a lens file that goes in that directory. It makes sense, as a change in a
config file has to include a review of the lens before releasing a new
package.

- Gonzalo

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Augeas lens dependency on valid config file parsing

2013-03-22 Thread Gonzalo Servat
On Sat, Mar 23, 2013 at 9:47 AM, Gonzalo Servat gser...@gmail.com wrote:

 On Fri, Mar 22, 2013 at 9:11 PM, Dominic Cleal dcl...@redhat.com wrote:

 Perhaps ideally, lenses could be bundled with the software responsible
  for the config file formats themselves so they're more easily kept in
 sync.  There are a small number of projects that do this (libvirt,
 libguestfs, corosync), but it needs a supportive upstream.


 Hi Dominic,

 Thanks for replying. I haven't got my head around the lens syntax just yet
 but I will have a go at it and see if I can submit a patch.

 I think your last paragraph is spot on -- the lenses should be bundled
 with the software responsible for the config file formats. Perhaps augeas
 should look in /etc/augeas.d/ or something for the lenses and packages can
 include a lens file that goes in that directory. It makes sense, as a
 change in a config file has to include a review of the lens before
 releasing a new package.


I had a go at modifying the lens and got it working to accept any option.
For anyone that runs into the same problem, I've opened a ticket and
submitted a patch:

https://fedorahosted.org/augeas/ticket/334

- Gonzalo

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Augeas lens dependency on valid config file parsing

2013-03-21 Thread Gonzalo Servat
Hi All,

I just ran into a frustrating Augeas problem, which I thought I'd share
with you all.

We run a cron every morning to fetch the latest RPMs (for the packages
we're interested in) from various places such as rpmforge, EPEL, etc.

This morning I tried to build a VM and it failed. What happened was that
last night, a new version of nagios-nrpe was downloaded so the VM that was
built had this latest version. The RPM includes nrpe.cfg which had a new
option added to it:

allow_bash_command_substitution=0

In the manifest, I have an augeas block to modify the allowed_hosts line in
the nrpe.cfg file. Puppet was failing giving a Save failed error message,
so I went in via augtool to see what's going on.

I noticed that it could not parse nrpe.cfg (i.e. ls /files/etc/nagios
returned nothing). I had the previous config file saved for NRPE somewhere,
so I diff'ed them and noticed the only new option is the option I mentioned
above. After removing this new option, augtool could parse the file again
and Puppet was happy.

After having a quick read of the nrpe.lns file inside augeas-libs, I
noticed it actually lists each of the options that it will recognise from
the config file, and evidently fails if it finds new options that it
doesn't recognise.

Anyway, it hit me that there is quite a big dependency between config files
and augeas lenses. A change in one config file can affect Augeas which
affects Puppet runs. Or is this just a poorly written lens?

- Gonzalo

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Augeas and defvar -- regexp

2013-02-05 Thread Dominic Cleal
On 01/02/13 10:35, Schöke, Karsten wrote:
 Hallo,
 
  
 
 I have a problem to include augeas…
 
 I will to change a comment to a entry in /etc/default/tmpfs in Debian
 Wheezy.
 
 The comment is
 
 #RAMTMP=no
 
  
 
 I try this on augtool und it is running:
 
 augtool defvar ramtmpcomment
 /files/etc/default/tmpfs/#comment[.=~regexp('RAMTMP=no')]
 
 augtool ins RAMTMP after $ramtmpcomment
 
 augtool set /files/etc/default/tmpfs/RAMTMP yes
 
 augtool rm $ramtmpcomment
 
  
 
 After I running this the entry is correct.
 
  
 
 But, I try this on puppet:
 
 augeas {tmpfs:
 
   context = /files/etc/default/tmpfs,
 
  changes = [
 
  defvar ramtmpcomment #comment[.=~regexp('RAMTMP=no')],
 
  ins RAMTMP after $ramtmpcomment,

You should use single quotes here, or escape the variable name with
\$ramtmpcomment.  Puppet will be interpolating the variable itself
rather than letting Augeas do it.

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[Puppet Users] Augeas and defvar -- regexp

2013-02-01 Thread Schöke, Karsten
Hallo,

 

I have a problem to include augeas...

I will to change a comment to a entry in /etc/default/tmpfs in Debian Wheezy.

The comment is 

#RAMTMP=no

 

I try this on augtool und it is running:

augtool defvar ramtmpcomment 
/files/etc/default/tmpfs/#comment[.=~regexp('RAMTMP=no')]

augtool ins RAMTMP after $ramtmpcomment

augtool set /files/etc/default/tmpfs/RAMTMP yes

augtool rm $ramtmpcomment

 

After I running this the entry is correct.

 

But, I try this on puppet:

augeas {tmpfs:

  context = /files/etc/default/tmpfs,

 changes = [

 defvar ramtmpcomment #comment[.=~regexp('RAMTMP=no')],

 ins RAMTMP after $ramtmpcomment,

 set RAMTMP yes,

 rm $ramtmpcomment,

 ],

 }

 

Error: /Stage[main]/Debian/Augeas[tmpfs]: Could not evaluate: Error sending 
command 'ins' with params [RAMTMP, after, 
/files/etc/default/tmpfs/]/Error sending command 'ins' with params [RAMTMP, 
after, /files/etc/default/tmpfs/]

 

I believe the variable ramtmpcomment is not set

 

Puppet version 3.0.2 aureas 0.10.0

 

Any ideas?

 

Thx

Karsten

 

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Puppet Users] Augeas file line edit please help

2013-01-24 Thread Dominic Cleal
On 24/01/13 04:28, kdo wrote:
 what i thought would be a simple edit using augeas is turning out to not
 be so straight forward, can anyone please help ?
 
 the plan is to edit sendmail.cf and change the default DS to
 DShostname.domain
 
 class mail {
   $key = DS
 
   service {
'sendmail':;
   }
   augeas { sendmail.cf/$key:
 context = /files/etc/mail/sendmail.cf,
 changes = set $key mail.hostname.domain,
 notify = Service['sendmail'];
 }
 }

There's no Augeas lens for sendmail.cf files.  From Puppet 3, it'll now
warn you if using context and a file wasn't loaded.  Otherwise check in
augtool with print to see if the file can be loaded.

Maybe use stdlib's file_line type?

-- 
Dominic Cleal
Red Hat Engineering

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



  1   2   3   >