rspec-puppet-facts 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +7 -0
- data/README.md +120 -0
- data/Vagrantfile +43 -0
- data/facts/1.6/centos-5-i386.facts +66 -0
- data/facts/1.6/centos-5-x86_64.facts +66 -0
- data/facts/1.6/centos-6-i386.facts +59 -0
- data/facts/1.6/centos-6-x86_64.facts +59 -0
- data/facts/1.6/debian-6-i386.facts +64 -0
- data/facts/1.6/debian-6-x86_64.facts +64 -0
- data/facts/1.6/debian-7-i386.facts +65 -0
- data/facts/1.6/debian-7-x86_64.facts +65 -0
- data/facts/1.6/redhat-5-i386.facts +66 -0
- data/facts/1.6/redhat-5-x86_64.facts +66 -0
- data/facts/1.6/redhat-6-i386.facts +59 -0
- data/facts/1.6/redhat-6-x86_64.facts +59 -0
- data/facts/1.7/centos-5-i386.facts +82 -0
- data/facts/1.7/centos-5-x86_64.facts +82 -0
- data/facts/1.7/centos-6-i386.facts +77 -0
- data/facts/1.7/centos-6-x86_64.facts +77 -0
- data/facts/1.7/debian-6-i386.facts +88 -0
- data/facts/1.7/debian-6-x86_64.facts +88 -0
- data/facts/1.7/debian-7-i386.facts +85 -0
- data/facts/1.7/debian-7-x86_64.facts +85 -0
- data/facts/1.7/redhat-5-i386.facts +82 -0
- data/facts/1.7/redhat-5-x86_64.facts +82 -0
- data/facts/1.7/redhat-6-i386.facts +77 -0
- data/facts/1.7/redhat-6-x86_64.facts +77 -0
- data/facts/2.0/centos-5-i386.facts +81 -0
- data/facts/2.0/centos-5-x86_64.facts +81 -0
- data/facts/2.0/centos-6-i386.facts +76 -0
- data/facts/2.0/centos-6-x86_64.facts +76 -0
- data/facts/2.0/debian-6-i386.facts +87 -0
- data/facts/2.0/debian-6-x86_64.facts +87 -0
- data/facts/2.0/debian-7-i386.facts +84 -0
- data/facts/2.0/debian-7-x86_64.facts +84 -0
- data/facts/2.0/redhat-5-i386.facts +81 -0
- data/facts/2.0/redhat-5-x86_64.facts +81 -0
- data/facts/2.0/redhat-6-i386.facts +76 -0
- data/facts/2.0/redhat-6-x86_64.facts +76 -0
- data/facts/2.1/centos-5-i386.facts +82 -0
- data/facts/2.1/centos-5-x86_64.facts +82 -0
- data/facts/2.1/centos-6-i386.facts +77 -0
- data/facts/2.1/centos-6-x86_64.facts +77 -0
- data/facts/2.1/debian-6-i386.facts +88 -0
- data/facts/2.1/debian-6-x86_64.facts +88 -0
- data/facts/2.1/debian-7-i386.facts +85 -0
- data/facts/2.1/debian-7-x86_64.facts +85 -0
- data/facts/2.1/redhat-5-i386.facts +82 -0
- data/facts/2.1/redhat-5-x86_64.facts +82 -0
- data/facts/2.1/redhat-6-i386.facts +77 -0
- data/facts/2.1/redhat-6-x86_64.facts +77 -0
- data/facts/2.2/centos-5-i386.facts +87 -0
- data/facts/2.2/centos-5-x86_64.facts +87 -0
- data/facts/2.2/centos-6-i386.facts +81 -0
- data/facts/2.2/centos-6-x86_64.facts +81 -0
- data/facts/2.2/debian-6-i386.facts +93 -0
- data/facts/2.2/debian-6-x86_64.facts +93 -0
- data/facts/2.2/debian-7-i386.facts +90 -0
- data/facts/2.2/debian-7-x86_64.facts +90 -0
- data/facts/2.2/redhat-5-i386.facts +87 -0
- data/facts/2.2/redhat-5-x86_64.facts +87 -0
- data/facts/2.2/redhat-6-i386.facts +81 -0
- data/facts/2.2/redhat-6-x86_64.facts +81 -0
- data/facts/2.3/centos-5-i386.facts +88 -0
- data/facts/2.3/centos-5-x86_64.facts +88 -0
- data/facts/2.3/centos-6-i386.facts +82 -0
- data/facts/2.3/centos-6-x86_64.facts +82 -0
- data/facts/2.3/debian-6-i386.facts +94 -0
- data/facts/2.3/debian-6-x86_64.facts +94 -0
- data/facts/2.3/debian-7-i386.facts +91 -0
- data/facts/2.3/debian-7-x86_64.facts +91 -0
- data/facts/2.3/redhat-5-i386.facts +88 -0
- data/facts/2.3/redhat-5-x86_64.facts +88 -0
- data/facts/2.3/redhat-6-i386.facts +82 -0
- data/facts/2.3/redhat-6-x86_64.facts +82 -0
- data/get_facts.sh +19 -0
- data/lib/rspec-puppet-facts.rb +81 -0
- data/lib/rspec-puppet-facts/version.rb +5 -0
- data/rspec-puppet-facts.gemspec +21 -0
- metadata +124 -0
data/get_facts.sh
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Fix for squeeze
|
4
|
+
export PATH=$PATH:/var/lib/gems/1.8/bin/
|
5
|
+
|
6
|
+
# Install latest version of facter
|
7
|
+
gem install bundler --no-ri --no-rdoc
|
8
|
+
bundle install --path vendor/bundler
|
9
|
+
operatingsystem=$(bundle exec facter operatingsystem | tr '[:upper:]' '[:lower:]')
|
10
|
+
operatingsystemmajrelease=$(bundle exec facter operatingsystemmajrelease)
|
11
|
+
hardwaremodel=$(bundle exec facter hardwaremodel)
|
12
|
+
|
13
|
+
for version in 1.6.0 1.7.0 2.0.0 2.1.0 2.2.0 2.3.0; do
|
14
|
+
FACTER_GEM_VERSION="~> ${version}" bundle update
|
15
|
+
minor_version=$(echo $version | cut -c1-3)
|
16
|
+
output_dir="/vagrant/facts/${minor_version}"
|
17
|
+
mkdir -p $output_dir
|
18
|
+
FACTER_GEM_VERSION="~> ${version}" bundle exec facter | tee "${output_dir}/${operatingsystem}-${operatingsystemmajrelease}-${hardwaremodel}.facts"
|
19
|
+
done
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'facter'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module RspecPuppetFacts
|
5
|
+
|
6
|
+
def on_supported_os(supported_os = RspecPuppetFacts.meta_supported_os)
|
7
|
+
h = {}
|
8
|
+
supported_os.map do |os_sup|
|
9
|
+
facts = {}
|
10
|
+
# TODO: use SemVer here
|
11
|
+
facter_minor_version = Facter.version[0..2]
|
12
|
+
file = File.expand_path(File.join(File.dirname(__FILE__), "../facts/#{facter_minor_version}/#{os_sup}.facts"))
|
13
|
+
File.read(file).each_line do |line|
|
14
|
+
key, value = line.split(' => ')
|
15
|
+
facts[key.to_sym] = value.chomp unless value.nil?
|
16
|
+
end
|
17
|
+
h[os_sup] = facts
|
18
|
+
end
|
19
|
+
h
|
20
|
+
end
|
21
|
+
|
22
|
+
# @api private
|
23
|
+
def self.meta_supported_os
|
24
|
+
@meta_supported_os ||= get_meta_supported_os
|
25
|
+
end
|
26
|
+
|
27
|
+
# @api private
|
28
|
+
def self.meta_to_facts(input)
|
29
|
+
meta_to_facts = {
|
30
|
+
'RedHat' => 'redhat',
|
31
|
+
'CentOS' => 'centos',
|
32
|
+
'Ubuntu' => 'ubuntu',
|
33
|
+
'OracleLinux' => 'oracle',
|
34
|
+
'SLES' => 'sles',
|
35
|
+
'Scientific' => 'scientific',
|
36
|
+
'Debian' => 'debian',
|
37
|
+
'14.04' => '1404',
|
38
|
+
'12.04' => '1204',
|
39
|
+
'10.04' => '1004',
|
40
|
+
'11 SP1' => '11',
|
41
|
+
}
|
42
|
+
ans = meta_to_facts[input]
|
43
|
+
if ans
|
44
|
+
ans
|
45
|
+
else
|
46
|
+
input
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# @api private
|
51
|
+
def self.get_meta_supported_os
|
52
|
+
metadata = get_metadata
|
53
|
+
if metadata['operatingsystem_support'].nil?
|
54
|
+
fail StandardError, "Unknown operatingsystem support"
|
55
|
+
end
|
56
|
+
os_sup = metadata['operatingsystem_support']
|
57
|
+
|
58
|
+
os_sup.collect do |os_rel|
|
59
|
+
os = meta_to_facts(os_rel['operatingsystem'])
|
60
|
+
os_rel['operatingsystemrelease'].collect do |release|
|
61
|
+
rel = meta_to_facts(release)
|
62
|
+
[
|
63
|
+
"#{os}-#{rel}-i386",
|
64
|
+
"#{os}-#{rel}-x86_64"
|
65
|
+
]
|
66
|
+
end
|
67
|
+
end.flatten
|
68
|
+
end
|
69
|
+
|
70
|
+
# @api private
|
71
|
+
def self.get_metadata
|
72
|
+
if ! File.file?('metadata.json')
|
73
|
+
fail StandardError, "Can't find metadata.json... dunno why"
|
74
|
+
end
|
75
|
+
metadata = JSON.parse(File.read('metadata.json'))
|
76
|
+
if metadata.nil?
|
77
|
+
fail StandardError, "Metadata is empty"
|
78
|
+
end
|
79
|
+
metadata
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
require "rspec-puppet-facts/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rspec-puppet-facts"
|
7
|
+
s.version = RspecPuppetFacts::Version::STRING
|
8
|
+
s.authors = ["Mickaël Canévet"]
|
9
|
+
s.email = ["mickael.canevet@camptocamp.com"]
|
10
|
+
s.homepage = "http://github.com/mcanevet/rspec-puppet-facts"
|
11
|
+
s.summary = "Standard facts fixtures for Puppet"
|
12
|
+
s.description = "Contains facts from many Facter version on many Operating Systems"
|
13
|
+
s.licenses = 'Apache-2.0'
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
|
19
|
+
# Runtime dependencies, but also probably dependencies of requiring projects
|
20
|
+
#s.add_runtime_dependency 'rspec'
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-puppet-facts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mickaël Canévet
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Contains facts from many Facter version on many Operating Systems
|
14
|
+
email:
|
15
|
+
- mickael.canevet@camptocamp.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- README.md
|
23
|
+
- Vagrantfile
|
24
|
+
- facts/1.6/centos-5-i386.facts
|
25
|
+
- facts/1.6/centos-5-x86_64.facts
|
26
|
+
- facts/1.6/centos-6-i386.facts
|
27
|
+
- facts/1.6/centos-6-x86_64.facts
|
28
|
+
- facts/1.6/debian-6-i386.facts
|
29
|
+
- facts/1.6/debian-6-x86_64.facts
|
30
|
+
- facts/1.6/debian-7-i386.facts
|
31
|
+
- facts/1.6/debian-7-x86_64.facts
|
32
|
+
- facts/1.6/redhat-5-i386.facts
|
33
|
+
- facts/1.6/redhat-5-x86_64.facts
|
34
|
+
- facts/1.6/redhat-6-i386.facts
|
35
|
+
- facts/1.6/redhat-6-x86_64.facts
|
36
|
+
- facts/1.7/centos-5-i386.facts
|
37
|
+
- facts/1.7/centos-5-x86_64.facts
|
38
|
+
- facts/1.7/centos-6-i386.facts
|
39
|
+
- facts/1.7/centos-6-x86_64.facts
|
40
|
+
- facts/1.7/debian-6-i386.facts
|
41
|
+
- facts/1.7/debian-6-x86_64.facts
|
42
|
+
- facts/1.7/debian-7-i386.facts
|
43
|
+
- facts/1.7/debian-7-x86_64.facts
|
44
|
+
- facts/1.7/redhat-5-i386.facts
|
45
|
+
- facts/1.7/redhat-5-x86_64.facts
|
46
|
+
- facts/1.7/redhat-6-i386.facts
|
47
|
+
- facts/1.7/redhat-6-x86_64.facts
|
48
|
+
- facts/2.0/centos-5-i386.facts
|
49
|
+
- facts/2.0/centos-5-x86_64.facts
|
50
|
+
- facts/2.0/centos-6-i386.facts
|
51
|
+
- facts/2.0/centos-6-x86_64.facts
|
52
|
+
- facts/2.0/debian-6-i386.facts
|
53
|
+
- facts/2.0/debian-6-x86_64.facts
|
54
|
+
- facts/2.0/debian-7-i386.facts
|
55
|
+
- facts/2.0/debian-7-x86_64.facts
|
56
|
+
- facts/2.0/redhat-5-i386.facts
|
57
|
+
- facts/2.0/redhat-5-x86_64.facts
|
58
|
+
- facts/2.0/redhat-6-i386.facts
|
59
|
+
- facts/2.0/redhat-6-x86_64.facts
|
60
|
+
- facts/2.1/centos-5-i386.facts
|
61
|
+
- facts/2.1/centos-5-x86_64.facts
|
62
|
+
- facts/2.1/centos-6-i386.facts
|
63
|
+
- facts/2.1/centos-6-x86_64.facts
|
64
|
+
- facts/2.1/debian-6-i386.facts
|
65
|
+
- facts/2.1/debian-6-x86_64.facts
|
66
|
+
- facts/2.1/debian-7-i386.facts
|
67
|
+
- facts/2.1/debian-7-x86_64.facts
|
68
|
+
- facts/2.1/redhat-5-i386.facts
|
69
|
+
- facts/2.1/redhat-5-x86_64.facts
|
70
|
+
- facts/2.1/redhat-6-i386.facts
|
71
|
+
- facts/2.1/redhat-6-x86_64.facts
|
72
|
+
- facts/2.2/centos-5-i386.facts
|
73
|
+
- facts/2.2/centos-5-x86_64.facts
|
74
|
+
- facts/2.2/centos-6-i386.facts
|
75
|
+
- facts/2.2/centos-6-x86_64.facts
|
76
|
+
- facts/2.2/debian-6-i386.facts
|
77
|
+
- facts/2.2/debian-6-x86_64.facts
|
78
|
+
- facts/2.2/debian-7-i386.facts
|
79
|
+
- facts/2.2/debian-7-x86_64.facts
|
80
|
+
- facts/2.2/redhat-5-i386.facts
|
81
|
+
- facts/2.2/redhat-5-x86_64.facts
|
82
|
+
- facts/2.2/redhat-6-i386.facts
|
83
|
+
- facts/2.2/redhat-6-x86_64.facts
|
84
|
+
- facts/2.3/centos-5-i386.facts
|
85
|
+
- facts/2.3/centos-5-x86_64.facts
|
86
|
+
- facts/2.3/centos-6-i386.facts
|
87
|
+
- facts/2.3/centos-6-x86_64.facts
|
88
|
+
- facts/2.3/debian-6-i386.facts
|
89
|
+
- facts/2.3/debian-6-x86_64.facts
|
90
|
+
- facts/2.3/debian-7-i386.facts
|
91
|
+
- facts/2.3/debian-7-x86_64.facts
|
92
|
+
- facts/2.3/redhat-5-i386.facts
|
93
|
+
- facts/2.3/redhat-5-x86_64.facts
|
94
|
+
- facts/2.3/redhat-6-i386.facts
|
95
|
+
- facts/2.3/redhat-6-x86_64.facts
|
96
|
+
- get_facts.sh
|
97
|
+
- lib/rspec-puppet-facts.rb
|
98
|
+
- lib/rspec-puppet-facts/version.rb
|
99
|
+
- rspec-puppet-facts.gemspec
|
100
|
+
homepage: http://github.com/mcanevet/rspec-puppet-facts
|
101
|
+
licenses:
|
102
|
+
- Apache-2.0
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.2.2
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: Standard facts fixtures for Puppet
|
124
|
+
test_files: []
|