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:
parent
b97124274d
commit
f40a4669b9
1
Gemfile
1
Gemfile
|
@ -11,6 +11,7 @@ group :development, :test do
|
||||||
gem 'colorize'
|
gem 'colorize'
|
||||||
gem 'parallel'
|
gem 'parallel'
|
||||||
gem 'openstack'
|
gem 'openstack'
|
||||||
|
gem 'activesupport', '< 5.0.0'
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV['PUPPET_GEM_VERSION']
|
if ENV['PUPPET_GEM_VERSION']
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
require 'active_support/core_ext/hash/indifferent_access'
|
||||||
|
|
||||||
module Noop
|
module Noop
|
||||||
class Task
|
class Task
|
||||||
|
@ -70,9 +71,9 @@ module Noop
|
||||||
facts_data[:puppetversion] = Puppet.version
|
facts_data[:puppetversion] = Puppet.version
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [Hash]
|
# @return [ActiveSupport::HashWithIndifferentAccess]
|
||||||
def facts_data
|
def facts_data
|
||||||
facts_data = {}
|
facts_data = ActiveSupport::HashWithIndifferentAccess.new
|
||||||
facts_hierarchy.each do |file_path|
|
facts_hierarchy.each do |file_path|
|
||||||
begin
|
begin
|
||||||
file_data = YAML.load_file file_path
|
file_data = YAML.load_file file_path
|
||||||
|
|
|
@ -35,7 +35,7 @@ Facts hierarchy:
|
||||||
gem = gem.to_s
|
gem = gem.to_s
|
||||||
return unless Object.const_defined? 'Gem'
|
return unless Object.const_defined? 'Gem'
|
||||||
return unless Gem.loaded_specs.is_a? Hash
|
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
|
Gem.loaded_specs[gem].version
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue