node.js - Puppet "onlyif" attribute cannot find not(!) operator -
i trying figure out if node package pm2 installed in path , executable or not following puppet code.
exec { "create symbolic link pm2": cwd => "${pm2_link_dir}", path => ['/usr/bin','/bin','/usr/sbin','/sbin'], onlyif => "! node &> /dev/null", command => "ln -s ../lib/node_modules/pm2/bin/pm2 pm2" }
it telling me cannot find command "!". right way find out if program installed , executable?? , why puppet cannot understand not operator?? working on redhat master , slave.
and why puppet cannot understand not operator?
the !
operator provided shell; not command. using exec
's default provider (posix
) runs commands directly rather via shell. (or documented do. has come light posix
provider runs commands via shell, in apparent contradiction of docs.)
it anyway bit silly use !
in exec
's onlyif
attribute, when instead drop !
, switch unless
attribute instead. , drop redirection, relies on shell.
is right way find out if program installed , executable?
it better know whether program should available on specific target node, , necessary ensure is available. if must inquire node state, better via custom fact.
with said, don't think approach inherently wrong, though of course requested program in path specify in exec
.
Comments
Post a Comment