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

ClassInformationService.classes_per_environment call for non-existent file does not return errors

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • PUP 4.4.0
    • None
    • None
    • Not Needed
    • Not needed part of NC feature / speed improvements.

    Description

      If I pass a path to a manifest file that does not exist to the list of files to be parsed in a call to Puppet::InfoService::ClassInformationService.new.classes_per_environment, the return value just returns an empty array, as opposed to a hash with an :error key/value pair in it.

      For example, running the following code...

      require 'puppet'
      require 'puppet/info_service'
       
      files_to_parse = { "production" => [ "./parse.pp" ] }
       
      puts Puppet::InfoService::ClassInformationService.new.classes_per_environment(files_to_parse)
      

      ... where "./parse.pp" does not exist produces the following output:

      {"production"=>{"./parse.pp"=>[]}}
      

      If instead I have a file that exists at "./parse.pp" which has bad content in it...

      bogus manifest
      

      ... an :error is returned in a hash associated with the file name:

      {"production"=>{"./parse.pp"=>{:error=>"This Name has no effect. A value was produced and then forgotten (one or more preceding expressions may have the wrong form) at ./parse.pp:1:1"}}}
      

      It seems like both cases should result in an :error key being returned.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jeremy.barlow Jeremy Barlow
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support