Module: RspecPuppetFacts
- Defined in:
- lib/rspec-puppet-facts.rb,
lib/rspec-puppet-facts/version.rb
Defined Under Namespace
Modules: Version
Class Method Summary collapse
- .get_meta_supported_os ⇒ Object private
- .get_metadata ⇒ Object private
- .meta_supported_os ⇒ Object private
Instance Method Summary collapse
Class Method Details
.get_meta_supported_os ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 41 42 43 44 |
# File 'lib/rspec-puppet-facts.rb', line 38 def self. = if ['operatingsystem_support'].nil? fail StandardError, "Unknown operatingsystem support" end ['operatingsystem_support'] end |
.get_metadata ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rspec-puppet-facts.rb', line 47 def self. if ! File.file?('metadata.json') fail StandardError, "Can't find metadata.json... dunno why" end = JSON.parse(File.read('metadata.json')) if .nil? fail StandardError, "Metadata is empty" end end |
.meta_supported_os ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/rspec-puppet-facts.rb', line 33 def self. ||= end |
Instance Method Details
#on_supported_os(opts = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rspec-puppet-facts.rb', line 6 def on_supported_os( opts = {} ) opts[:hardwaremodels] ||= ['x86_64'] opts[:supported_os] ||= RspecPuppetFacts. h = {} opts[:supported_os].map do |os_sup| = os_sup['operatingsystem'].downcase os_sup['operatingsystemrelease'].map do || opts[:hardwaremodels].each do |hardwaremodel| os = "#{operatingsystem}-#{operatingsystemmajrelease.split(" ")[0]}-#{hardwaremodel}" # TODO: use SemVer here facter_minor_version = Facter.version[0..2] file = File.(File.join(File.dirname(__FILE__), "../facts/#{facter_minor_version}/#{os}.facts")) if ! File.file?(file) warn "Can't find facts for '#{os}' for facter #{facter_minor_version}, skipping..." else h[os] = JSON.load(IO.read(file)) end end end end h end |