fuel-library/tests/noop/spec/lib/facts.rb
Dmitry Ilyin 854d30ecd9 Noop tests update
* Refactor "globals yaml" feature
* Add "task facts" feature
* Add tasts for the master node tasks
* Improve "status debug" message
* Many minor fixes

Closes-bug: #1517481

Change-Id: I6cb36ac45c75a3f4371580744007a3225bc0ec8e
2015-11-23 23:07:49 +03:00

66 lines
1.7 KiB
Ruby

require 'yaml'
class Noop
module Facts
def override_facts
facts = {}
return facts unless hiera_facts_override_present?
begin
override_facts = YAML.load_file facts_yaml_path
return {} unless facts.is_a? Hash
override_facts.each do |fact, value|
facts[fact.to_sym] = value
end
facts
rescue
return {}
end
end
def ubuntu_facts
{
:fqdn => fqdn,
:hostname => hostname,
:physicalprocessorcount => '4',
:processorcount => '4',
:memorysize_mb => '32138.66',
:memorysize => '31.39 GB',
:kernel => 'Linux',
:osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:operatingsystemrelease => '14.04',
:operatingsystemmajrelease => '14',
:lsbdistid => 'Ubuntu',
:l3_fqdn_hostname => hostname,
:l3_default_route => '172.16.1.1',
:concat_basedir => '/tmp/',
:l23_os => 'ubuntu',
}.merge override_facts
end
def centos_facts
{
:fqdn => fqdn,
:hostname => hostname,
:physicalprocessorcount => '4',
:processorcount => '4',
:memorysize_mb => '32138.66',
:memorysize => '31.39 GB',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'CentOS',
:operatingsystemrelease => '6.5',
:operatingsystemmajrelease => '6',
:lsbdistid => 'CentOS',
:l3_fqdn_hostname => hostname,
:l3_default_route => '172.16.1.1',
:concat_basedir => '/tmp/',
:l23_os => 'centos6',
}.merge override_facts
end
end
extend Facts
end