Issue #1826 has been updated by abnormaliti.

With the 'augeas.rb' provider from github the following manifest snippet 
executes correctly with augues 0.3.6 and 0.4.0 on CentOS 5.2 x86_64 with puppet 
and puppetd.

<pre>
package { "openssh-server": ensure => installed }

service { "sshd": ensure => running, enable => true, require => 
Package["openssh-server"] }

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>

1st run
<pre>
# puppet --debug  test.pp
debug: Puppet::Type::Package::ProviderRpm: Executing '/bin/rpm --version'
debug: Puppet::Type::Package::ProviderAptrpm: Executing '/bin/rpm -ql rpm'
debug: Puppet::Type::Package::ProviderUrpmi: Executing '/bin/rpm -ql rpm'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm --version'
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does 
not exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not 
exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not 
exist
debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not 
exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/portupgrade 
does not exist
debug: Puppet::Type::Package::ProviderAppdmg: file /Library/Receipts does not 
exist
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_add does not 
exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/emerge does not 
exist
debug: Puppet::Type::Package::ProviderDarwinport: file /opt/local/bin/port does 
not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does 
not exist
debug: Puppet::Type::Package::ProviderUrpmi: file urpmi does not exist
debug: Puppet::Type::Package::ProviderPkgdmg: file /Library/Receipts does not 
exist
debug: Puppet::Type::Package::ProviderApt: file /usr/bin/apt-get does not exist
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_add does not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
debug: Puppet::Type::Package::ProviderDpkg: file /usr/bin/dpkg does not exist
debug: Puppet::Type::Package::ProviderApple: file /Library/Receipts does not 
exist
debug: Puppet::Type::Package::ProviderSun: file /usr/sbin/pkgadd does not exist
debug: Puppet::Type::Package::ProviderAptitude: file /usr/bin/aptitude does not 
exist
debug: Puppet::Type::Package::ProviderAptrpm: file apt-get does not exist
debug: Puppet::Type::Package::ProviderGem: file gem does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swinstall does not 
exist
debug: Creating default schedules
debug: Loaded state in 0.02 seconds
debug: Prefetching yum resources for package
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm --version'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -qa 
--nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} 
%{RELEASE} %{ARCH}
''
debug: //Service[sshd]/require: requires Package[openssh-server]
debug: //Augeas[sshd_HostbasedAuthentication]/require: requires 
Package[openssh-server]
debug: //Augeas[sshd_HostbasedAuthentication]/notify: subscribes to 
Service[sshd]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Opening augeas 
with root /, lens path , flags 0
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Augeas version 
0.3.6 is installed
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Will attempt to 
save and only run if files changed
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): sending command 
'set' with params ["/files/etc/ssh/sshd_config/HostbasedAuthentication", "yes"]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): sending command 
'set' with params ["/files/etc/ssh/sshd_config/IgnoreUserKnownHosts", "yes"]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): sending command 
'set' with params ["/files/etc/ssh/sshd_config/IgnoreRhosts", "yes"]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Files changed, 
should execute
debug: //Augeas[sshd_HostbasedAuthentication]: Changing returns
debug: //Augeas[sshd_HostbasedAuthentication]: 1 change(s)
notice: //Augeas[sshd_HostbasedAuthentication]/returns: executed successfully
info: //Augeas[sshd_HostbasedAuthentication]: Scheduling refresh of 
Service[sshd]
debug: Service[sshd](provider=redhat): Executing 'ps -ef'
debug: Service[sshd](provider=redhat): PID is 3412
debug: Puppet::Type::Service::ProviderRedhat: Executing '/sbin/chkconfig sshd'
notice: //Service[sshd]: Triggering 'refresh' from 1 dependencies
debug: Service[sshd](provider=redhat): Executing 'ps -ef'
debug: Service[sshd](provider=redhat): PID is 3412
debug: Puppet::Type::Service::ProviderRedhat: Executing '/sbin/service sshd 
stop'
debug: Puppet::Type::Service::ProviderRedhat: Executing '/sbin/service sshd 
start'
debug: Finishing transaction 23782439944480 with 1 changes
debug: Storing state
debug: Stored state in 0.19 seconds
debug: Calling puppetreports.report
info: Sent transaction report in 0.76 seconds
</pre>

2nd run
<pre>
# puppet --debug  test.pp
debug: Puppet::Type::Package::ProviderRpm: Executing '/bin/rpm --version'
debug: Puppet::Type::Package::ProviderAptrpm: Executing '/bin/rpm -ql rpm'
debug: Puppet::Type::Package::ProviderUrpmi: Executing '/bin/rpm -ql rpm'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm --version'
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-rc.d does 
not exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc does not 
exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not 
exist
debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not 
exist
debug: Puppet::Type::Package::ProviderFink: file /sw/bin/fink does not exist
debug: Puppet::Type::Package::ProviderPorts: file /usr/local/sbin/portupgrade 
does not exist
debug: Puppet::Type::Package::ProviderAppdmg: file /Library/Receipts does not 
exist
debug: Puppet::Type::Package::ProviderFreebsd: file /usr/sbin/pkg_add does not 
exist
debug: Puppet::Type::Package::ProviderPortage: file /usr/bin/emerge does not 
exist
debug: Puppet::Type::Package::ProviderDarwinport: file /opt/local/bin/port does 
not exist
debug: Puppet::Type::Package::ProviderUp2date: file /usr/sbin/up2date-nox does 
not exist
debug: Puppet::Type::Package::ProviderUrpmi: file urpmi does not exist
debug: Puppet::Type::Package::ProviderPkgdmg: file /Library/Receipts does not 
exist
debug: Puppet::Type::Package::ProviderApt: file /usr/bin/apt-get does not exist
debug: Puppet::Type::Package::ProviderSunfreeware: file pkg-get does not exist
debug: Puppet::Type::Package::ProviderOpenbsd: file pkg_add does not exist
debug: Puppet::Type::Package::ProviderRug: file /usr/bin/rug does not exist
debug: Puppet::Type::Package::ProviderDpkg: file /usr/bin/dpkg does not exist
debug: Puppet::Type::Package::ProviderApple: file /Library/Receipts does not 
exist
debug: Puppet::Type::Package::ProviderSun: file /usr/sbin/pkgadd does not exist
debug: Puppet::Type::Package::ProviderAptitude: file /usr/bin/aptitude does not 
exist
debug: Puppet::Type::Package::ProviderAptrpm: file apt-get does not exist
debug: Puppet::Type::Package::ProviderGem: file gem does not exist
debug: Puppet::Type::Package::ProviderHpux: file /usr/sbin/swinstall does not 
exist
debug: Creating default schedules
debug: Loaded state in 0.02 seconds
debug: Prefetching yum resources for package
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm --version'
debug: Puppet::Type::Package::ProviderYum: Executing '/bin/rpm -qa 
--nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} 
%{RELEASE} %{ARCH}
''
debug: //Augeas[sshd_HostbasedAuthentication]/require: requires 
Package[openssh-server]
debug: //Augeas[sshd_HostbasedAuthentication]/notify: subscribes to 
Service[sshd]
debug: //Service[sshd]/require: requires Package[openssh-server]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Opening augeas 
with root /, lens path , flags 0
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Augeas version 
0.3.6 is installed
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Will attempt to 
save and only run if files changed
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): sending command 
'set' with params ["/files/etc/ssh/sshd_config/HostbasedAuthentication", "yes"]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): sending command 
'set' with params ["/files/etc/ssh/sshd_config/IgnoreUserKnownHosts", "yes"]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): sending command 
'set' with params ["/files/etc/ssh/sshd_config/IgnoreRhosts", "yes"]
debug: Augeas[sshd_HostbasedAuthentication](provider=augeas): Skipping becuase 
no files were changed
debug: Service[sshd](provider=redhat): Executing 'ps -ef'
debug: Service[sshd](provider=redhat): PID is 6450
debug: Puppet::Type::Service::ProviderRedhat: Executing '/sbin/chkconfig sshd'
debug: Finishing transaction 23922800637380 with 0 changes
debug: Storing state
debug: Stored state in 0.19 seconds
debug: Calling puppetreports.report
info: Sent transaction report in 1.15 seconds
</pre>

----------------------------------------
Bug #1826: augeas type executes always
http://projects.reductivelabs.com:80/issues/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