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
- .meta_to_facts(input) ⇒ 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.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rspec-puppet-facts.rb', line 51 def self. = if ['operatingsystem_support'].nil? fail StandardError, "Unknown operatingsystem support" end os_sup = ['operatingsystem_support'] os_sup.collect do |os_rel| os = (os_rel['operatingsystem']) os_rel['operatingsystemrelease'].collect do |release| rel = (release) [ "#{os}-#{rel}-i386", "#{os}-#{rel}-x86_64" ] end end.flatten 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.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rspec-puppet-facts.rb', line 71 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.
23 24 25 |
# File 'lib/rspec-puppet-facts.rb', line 23 def self. @meta_supported_os ||= end |
.meta_to_facts(input) ⇒ 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.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rspec-puppet-facts.rb', line 28 def self.(input) = { 'RedHat' => 'redhat', 'CentOS' => 'centos', 'Ubuntu' => 'ubuntu', 'OracleLinux' => 'oracle', 'SLES' => 'sles', 'Scientific' => 'scientific', 'Debian' => 'debian', '14.04' => '1404', '12.04' => '1204', '10.04' => '1004', '11 SP1' => '11', } ans = [input] if ans ans else input end end |
Instance Method Details
#on_supported_os(supported_os = RspecPuppetFacts.meta_supported_os) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rspec-puppet-facts.rb', line 6 def on_supported_os(supported_os = RspecPuppetFacts.) h = {} supported_os.map do |os_sup| facts = {} # TODO: use SemVer here facter_minor_version = Facter.version[0..2] file = File.(File.join(File.dirname(__FILE__), "../facts/#{facter_minor_version}/#{os_sup}.facts")) File.read(file).each_line do |line| key, value = line.split(' => ') facts[key.to_sym] = value.chomp unless value.nil? end h[os_sup] = facts end h end |