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

Puppet 5.0 Regression: puppet resource with --modulepath no longer loads expected code



    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • PUP 5.0.0
    • PUP 5.0.1
    • None
    • Agent
    • 1
    • Agent 2017-07-26
    • Inspection
    • Bug Fix
    • Fixes a regression introduced in 5.0.0 that prevented {{puppet resource}} from loading custom types from modules when an explicit {{modulepath}} was specified.
    • No Action
    • covered by unit tests


      Previously, when calling puppet resource, a --modulepath could be specified to load additional type / provider code.

      For instance, with Puppet 4.10.4 / Ruby 2.3 running against a Windows node:

      bundle exec puppet resource acl c:\windows --modulepath C:\source\puppetlabs-acl-master\spec\fixtures\modules
      acl { 'c:\windows':
        group                      => 'S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464',
        inherit_parent_permissions => 'false',
        owner                      => 'S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464',
        permissions                => [{'affects' => 'self_only', 'identity' => 'NT SERVICE\TrustedInstaller', 'rights' => ['full']}, {'affects' => 'children_only', 'child_types' => 'containers', 'identity' => 'NT SERVICE\TrustedInstaller', 'rights' => ['full']}, {'affects' => 'self_only', 'identity' => 'NT AUTHORITY\SYSTEM', 'rights' => ['modify']}, {'affects' => 'children_only', 'identity' => 'NT AUTHORITY\SYSTEM', 'rights' => ['full']}, {'affects' => 'self_only', 'identity' => 'BUILTIN\Administrators', 'rights' => ['modify']}, {'affects' => 'children_only', 'identity' => 'BUILTIN\Administrators', 'rights' => ['full']}, {'affects' => 'self_only', 'identity' => 'BUILTIN\Users', 'rights' => ['read', 'execute']}, {'affects' => 'children_only', 'identity' => 'BUILTIN\Users', 'rights' => ['read', 'execute']}, {'affects' => 'children_only', 'identity' => 'CREATOR OWNER', 'rights' => ['full']}, {'affects' => 'self_only', 'identity' => 'APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES', 'rights' => ['read', 'execute']}, {'affects' => 'children_only', 'identity' => 'APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES', 'rights' => ['read', 'execute']}],

      However, on Puppet 5:

       bundle exec puppet resource acl c:\windows --modulepath C:\source\puppetlabs-acl-master\spec\fixtures\modules --trace --debug --verbose
      Debug: Runtime environment: puppet_version=5.0.0, ruby_version=2.4.1, run_mode=user, default_encoding=IBM437
      Debug: Evicting cache entry for environment 'production'
      Debug: Caching environment 'production' (ttl = 0 sec)
      Error: Could not run: Could not find type acl
      C:/source/puppet/lib/puppet/application/resource.rb:193:in `parse_args'
      C:/source/puppet/lib/puppet/application/resource.rb:134:in `block in main'
      C:/source/puppet/lib/puppet/context.rb:65:in `override'
      C:/source/puppet/lib/puppet.rb:308:in `override'
      C:/source/puppet/lib/puppet/application/resource.rb:133:in `main'
      C:/source/puppet/lib/puppet/application.rb:366:in `run_command'
      C:/source/puppet/lib/puppet/application.rb:358:in `block in run'
      C:/source/puppet/lib/puppet/util.rb:666:in `exit_on_fail'
      C:/source/puppet/lib/puppet/application.rb:358:in `run'
      C:/source/puppet/lib/puppet/util/command_line.rb:132:in `run'
      C:/source/puppet/lib/puppet/util/command_line.rb:72:in `execute'
      C:/source/puppet/bin/puppet:5:in `<top (required)>'
      C:/source/puppet/.bundle/gems/ruby/2.4.0/bin/puppet:22:in `load'
      C:/source/puppet/.bundle/gems/ruby/2.4.0/bin/puppet:22:in `<main>'

      I was able to git bisect to determine the source of the problem in https://github.com/puppetlabs/puppet/commit/72ecbe429ce5136ffe4ab628672d6dc9faabfcdc

      It seems that only code in the extended environment directory will now be loaded, which is a regression from previous behavior. I believe that --modulepath is commonly in use for module development workflows. For instance, I have been using the below for several years:

      bundle exec rake spec_prep
      # work on code
      # run unit tests
      bundle exec rake spec_standalone
      # run interactive tests with apply or resource
      bundle exec puppet apply foo.pp --modulepath ./spec/fixtures/modules


        Issue Links



              maggie Maggie Dreyer
              ethan Ethan Brown
              0 Vote for this issue
              7 Start watching this issue



                Zendesk Support