Issue #4288 has been updated by Daniel Pittman.
Status changed from Rejected to Closed
John Sellens wrote:
> Another workaround, which I'll mention just in case anyone else bumps into
> this problem and this issue ticket, is to start your command line with "true
> &&" e.g.
Oh! This is totally no longer true or accurate! We added the `shell` provider
to Puppet 2.7 to address exactly this use case; you can now just:
<pre>
exec { "whatever":
provider => shell,
command => "if this; then that; else those; fi"
}
</pre>
> /bin/true exists, so the command should get passed to the shell. This is
> sometimes more comprehensible than putting the whole command into a bash -c
> construct.
That won't work any more; our default provider will directly exec /bin/true and
pass everything else - including the shell control characters - to it as
arguments. However, picking the right provider totally works. :)
----------------------------------------
Bug #4288: Error if exec command starts with shell built-in like "if"
https://projects.puppetlabs.com/issues/4288
Author: Alan Harder
Status: Closed
Priority: Normal
Assignee:
Category: exec
Target version:
Affected Puppet version: 2.6.1
Keywords:
Branch:
<pre>exec { 'foo':
command => 'if [ "abc" != "def" ]; then echo "this is a test"; fi',
logoutput => true
}</pre>
With the above test case on 2.6.0rc4 (on Solaris 10 with ruby 1.8.7) I get:
<pre>err: /Stage[main]//Node[...]/Exec[foo]/returns: change from notrun to 0
failed: Could not find executable 'no if in /usr/bin /usr/sbin'</pre>
A command like this worked in 0.25.5.. is the behavior change intentional, or
is this a bug?
Side node: if I add whitespace at the front (command => ' if [ .....') then the
error says *Could not find command ''*
--
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://projects.puppetlabs.com/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.