{"record":{"id":"28090c06126c503c","repo":"theforeman/foreman","slug":"unable-to-get-environments-from-puppet","errorCode":null,"errorMessage":"Unable to get environments from Puppet","messagePattern":"Unable to get environments from Puppet","errorType":"exception","errorClass":"ProxyException","httpStatus":null,"severity":"error","filePath":"app/services/proxy_api/puppet.rb","lineNumber":11,"sourceCode":"module ProxyAPI\n  class Puppet < ProxyAPI::Resource\n    def initialize(args)\n      @url = args[:url] + \"/puppet\"\n      super args\n    end\n\n    def environments\n      parse(get(\"environments\"))\n    rescue => e\n      raise ProxyException.new(url, e, N_(\"Unable to get environments from Puppet\"))\n    end\n\n    def environment(env)\n      parse(get(\"environments/#{env}\"))\n    rescue => e\n      raise ProxyException.new(url, e, N_(\"Unable to get environment from Puppet\"))\n    end\n\n    def classes(env)\n      return if env.blank?\n      pcs = parse(get(\"environments/#{env}/classes\"))\n      Hash[pcs.map { |k| [k.keys.first, Foreman::ImporterPuppetclass.new(k.values.first)] }]\n    rescue RestClient::ResourceNotFound\n      {}\n    rescue => e\n      raise ProxyException.new(url, e, N_(\"Unable to get classes from Puppet for %s\"), env)\n    end\n","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/proxy_api/puppet.rb#L1-L29","documentation":"Error \"Unable to get environments from Puppet\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/proxy_api/puppet.rb:11 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}