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

mk_resource_methods getters can't deal with false

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 3.5.0
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Week 2014-1-29 to 2014-2-05, Week 2014-2-5 to 2014-2-12

      Description

      I was writing a type and associated provider and noticed that during a puppet resource type if a property is set to false it suddenly didn't show up in the output.

        def self.mk_resource_methods
          [resource_type.validproperties, resource_type.parameters].flatten.each do |attr|
            attr = attr.intern
            next if attr == :name
            define_method(attr) do
              @property_hash[attr] || :absent
            end
       
            define_method(attr.to_s + "=") do |val|
              @property_hash[attr] = val
            end
          end
        end
      

      When @protery_hash[attr] returns the value false, because a property is set to false it now becomes absent because we end up with false || :absent

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              daenney Daniele Sluijters
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support