Issue #1826 has been updated by abnormaliti.

Excellent.

Might i also suggest as part of this fix you include the puppet backup routines.

i.e. 
is the file going to change? 
if yes, call puppet backup on file to a defined or default bucket
then save.

this may require a rethink on the syntax. the current syntax means that 
multiple file could be changed in one call.
e.g.
<pre>
augeas { "etc_stuff":
           context => "/files/etc",
           changes => [ "set ssh/sshd_config/HostbasedAuthentication yes",
                        "set ssh/sshd_config/IgnoreUserKnownHosts yes",
                        "set ssh/sshd_config/IgnoreRhosts yes",
                        "set sysconfig/readonly-root/READONLY  no",
                      ],
           require => Package["openssh-server"],
           notify => Service["sshd"]
}
</pre>
Note: untested just assumed.

In this case the type would not know which file to back up.

So instead of 'context' maybe file would be more appropriate.  the type will 
always know that the true context will the "/files/etc/...." and restrict the 
type to edit one file at a time.

e.g.
<pre>
augeas { "sshd_HostbasedAuthentication":
           file => "/etc/ssh/sshd_config",
           changes => [ "set HostbasedAuthentication yes",
                        "set IgnoreUserKnownHosts yes",
                        "set IgnoreRhosts yes" 
                      ],
           require => Package["openssh-server"],
           notify => Service["sshd"]
}
</pre>

unless augeas can be made to return which files are going to change, and 
backups could be called on multiple files.

Ben
----------------------------------------
Bug #1826: augeas type executes always
http://projects.reductivelabs.com/issues/show/1826

Author: abnormaliti
Status: Accepted
Priority: Normal
Assigned to: [email protected]
Category: Red Hat
Target version: 
Complexity: Unknown
Affected version: 0.24.6
Keywords: 0.24.7


it should be as easy as:

<pre>
augeas { "sshd_HostbasedAuthentication":
           context => "/files/etc/ssh/sshd_config",
           changes => [ "set HostbasedAuthentication yes",
                        "set IgnoreUserKnownHosts yes",
                        "set IgnoreRhosts yes"
                      ],
           require => Package["openssh-server"],
           notify => Service["sshd"]
}
</pre>

but it's not.  the augeas type executes _always_ regardless if there is a 
change.

the above turns into:

<pre>
augeas { "sshd_HostbasedAuthentication":
           context => "/files/etc/ssh/sshd_config",
           changes => "set HostbasedAuthentication yes",
           onlyif => "get HostbasedAuthentication != yes",
           require => Package["openssh-server"],
           notify => Service["sshd"];
          
         "sshd_IgnoreUserKnownHosts":
           context => "/files/etc/ssh/sshd_config",
           changes => "set IgnoreUserKnownHosts yes",
           onlyif => "get IgnoreUserKnownHosts != yes",
           require => Package["openssh-server"],
           notify => Service["sshd"];
        
         "sshd_IgnoreRhosts":
           context => "/files/etc/ssh/sshd_config",
           changes => "set IgnoreRhosts yes",
           onlyif => "get IgnoreRhosts != yes",
           require => Package["openssh-server"],
           notify => Service["sshd"];
}
</pre>


----------------------------------------
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to