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
This commit is contained in:
Dmitry Ilyin 2016-08-31 13:30:47 -05:00
parent b97124274d
commit f40a4669b9
3 changed files with 5 additions and 3 deletions

View File

@ -11,6 +11,7 @@ group :development, :test do
gem 'colorize'
gem 'parallel'
gem 'openstack'
gem 'activesupport', '< 5.0.0'
end
if ENV['PUPPET_GEM_VERSION']

View File

@ -1,4 +1,5 @@
require 'yaml'
require 'active_support/core_ext/hash/indifferent_access'
module Noop
class Task
@ -70,9 +71,9 @@ module Noop
facts_data[:puppetversion] = Puppet.version
end
# @return [Hash]
# @return [ActiveSupport::HashWithIndifferentAccess]
def facts_data
facts_data = {}
facts_data = ActiveSupport::HashWithIndifferentAccess.new
facts_hierarchy.each do |file_path|
begin
file_data = YAML.load_file file_path

View File

@ -35,7 +35,7 @@ Facts hierarchy:
gem = gem.to_s
return unless Object.const_defined? 'Gem'
return unless Gem.loaded_specs.is_a? Hash
return unless Gem.loaded_specs[gem].is_a? Gem::Specification
return unless Gem.loaded_specs[gem].respond_to? :version
Gem.loaded_specs[gem].version
end