summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Ilyin <dilyin@mirantis.com>2016-09-02 11:26:03 -0500
committerDmitry Ilyin <dilyin@mirantis.com>2016-09-02 11:26:03 -0500
commit0e7a148f48a3043207acab7a8462fda5604ff98f (patch)
treea24fc5ba5d793a01d743a3c56672adfa070826d3
parent804ed6db601dd21b12aea8d06c3ace518d0c85f0 (diff)
Misc fixes 2
* Symbolize fact names form the facts files * Fix Gem versions reporter. Change-Id: I1a5afaf44d6f75c3485720f819477db5281900bb
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Maksim Malchuk <mmalchuk@mirantis.com> Workflow+1: Maksim Malchuk <mmalchuk@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Sun, 04 Sep 2016 15:49:43 +0000 Reviewed-on: https://review.openstack.org/364469 Project: openstack/fuel-noop-fixtures Branch: refs/heads/master
-rw-r--r--lib/noop/task/facts.rb1
-rw-r--r--lib/noop/task/report.rb2
-rw-r--r--lib/noop/utils.rb12
3 files changed, 14 insertions, 1 deletions
diff --git a/lib/noop/task/facts.rb b/lib/noop/task/facts.rb
index 7aaf735..957e023 100644
--- a/lib/noop/task/facts.rb
+++ b/lib/noop/task/facts.rb
@@ -77,6 +77,7 @@ module Noop
77 begin 77 begin
78 file_data = YAML.load_file file_path 78 file_data = YAML.load_file file_path
79 next unless file_data.is_a? Hash 79 next unless file_data.is_a? Hash
80 file_data = Noop::Utils.symbolize_hash_to_keys file_data
80 facts_data.merge! file_data 81 facts_data.merge! file_data
81 rescue 82 rescue
82 next 83 next
diff --git a/lib/noop/task/report.rb b/lib/noop/task/report.rb
index e477763..d118529 100644
--- a/lib/noop/task/report.rb
+++ b/lib/noop/task/report.rb
@@ -35,7 +35,7 @@ Facts hierarchy:
35 gem = gem.to_s 35 gem = gem.to_s
36 return unless Object.const_defined? 'Gem' 36 return unless Object.const_defined? 'Gem'
37 return unless Gem.loaded_specs.is_a? Hash 37 return unless Gem.loaded_specs.is_a? Hash
38 return unless Gem.loaded_specs[gem].is_a? Gem::Specification 38 return unless Gem.loaded_specs[gem].respond_to? :version
39 Gem.loaded_specs[gem].version 39 Gem.loaded_specs[gem].version
40 end 40 end
41 41
diff --git a/lib/noop/utils.rb b/lib/noop/utils.rb
index 463e537..9c184fe 100644
--- a/lib/noop/utils.rb
+++ b/lib/noop/utils.rb
@@ -104,5 +104,17 @@ module Noop
104 '=' * 70 104 '=' * 70
105 end 105 end
106 end 106 end
107
108 # Convert the top level keys of the hash to Symbols
109 # @param input_hash [Hash]
110 # @return [Hash <Symbol => Object>]
111 def self.symbolize_hash_to_keys(input_hash)
112 symbolized_hash = {}
113 input_hash.each do |key, value|
114 key = key.to_sym if key.respond_to? :to_sym
115 symbolized_hash[key] = value
116 end
117 symbolized_hash
118 end
107 end 119 end
108end 120end