Hi John,
Thank you for answer.
> For debugging your manifests, you could try using
>
> unless => "/bin/true"
>
> or
>
> unless => "/bin/false"
>
> to take that test script out of the picture.
Script, in "command" work fine.
> Speaking of the test script, are you sure your nodes are getting and
> using the correct version?
It's use one version, without differents of number:
[shaggycat@puppet ~]$ rpm -qa | grep puppet
puppet-server-0.24.8-1.el5.1
puppet-0.24.8-1.el5.1
[shaggycat@puppet ~]$
[root@vz-test conf]# rpm -qa | grep puppet
puppet-0.24.8-1.el5.1
[root@vz-test conf]#
> As far as I know, Exec executes its command(s) directly, not via a
> shell, so I would be surprised if that did what you expect,
> independent of the "unless". That is, "if" is a keyword in the sh
> language, not an executable program (not on any system I'm familiar
> with, anyway), so I would expect that Exec to fail every time it runs.
OK, i think you true. Do you have means, how use bash script inside
"onlyif"/"unless"?
I try use script in command line:
[root@vz-test conf]# test "/usr/sbin/
rc.test-parametrs-changed.sh
check_settings 301 10.0.5.31 yes vps256M 10.0.5.52"
[root@vz-test conf]# echo $?
0
[root@vz-test conf]# /usr/sbin/
rc.test-parametrs-changed.sh
check_settings 301 10.0.5.31 yes vps256M 10.0.5.52
[root@vz-test conf]# echo $?
1
[root@vz-test conf]#
but, bash exec(system command) return 0:
[root@vz-test conf]# bash /usr/sbin/
rc.test-parametrs-changed.sh
check_settings 301 10.0.5.31 yes vps756M 10.0.5.52
[root@vz-test conf]# echo $?
0
[root@vz-test conf]#
but "unless" inside puppet exec run exec:
exec { "vecfg-applyset_${name}":
command => "if [[ ( -d /vz/private/${veid} ) && ( -f /etc/
sysconfig/vz-scripts/${veid}.conf) && \
( $(/usr/sbin/
rc.test-parametrs-changed.sh check_settings ${veid}
${veip} ${vetarif} ${vedns} ; echo $?) -eq 1)]] ; \
then vzctl set ${veid} --hostname ${vehostname} --ipadd ${veip}
--nameserver ${vedns} --save; \
vzctl set ${veid} --applyconfig ${vetarif} --save; fi",
path => ["/usr/bin", "/usr/sbin"],
unless => "bash /usr/sbin/
rc.test-parametrs-changed.sh
check_settings ${veid} ${veip} ${vetarif} ${vedns}",
}
If/else inside "command" works, as i test (i use if/else inside
command, becouse unless/onlyif does'nt work for me):
[root@vz-test conf]# cat ~/tmp_2 | grep -v _off
Dec 15 13:41:05 vz-test puppetd[23387]: Starting catalog run
Dec 15 13:41:06 vz-test puppetd[23387]: (//Node[vz-test.local]/
Mod_class_ovzconfigs::Mod_def_veadm[customer2.vps.local]/Exec[vecfg-
applyset_customer2.vps.local]/returns) executed successfully
Dec 15 13:41:16 vz-test puppetd[23387]: (//Node[vz-test.local]/
Mod_class_ovzconfigs::Mod_def_ovzbackup[ovzserver_backup]/Cron
[incremental_backup]/weekday) defined 'weekday' as '*'
Dec 15 13:43:07 vz-test puppetd[23387]: (//Node[vz-test.local]/
Mod_class_ovzconfigs::Mod_def_veadm[customer1.vps.local]/Exec[vecfg-
applyset_customer1.vps.local]/returns) executed successfully
Dec 15 13:43:14 vz-test puppetd[23387]: (//Node[vz-test.local]/
Mod_class_ovzconfigs::Mod_def_veadm[customer4.vps.local]/Exec[vecfg-
applyset_customer4.vps.local]/returns) executed successfully
Dec 15 13:43:29 vz-test puppetd[23387]: Finished catalog run in 143.67
seconds