Issue #9850 has been updated by Jacob Helwig.

Subject changed from Arrays changed to strings in custom type parameters to 
Parameters and properties should handle single values the same with 
':array_matching => :all'
Status changed from Needs More Information to Accepted
Target version set to Telly

Throwing together a quick test type/provider to test this out, I found the 
following behavior when retrieving the value from `resource[:foo]` in the 
provider:

* Parameters
  * Single value specified as a string in .pp file: String
  * Single-element array in .pp file: String
  * Multi-element array in .pp file: Array
* Property
  * Single value specified as a string in .pp file: Array
  * Single-element array in .pp file: Array
  * Multi-element array in .pp file: Array

So, the two definitely handle things differently, but I can't think of a reason 
why this would be desirable.
----------------------------------------
Bug #9850: Parameters and properties should handle single values the same with 
':array_matching => :all'
https://projects.puppetlabs.com/issues/9850

Author: Philip Jameson
Status: Accepted
Priority: Normal
Assignee: Jacob Helwig
Category: 
Target version: Telly
Affected Puppet version: 
Keywords: 
Branch: 


I'm currently configuring a puppet setup. Puppetmaster and puppet client are 
both version 2.7.3, and ruby version 2.8.7 patch level 352
I was creating a custom type, and had an element as a parameter. When that 
parameter had a single element, puppet sent it as a string, rather than as an 
array.
If I changed it from a parameter to a property, it showed up correctly on the 
client as an array.

Excerpt from type (nothing special here):
    newparam(:allowed_ips, :array_matching => :all) do 
      defaultto :absent
    end

In the provider, it then would be an array only if more than one element was 
specified in the manifest.
Let me know what other details you need.


-- 
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.

Reply via email to