Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-9265

group resource: members parameter: array values broken

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • PUP 5.5.7
    • None
    • None
    • CentOS Linux release 7.5.1804 (Core)

      x86_64

      Ubuntu 16.04 x86_64

    • Platform OS
    • Platform OS Kanban
    • Needs Assessment
    • Needs Assessment

    Description

      Puppet Version: 5.5.7
      Puppet Server Version: 5.3.3
      OS Name/Version: CentOS 7.5

      Starting with 5.5.7 (5.5.6 works) the members parameter of the group resource does not work with values of type Array anymore due to an evaluation error during catalog application.

       

      /opts/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type/group.rb:136f:

      # The members property should also accept a comma separated
      # list of members (a String parameter) for backwards
      # compatibility. Unfortunately, the List property would treat
      # our comma separated list of members as a single-element Array.
      # This override of should= ensures that a comma separated list of
      # members is munged to an array of members, which is what we want.
      # Note that we cannot use `munge` because that will pass in each
      # array element instead of the entire array if the members property
      # is specified as an array of members, which would cause each member
      # to be munged into an array for that case. This is undesirable
      def should=(values)
        super(values)  if @should.length == 1 && @should.first.include?(delimiter)
          @should = @should.first.split(delimiter)
        end  @should
      end
      

      This code was introduced with 5.5.7 and seems to break arrays completely instead of just adding backwards compatibility for strings.

       

       

      Desired Behavior:

      Handle arrays as before.

      Actual Behavior:

      Group resources with members parameter values of type Array break puppet runs.

      modules/module/manifests/init.pp:

      group { 'foo':
          ensure => 'present',
          members => ['bar'],
          auth_membership => true;
      }

      puppet agent --test:

      Error: /Stage[main]/module/Group[foo]: Could not evaluate: undefined method `split' for ["bar"]:Array
      

       

       

      Attachments

        Issue Links

          Activity

            People

              enis.inan Enis Inan
              kn Klemens Nanni
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support