summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Ilyin <dilyin@mirantis.com>2016-08-31 13:30:47 -0500
committerDmitry Ilyin <dilyin@mirantis.com>2016-08-31 14:06:47 -0500
commitf40a4669b9d0854f832fb2d4d7152f9668662115 (patch)
treef2fcd5de46487910c6f428e82143376f436a0747
parentb97124274d891e4de31351eb2433bfec97e8a6a6 (diff)
Misc fixes
* Change facts structure from a Hash to a HashWithIndifferentAccess. It will simplyfy adding facts values and working with them. * Fix Gem versions reporter. Change-Id: Ie28b2ea6bcd854e96cc8d9833be8adaafd689140
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Dmitry Ilyin <dilyin@mirantis.com> Workflow+1: Dmitry Ilyin <dilyin@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 31 Aug 2016 23:04:18 +0000 Reviewed-on: https://review.openstack.org/363879 Project: openstack/fuel-noop-fixtures Branch: refs/heads/master
-rw-r--r--Gemfile1
-rw-r--r--lib/noop/task/facts.rb5
-rw-r--r--lib/noop/task/report.rb2
3 files changed, 5 insertions, 3 deletions
diff --git a/Gemfile b/Gemfile
index 74a52b5..316d132 100644
--- a/Gemfile
+++ b/Gemfile
@@ -11,6 +11,7 @@ group :development, :test do
11 gem 'colorize' 11 gem 'colorize'
12 gem 'parallel' 12 gem 'parallel'
13 gem 'openstack' 13 gem 'openstack'
14 gem 'activesupport', '< 5.0.0'
14end 15end
15 16
16if ENV['PUPPET_GEM_VERSION'] 17if ENV['PUPPET_GEM_VERSION']
diff --git a/lib/noop/task/facts.rb b/lib/noop/task/facts.rb
index 7aaf735..858243f 100644
--- a/lib/noop/task/facts.rb
+++ b/lib/noop/task/facts.rb
@@ -1,4 +1,5 @@
1require 'yaml' 1require 'yaml'
2require 'active_support/core_ext/hash/indifferent_access'
2 3
3module Noop 4module Noop
4 class Task 5 class Task
@@ -70,9 +71,9 @@ module Noop
70 facts_data[:puppetversion] = Puppet.version 71 facts_data[:puppetversion] = Puppet.version
71 end 72 end
72 73
73 # @return [Hash] 74 # @return [ActiveSupport::HashWithIndifferentAccess]
74 def facts_data 75 def facts_data
75 facts_data = {} 76 facts_data = ActiveSupport::HashWithIndifferentAccess.new
76 facts_hierarchy.each do |file_path| 77 facts_hierarchy.each do |file_path|
77 begin 78 begin
78 file_data = YAML.load_file file_path 79 file_data = YAML.load_file file_path
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