Issue #19697 has been updated by jared jennings.

Sharp eye. I followed your references and read #6553, #1630 and #4884. It 
appears that after #4884, an array passed to the `command` parameter has a 
meaning, and that is that it gives an executable and a series of arguments. But 
there's still nothing in the documentation for the `exec` type that says this: 
otherwise I would have found it and never filed this ticket.

So a parse error should indeed not be raised if an array is passed as the 
command. But also the error "private method `scan' called for ...:Array" should 
not be raised when an array is passed as the command. The scan method is called 
based on an assumption that the value of command is a String, not an Array. The 
code where the `scan` method is called should deal with the idea that the value 
of command may be an Array.

So, the behavior I expected when filing this issue is not the behavior Puppet 
should exhibit. But Puppet does not behave as #4884 says, and I aver that the 
documentation is incomplete. Accordingly I will file two new tickets.
----------------------------------------
Bug #19697: giving an array as the command parameter of exec throws an obscure 
error
https://projects.puppetlabs.com/issues/19697#change-86933

Author: jared jennings
Status: Duplicate
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.7.18
Keywords: 
Branch: 


It's probably quite silly to try to give multiple commands to one exec 
resource. But giving an array as the value for a parameter frequently works, 
and I wasn't paying a lot of attention. When I tried to give an array as the 
value of command for an exec resource, it took me a good ten minutes to track 
down what had happened, because I got only this error:

    err: Got an uncaught exception of type NoMethodError: private method `scan' 
called for #<Array:0x7f11f3bebbd8>

Furthermore, the puppet agent said, "Finished catalog run," rather than 
failing, and I'm not sure whether it actually finished or not. And my manifest 
passed through `puppet parser validate` with no errors.

I think that when I give multiple values for the command parameter of an exec 
resource, either it should work or it should cause a parse error.

I found this problem while running Puppet 2.7.18; but a look at the code in the 
master branch on Github suggests it may act the same way.

`--trace` revealed that the offending call to the scan method was on line 447 
of type/exec.rb, where we're autorequiring files named in the value of the 
command parameter (`self[:command].scan(file_regex) ...`); but I expect that if 
one were to cause a parse error, it would be by adding a validate block to the 
`newparam(:command)`, around line 132 of type/exec.rb.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to