puppet_spec_facts 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -5
- data/lib/puppet_spec_facts.rb +7 -2
- data/lib/puppet_spec_facts/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e204471ee4c0cc382e406cb561a6ebad319f804
|
4
|
+
data.tar.gz: c7342c6e4538c7f0c2e65f3db396a193a7b007c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 168d889a3c4b7af8eeafcec4d213bdb51a9abad1499548f658aefbe73a2bf65b65f2c240c61d1d3ccbd71de420e79efb66e187c6e97a5cdf42a4d3a4aee8dedd
|
7
|
+
data.tar.gz: 326176c8bc3b8c21aeb20e35ea8e96f22108d7806e71499c4d79748e60bceb02bc2b52657d8e354581f612787dee26fba4576496d7396fd613d5f9b736456f7f
|
data/README.md
CHANGED
@@ -62,17 +62,22 @@ describe 'example' do
|
|
62
62
|
end
|
63
63
|
```
|
64
64
|
|
65
|
-
In the real world, you probably don't want to iterate through all of the
|
65
|
+
In the real world, you probably don't want to iterate through all of the
|
66
|
+
platforms, so `puppet_spec_facts` allows you to query a subset based on
|
67
|
+
facter facts:
|
66
68
|
|
67
69
|
```ruby
|
68
70
|
require 'spec_helper'
|
69
71
|
|
70
72
|
describe 'example' do
|
71
73
|
context 'all operating systems' do
|
72
|
-
PuppetSpecFacts.facts_for_platform_by_fact(
|
73
|
-
|
74
|
-
|
75
|
-
|
74
|
+
PuppetSpecFacts.facts_for_platform_by_fact(
|
75
|
+
select_facts: {
|
76
|
+
'lsbdistid' => 'CentOS',
|
77
|
+
'architecture' => 'x86_64',
|
78
|
+
'is_pe' => 'true',
|
79
|
+
'fact_style' => 'stringified'
|
80
|
+
}) do |name, facthash|
|
76
81
|
# This loads all fact sets for Puppet Enterprise on x86_64 CentOS with stringified-style facts
|
77
82
|
describe "example class without any parameters on #{name}" do
|
78
83
|
let(:params) {{ }}
|
@@ -84,3 +89,9 @@ describe 'example' do
|
|
84
89
|
end
|
85
90
|
end
|
86
91
|
```
|
92
|
+
|
93
|
+
In many cases, this will provide too many results. You can constrain the
|
94
|
+
results further by using the `select_facts` parameter to indicate the general
|
95
|
+
set, then the `unique_selector` parameter to only return one result for the
|
96
|
+
parameters specified in `unique_selector`. For example, you may wish to only get
|
97
|
+
one result per `operatingsystemrelease` fact, to avoid testing
|
data/lib/puppet_spec_facts.rb
CHANGED
@@ -54,8 +54,13 @@ module PuppetSpecFacts
|
|
54
54
|
}
|
55
55
|
end
|
56
56
|
|
57
|
-
def self.facts_for_platform_by_name(
|
58
|
-
|
57
|
+
def self.facts_for_platform_by_name(platforms)
|
58
|
+
platforms = [platforms] if platforms.is_a?(String)
|
59
|
+
results = {}
|
60
|
+
platforms.each do |name|
|
61
|
+
results[:"#{name}"] = puppet_platforms[name]
|
62
|
+
end
|
63
|
+
results
|
59
64
|
end
|
60
65
|
|
61
66
|
def self.resave_all_facts
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_spec_facts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Dreier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|