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

yumrepo 'descr' property doesn't map to the 'name' INI property

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 3.5.0
    • Fix Version/s: PUP 3.5.1
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Week 2014-4-09 to 2014-4-16

      Description

      In Puppet <= 3.4.3, the yumrepo 'descr' property was mapped to the 'name' INI property. This is necessary because the 'name' parameter is the namevar, and it acts as a mostly arbitrary resource title. This name doesn't map to the 'name' INI property, so the 'descr' field was mapped to it.

      In Puppet 3.5.0 this mapping was removed, so the 'descr' property' would be mapped to a 'descr' INI key. This behavior is incorrect, and using yum after creating a repo with the yumrepo provider has output like this:

      Repository 'local-base' is missing name in configuration, using id
      Repository 'local-centosplus' is missing name in configuration, using id
      Repository 'local-extras' is missing name in configuration, using id
      Repository 'local-updates' is missing name in configuration, using id
      

      3.4.3 mapping implementation:

      '#inikey' default implementation:

          def inikey
            name.to_s
          end
      

      IniProperty DSL:

          # Set the key associated with this property to KEY, instead
          # of using the property's NAME
          def self.inikey(key)
            # Override the inikey instance method
            # Is there a way to do this without resorting to strings ?
            # Using a block fails because the block can't access
            # the variable 'key' in the outer scope
            self.class_eval("def inikey ; \"#{key.to_s}\" ; end")
          end
      

      '#sync' and '#retrieve' using 'inikey':

          def sync
            if safe_insync?(retrieve)
              result = nil
            else
              result = set(self.should)
              if should == :absent
                resource.section[inikey] = nil
              else
                resource.section[inikey] = should
              end
            end
            result
          end
       
          def retrieve
            resource.section[inikey]
          end
      

      'descr' property inikey invocation:

          newproperty(:descr, :parent => Puppet::IniProperty) do
            desc "A human-readable description of the repository.
              This corresponds to the name parameter in `yum.conf(5)`.
              #{ABSENT_DOC}"
            newvalue(:absent) { self.should = :absent }
            newvalue(/.*/) { }
            inikey "name"
          end
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              adrien Adrien Thebo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support