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

PMT won't install a module on windows if module_working_dir contains backslashes

    XMLWordPrintable

Details

    • Coremunity
    • Platform Core KANBAN
    • Bug Fix
    • Fixes a bug the prevented "puppet module install" from working on Windows when overriding the "module_working_dir" setting with a path containing backslashes, e.g. C:\modules

    Description

      If you override module_working_dir using a native windows path with backslashes, the PMT will fail to install the module, because it expects the path to contain forward slashes:

      C:\work\puppet [stable +25 ~0 -0 !]> bundle exec puppet module install puppetlabs-stdlib --module_working_dir C:\Windows\Temp --debug
      ...
      Error: Could not install package
        Package attempted to install file into
        "C:/Windows/Temp/cache/tmp-unpacker20150714-3276-hqzekd/puppetlabs-stdlib-4.6.0" under "C:\\Windows\\Temp/cache/tmp-unpacker20150714-3276-hqzekd".
      

      Changing that to forward slashes works, including if the case doesn't match:

      C:\work\puppet [stable +25 ~0 -0 !]> bundle exec puppet module install puppetlab
      s-stdlib --module_working_dir C:/windows/temp --debug
      ...
      Debug: Extracting: C:/windows/temp/cache/tmp-unpacker20150714-2640-1mynaxp/puppe
      tlabs-stdlib-4.6.0/lib/facter/util/puppet_settings.rb
      Notice: Installing -- do not interrupt ...
      C:/ProgramData/PuppetLabs/code/modules
      └── puppetlabs-stdlib (v4.6.0)
      

      A simple fix would be to ensure we call File.expand_path on whatever value is specified, as that canonicalizes the path (from ruby's perspective):

      C:\work\puppet [stable +25 ~0 -0 !]> irb
      irb(main):001:0> File.expand_path('C:\Windows\Temp')
      => "C:/Windows/Temp"
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              josh Josh Cooper
              Eric Thompson Eric Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support