Issue #6746 has been reported by Max Martin.
----------------------------------------
Bug #6746: Exec parameters handle arrays inconsistently
https://projects.puppetlabs.com/issues/6746
Author: Max Martin
Status: Needs Decision
Priority: Normal
Assignee: Nigel Kersten
Category: exec
Target version:
Affected Puppet version:
Keywords:
Branch:
Currently the timeout parameter to the exec type will accept an array as input,
but the tries and try_sleep parameter do not (as noted by pending tests in the
exec type spec). The way that timeout 'handles' arrays, though, is just by
taking the first item from them and discarding the rest:
newparam(:timeout) do
desc "The maximum time the command should take. If the command takes
longer than the timeout, the command is considered to have failed
and will be stopped. Use any negative number to disable the timeout.
The time is specified in seconds."
munge do |value|
value = value.shift if value.is_a?(Array)
if value.is_a?(String)
unless value =~ /^[-\d.]+$/
raise ArgumentError, "The timeout must be a number."
end
Float(value)
else
value
end
end
defaultto 300
end
None of this is covered in the documentation for exec
(http://docs.puppetlabs.com/references/latest/type.html#exec). We either need
to change the behavior of the other parameters to match this one, come up with
a new, better way to handle arrays, or remove support for handling any input in
arrays. My recommendation is to drop support for arrays for these parameters
altogether, since our current "support" for arrays just discards everything but
the first item, and all of these parameters basically support singleton
arguments anyways.
--
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.