Hi all! Please help me get understand my error:
I have problems with onlyif/unless directives. Simple test work fine, for example: exec { "Update ovz templates": command => "wget -O /vz/template/cache/centos-5-i386- default.tar.gz http://install.local/ovz/templates/centos-5-i386-default.tar.gz && rm /vz/firsh_install.lock", path => "/usr/bin:/usr/sbin:/bin", onlyif => "test -f /vz/firsh_install.lock" } It's exec run, and download teplate only if file /vz/ firsh_install.lock exist. I make custom script for running inside bash shell on puppet node, script return 0 or 1 When i try use it in puppet module, puppet run unless exec always, but onlyif exec never run. this exec does'nt work true: exec { "vecfg-applyset_${name}": command => "if [[ ( -d /vz/private/${veid} ) && ( -f /etc/ sysconfig/vz-scripts/${veid}.conf)]] ; then vzctl set ${veid} -- hostname ${vehostname} --ipadd ${veip} --nameserver ${vedns} --save; vzctl set ${veid} --applyconfig ${vetarif} --save; fi", path => ["/usr/bin", "/usr/sbin"], unless => "/usr/sbin/rc.test-parametrs-changed.sh ${veid} ${veip} $ {vetarif} ${vedns}", } file /usr/sbin/rc.test-parametrs-changed.sh work, in shell, fine (return 0 or 1): ============================ cat /usr/sbin/rc.test-parametrs- changed.sh #!/bin/ bash #Check VE settings for Puppet. Returned "1", if settings changed, else return 0 #Get variables VEID=$2 #also, $VEIP variable is variable of on/off status of conainer VEIP=$3 VETARIF=$4 VEDNS=$5 PATHVE="/vz/private/"$VEID PATHVECONF="/etc/vz/conf/"$VEID".conf" check_settings() { if [[ ( $(grep $VEIP $PATHVECONF 1>/dev/null 2>&1; echo $?) -eq 0) && ( $(grep $VETARIF $PATHVECONF 1>/dev/null 2>&1; echo $?) -eq 0 ) && ( $ (grep $VEDNS $PATHVECONF 1>/dev/null 2>&1; echo $? ) -eq 0 ) ]]; then exit 0; else exit 1; fi } check_status() { if [[ ( $(grep $VEIP $PATHVECONF 1>/dev/null 2>&1; echo $?) -eq 0 ) ]]; then exit 0; else exit 1; fi } case "$1" in check_settings) check_settings ;; check_status) check_status ;; *) echo $"Usage: $0 {check_settings|check_status}" exit 0 esac -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-us...@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.