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

Multiple tidy resources with same path but different matches causes an error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.5.2
    • Fix Version/s: PUP 4.8.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      0
    • Sprint:
      Client 2016-08-24, Client 2016-09-07
    • Release Notes:
      New Feature
    • Release Notes Summary:
      Multiple tidy resources can now manage the same directory

      Description

      Having multiple tidy resources with the same path but different matches parameters causes an error:

      $ puppet apply -e '
      > tidy { "test1":
      >   path => "/tmp/tidy",
      >   matches => "some-regex.*",
      >   recurse => true,
      > }
      > tidy { "test2":
      >   path => "/tmp/tidy",
      >   matches => "some-other-regex.*",
      >   recurse => true,
      > }
      > '
      Notice: Compiled catalog for derezzed.roam.corp.google.com in environment production in 0.05 seconds
      Error: Cannot alias Tidy[test2] to ["/tmp/tidy"]; resource ["Tidy", "/tmp/tidy"] already declared
      

      The error is thrown during catalog generation, the key passed into that alias method comes from the resource's uniqueness_key and class. The uniqueness_key is generated from the type's key_attributes which are all parameters that are marked "isnamevar" or are called name. The parameter Tidy declares isnamevar is path, so having multiple Tidy resources with the same path will fail even if they have different matches parameters.

        Attachments

          Activity

            People

            • Assignee:
              phong Phong Ly
              Reporter:
              ccaviness Clay Caviness
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support