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

Backport PUP-4386 - group resource doesn't work on Windows when members is an array and noop is used

    Details

    • Template:
    • Story Points:
      2
    • Sprint:
      Windows 2015-11-04, Windows 2015-11-18
    • CS Priority:
      Major
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Hide
      This change prevents both the loss of error detail when an invalid user name has been specified in a manifest on Windows, and the emission of an
      extraneous / misleading message about Puppet::Util::Log
      Show
      This change prevents both the loss of error detail when an invalid user name has been specified in a manifest on Windows, and the emission of an extraneous / misleading message about Puppet::Util::Log

      Description

      The following resource fails:

      group { 'administrators': 
        ensure => present, 
        members => ['TESTLA\aaa02364'], 
      }
      

      When applied:

      E:\mgmt\Puppet Labs\Puppet Enterprise\bin>puppet apply group.pp --noop 
      Notice: Compiled catalog for p0wvaplz0013_1249_1251 in environment production in 
      0.22 seconds 
      Error: undefined method `split' for #<Array:0x00000006201e70> 
      Error: /Group[administrators]: Could not evaluate: Puppet::Util::Log requires a 
      message 
      Notice: Finished catalog run in 0.41 seconds
      

      The problem is group.rb is_to_s does not handle array.

      E:\mgmt\Puppet Labs\Puppet Enterprise\bin>puppet apply group.pp --noop --trace 
      Notice: Compiled catalog for p0wvaplz0013_1249_1251 in environment production in 
      0.22 seconds 
      Error: undefined method `split' for #<Array:0x000000063bd200> 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/type/group.rb:102:in `is 
      _to_s' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction/resource_har 
      ness.rb:199:in `noop' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction/resource_har 
      ness.rb:126:in `sync_if_needed' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction/resource_har 
      ness.rb:89:in `block in perform_changes' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction/resource_har 
      ness.rb:88:in `each' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction/resource_har 
      ness.rb:88:in `perform_changes' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction/resource_har 
      ness.rb:20:in `evaluate' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction.rb:204:in `a 
      pply' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction.rb:217:in `e 
      val_resource' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction.rb:147:in `c 
      all' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/transaction.rb:147:in `b 
      lock (2 levels) in evaluate' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/puppet/lib/puppet/util.rb:327:in `block in 
      thinmark' 
      E:/MGMT/Puppet Labs/Puppet Enterprise/sys/ruby/lib/ruby/2.0.0/benchmark.rb:296:i 
      n `realtime'
      

      This patches is_to_s method, but getting array value back for currentvalue is not expected:

      def is_to_s(currentvalue) 
        if provider.respond_to?(:members_to_s) 
          currentvalue = '' if currentvalue.nil? 
          if currentvalue.is_a? ::Array 
            v = currentvalue 
          else 
          v = currentvalue.split(',') 
         end 
        return provider.members_to_s(v) 
        end
        super(currentvalue) 
      end
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  ryan.gard Ryan Gard
                  Reporter:
                  lee Lee Lowder
                  QA Contact:
                  Ryan Gard
                • Votes:
                  2 Vote for this issue
                  Watchers:
                  12 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: