|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
| 3 | +require_relative '../errors' |
3 | 4 | require_relative '../facts' |
4 | 5 | require_relative '../puppetdb' |
5 | 6 | require 'yaml' |
@@ -42,21 +43,21 @@ def self.fact_retriever(options = {}, node) |
42 | 43 | result.map { |x| facts[x['name']] = x['value'] } |
43 | 44 | if facts.empty? |
44 | 45 | message = "Unable to retrieve facts for node #{node} from PuppetDB (empty or nil)!" |
45 | | - raise OctocatalogDiff::Facts::FactRetrievalError, message |
| 46 | + raise OctocatalogDiff::Errors::FactRetrievalError, message |
46 | 47 | end |
47 | 48 |
|
48 | 49 | # Create a structure compatible with YAML fact files. |
49 | 50 | obj_to_return = { 'name' => node, 'values' => {} } |
50 | 51 | facts.each { |k, v| obj_to_return['values'][k.sub(/^::/, '')] = v } |
51 | 52 | break # Not return, to avoid LocalJumpError in Ruby 2.2 |
52 | 53 | rescue OctocatalogDiff::PuppetDB::ConnectionError => exc |
53 | | - exception_class = OctocatalogDiff::Facts::FactSourceError |
| 54 | + exception_class = OctocatalogDiff::Errors::FactSourceError |
54 | 55 | exception_message = "Fact retrieval failed (#{exc.class}) (#{exc.message})" |
55 | 56 | rescue OctocatalogDiff::PuppetDB::NotFoundError => exc |
56 | | - exception_class = OctocatalogDiff::Facts::FactRetrievalError |
| 57 | + exception_class = OctocatalogDiff::Errors::FactRetrievalError |
57 | 58 | exception_message = "Node #{node} not found in PuppetDB (#{exc.message})" |
58 | 59 | rescue OctocatalogDiff::PuppetDB::PuppetDBError => exc |
59 | | - exception_class = OctocatalogDiff::Facts::FactRetrievalError |
| 60 | + exception_class = OctocatalogDiff::Errors::FactRetrievalError |
60 | 61 | exception_message = "Fact retrieval failed for node #{node} from PuppetDB (#{exc.message})" |
61 | 62 | end |
62 | 63 | end |
|
0 commit comments