I know this sounds odd, but what if you put command in quotes in your hash,
like this:
$stuff = { '/bin/false' => { 'command' => "/bin/echo 'hello there'" } }
create_resources('exec', $stuff)
This seems to work for me - does it work for you?
On Tue, Dec 4, 2012 at 4:07 PM, Sean Kamath
<[email protected]>wrote:
> Hi.
>
> I've done some googling, and did find something sort of similar in a
> bug report (see http://projects.puppetlabs.com/issues/16082 and the
> second to last update -- but as I created this post, I realize it's
> almost certainly not related at all).
>
> In a bunch of narrowing, I've found that apparently when you create
> the resources using "create_resources" for the built-in type 'exec',
> it completely ignores that 'command' argument. Here's that test:
>
> foo.pp:
> --------
> $other = {
> '/bin/false' => { command => '/bin/echo hello', },
> }
> create_resources('exec', $other)
> --------
>
> And the output from puppet apply foo.pp:
>
> err: /Stage[main]//Exec[/bin/false]/returns: change from notrun to 0
> failed: /bin/false returned 1 instead of one of [0]
> notice: Finished catalog run in 0.29 seconds
>
> Note that though the resource is created with a title of '/bin/false'
> (according to the docs on puppetlabs.com), with the parameter
> "command" set to '/bin/echo hello'. However, /bin/false is executed.
>
> The command is NOT ignored if the resource is instantiated outside of
> the create_resources() function:
>
> foo.pp:
> --------
> exec { '/bin/false':
> command => '/bin/echo hello'
> }
> --------
>
> And the output from puppet apply foo.pp:
>
> notice: /Stage[main]//Exec[/bin/false]/returns: executed successfully
> notice: Finished catalog run in 0.32 seconds
>
> In this case, the title is /bin/false, but the echo is called (or
> true, or whatever you want to run).
>
> Am I missing something, or is this a bug? It's an odd one as well,
> because I *really* want to create titles that are arbitrary names, and
> specify a command. Fortunately, the 'name' parameter, which is used
> instead of 'command' if 'command' is not found, works.
>
> Thanks for any help.
>
> Sean
>
> --
> 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.
>
>
--
Gary Larizza
Professional Services Engineer
Puppet Labs
--
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.