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

Don't change current working directory when listing modules

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • PUP 6.25.0, PUP 7.10.0
    • None
    • Coremunity
    • Platform Core KANBAN
    • Needs Assessment
    • Bug Fix
    • Puppet server and agent no longer change their current working directories when listing modules in an environment directory.
    • Needs Assessment

    Description

      When listing modules by path, puppet changes the current working directory unnecessarily. This was first reported in PUP-9997, but broken out here into a separate issue:

      def modules_by_path
          modules_by_path = {}
          modulepath.each do |path|
            if Puppet::FileSystem.exist?(path)
              Dir.chdir(path) do
                module_names = Dir.entries(path).select do |name|
                  Puppet::Module.is_module_directory?(name, path)
                end
                modules_by_path[path] = module_names.sort.map do |name|
                  Puppet::Module.new(name, File.join(path, name), self)
                end
              end
            else
              modules_by_path[path] = []
            end
          end
          modules_by_path
        end
      

      Attachments

        Issue Links

          Activity

            People

              josh Josh Cooper
              josh Josh Cooper
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support