Uploaded image for project: 'Puppet Server'
  1. Puppet Server
  2. SERVER-2298

Inconsistent file_metadata results when there is a plugin sync name collision

    Details

    • Type: Bug
    • Status: Accepted
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: SERVER 5.3.5
    • Fix Version/s: None
    • Component/s: Puppet Server
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Team:
      Server
    • Method Found:
      Customer Feedback
    • CS Priority:
      Reviewed

      Description

      The behavior of a name collision on of a fact is inconsistent when it comes to plugin sync. As multiple developers or development teams may name facts identically, it is easy to get in a situation where two modules have the same fact name. Currently, only one of the facts will be synced to the agent, which can cause a confusion in trying to debug why the fact is not working as designed. The fact that is chosen is inconsistent and can be different across masters.

      To eliminate this as a potential issue within environments, there should be a mechanism to detect and alert the user that a name collision has occurred. Alternativley, facts could be scoped to their respective modules, but the agent would then be responsible for handling name collisions across modules.

      Reproduction
      To reproduce the issue

      1. Create a fact with the same name in two different modules in the same environment
      2. Run the agent and notice that only one of the facts is in the plugin sync.
      3. Restart puppetserver (removing the file sync client cache if it exists)
      4. Run the agent and notice which one of the facts has been synced

      Note: Different puppetservers may use different versions of the fact, which is even more inconsistent.

      An example of this is below.

      root@pe-201814-master modules]# tree first/ second/
      first/
      └── lib
          └── facter
              └── test.rb
      second/
      └── lib
          └── facter
              └── test.rb
      

      The file_metadatas endpoint only shows one of the files.

      [root@pe-201814-master modules]# curl -H 'Accept: application/json, text/pson' --cert $(puppet config print hostcert) --key $(puppet config print hostprivkey) --cacert $(puppet config print localcacert) "https://$(puppet config print server):8140/puppet/v3/file_metadatas/plugins?environment=production&links=follow&recurse=true&source_permissions=ignore&ignore=.svn&ignore=CVS&ignore=.git&ignore=.hg&checksum_type=md5" | python -m json.tool  | grep -A 2 -B 11 test.rb
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100  113k    0  113k    0     0   452k      0 --:--:-- --:--:-- --:--:--  451k
          {
              "checksum": {
                  "type": "md5",
                  "value": "{md5}8ce0743b553e4a467fb2e16d40878c57"
              },
              "destination": null,
              "group": 992,
              "links": "follow",
              "mode": 420,
              "owner": 995,
              "path": "/etc/puppetlabs/code/environments/production/modules/second/lib",
              "relative_path": "facter/test.rb",
              "type": "file"
          },
      

      Querying the file_metadata endpoint for test.rb shows the same file.

      [root@pe-201814-master modules]# curl --cert $(puppet config print hostcert) --key $(puppet config print hostprivkey) --cacert $(puppet config print localcacert) "https://$(puppet config print server):8140/puppet/v3/file_metadata/plugins/facter/test.rb?environment=production" | python -m json.tool
      {
          "checksum": {
              "type": "md5",
              "value": "{md5}8ce0743b553e4a467fb2e16d40878c57"
          },
          "destination": null,
          "group": 992,
          "links": "manage",
          "mode": 420,
          "owner": 995,
          "path": "/etc/puppetlabs/code/environments/production/modules/second/lib/facter/test.rb",
          "relative_path": null,
          "type": "file"
      }
      

      A restart of the puppetserver service and clearing the file sync cache results in a different file to be presented.

      [root@pe-201814-master modules]# curl -H 'Accept: application/json, text/pson' --cert $(puppet config print hostcert) --key $(puppet config print hostprivkey) --cacert $(puppet config print localcacert) "https://$(puppet config print server):8140/puppet/v3/file_metadatas/plugins?environment=production&links=follow&recurse=true&source_permissions=ignore&ignore=.svn&ignore=CVS&ignore=.git&ignore=.hg&checksum_type=md5" | python -m json.tool  | grep -A 2 -B 11 test.rb
          {
              "checksum": {
                  "type": "md5",
                  "value": "{md5}09da16de901b9126793d66189c62295d"
              },
              "destination": null,
              "group": 992,
              "links": "follow",
              "mode": 420,
              "owner": 995,
              "path": "/etc/puppetlabs/code/environments/production/modules/first/lib",
              "relative_path": "facter/test.rb",
              "type": "file"
          },
      

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                jarret.lavallee Jarret Lavallee
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: