On Dec 13, 1:20 pm, sHaggY_caT <[email protected]> wrote:
> Please help me get understand my error:
The debug output from trying to run these would probably help with
that, but I'll see whether I can provide at least a little insight
anyway.
> I have problems with onlyif/unless directives. Simple test work fine,
[...]
> 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):
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.
For debugging your manifests, you could try using
unless => "/bin/true"
or
unless => "/bin/false"
to take that test script out of the picture.
Speaking of the test script, are you sure your nodes are getting and
using the correct version? You can have the puppetmaster distribute
it, but you may need to set up a require for it to make sure its
downloaded first. (It's not clear from the docs whether Puppet will
autorequire it from the "unless" parameter.) You'll also want to make
sure its ownership and permissions are set appropriately.
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en.