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

md5lite, mtime not honoured for file type/provider

    XMLWordPrintable

    Details

    • Template:
    • Story Points:
      5
    • Sprint:
      Platform Client 2015-01-07, Platform Client 2015-01-21, Client 2015-02-04, Client 2015-02-18

      Description

      It seems I can't get the puppetmaster to honour the checksum => mtime setting, or the md5lite setting. So the following example has no performance improvement over just using md5:

      file { "/testtransfer":
        ensure => directory,
        recurse => remote,
        purge => true,
        checksum => mtime,
        source => "puppet:///modules/${module_name}/bigfileshere",
      }
      

      The problem seems to be in multiple places. The first place, I can't get the file_server/metadata to respond with mtime, md5lite checksums:

      # curl -k --cert /etc/puppetlabs/pupem --key /etc/puppetlabs/puppet/ssl/private_keys/puppetclient2.vm.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem -H 'Accept: yaml' 'https://puppet:8140/production/file_metadatas/modules/filetransfer/sles/SLES-11-SP1-DVD-x86_64-GM-DVD1.iso checksum_type=md5lite'
          --- 
            - !ruby/object:Puppet::FileServing::Metadata
              checksum: "{md5}d2e10420f3689faa49a004b60fb396b7"
              checksum_type: md5
              destination: 
              expiration: 2012-03-16 17:49:23.600743 -07:00
              ftype: file
              group: 0
              links: !ruby/sym manage
              mode: 420
              owner: 0
              path: /etc/puppetlabs/puppet/modules/filetransfer/files/sles/SLES-11-SP1-DVD-x86_64-GM-DVD1.iso
              relative_path: .
              stat_method: !ruby/sym lstat
      

      This is fixed with this patch:

          diff --git a/lib/puppet/indirector/file_server.rb b/lib/puppet/indirector/file_server.rb
          index 9516a40..9fbd57e 100644
          --- a/lib/puppet/indirector/file_server.rb
          +++ b/lib/puppet/indirector/file_server.rb
          @@ -51,6 +51,7 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
               Puppet::FileServing::Fileset.merge(*filesets).collect do |file, base_path|
                 inst = model.new(base_path, :relative_path => file)
                 inst.links = request.options[:links] if request.options[:links]
          +      inst.checksum_type = request.options[:checksum_type] if request.options[:checksum_type]
                 inst.collect
                 inst
               end
      

      Which does the correct thing:

          # curl -k --cert /etc/puppetlabs/puppet/ssl/certs/puppetclient2.vm.pem --key /etc/puppetlabs/puppet/ssl/private_keys/puppetclient2.vm.pem --cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem -H 'Accept: yaml' 'https://puppet:8140/production/file_metadatas/modules/filetransfer/sles/SLES-11-SP1-DVD-x86_64-GM-DVD1.iso?checksum_type=md5lite'
          --- 
            - !ruby/object:Puppet::FileServing::Metadata
              checksum: "{md5lite}bf619eac0cdf3f68d496ea9344137e8b"
              checksum_type: md5lite
              destination: 
              expiration: 2012-03-16 17:51:43.033651 -07:00
              ftype: file
              group: 0
              links: !ruby/sym manage
              mode: 420
              owner: 0
              path: /etc/puppetlabs/puppet/modules/filetransfer/files/sles/SLES-11-SP1-DVD-x86_64-GM-DVD1.iso
              relative_path: .
              stat_method: !ruby/sym lstat
      

      The second problem seems to be in the provider itself, it seems to me as if its still trying to do an md5 scan on the local filesystem - but I'll have to dig deeper to find the root cause for this.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              redmine.exporter redmine.exporter
              QA Contact:
              Eric Thompson
              Votes:
              4 Vote for this issue
              Watchers:
              19 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support