rspec-system-puppet 2.1.0 → 2.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.
- data/CHANGELOG.md +9 -0
- data/lib/rspec-system-puppet/helpers.rb +1 -0
- data/lib/rspec-system-puppet/helpers/facter.rb +14 -1
- data/rspec-system-puppet.gemspec +1 -1
- data/spec/fixtures/mymodule/lib/facter/myfact.rb +7 -0
- data/spec/system/00_initial_spec.rb +6 -0
- data/spec/system/facter_spec.rb +8 -0
- data/spec/system/puppet_module_install_spec.rb +0 -8
- metadata +5 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
2.2.0
|
2
|
+
=====
|
3
|
+
|
4
|
+
This feature release provides the ability to pass a :puppet setting to the facter helper, allowing you to return puppet facts when querying. At the moment the setting is false by default.
|
5
|
+
|
6
|
+
#### Detailed Changes
|
7
|
+
|
8
|
+
* Add puppet option to facter helper (Trey Dockendorf)
|
9
|
+
|
1
10
|
2.1.0
|
2
11
|
=====
|
3
12
|
|
@@ -111,6 +111,7 @@ module RSpecSystemPuppet::Helpers
|
|
111
111
|
# Run facter on a remote machine
|
112
112
|
#
|
113
113
|
# @param opts [Hash] a hash of opts
|
114
|
+
# @option opts [Boolean] :puppet true to load Puppet custom facts
|
114
115
|
# @option opts [RSpecSystem::Node] :node node to execute DSL on
|
115
116
|
# @return [RSpecSystemPuppet::Helpers::Facter] helper object
|
116
117
|
# @yield [result] yields result when called as a block
|
@@ -8,12 +8,25 @@ module RSpecSystem::Helpers
|
|
8
8
|
name 'facter'
|
9
9
|
properties :stdout, :stderr, :exit_code, :facts
|
10
10
|
|
11
|
+
def initialize(opts, clr, &block)
|
12
|
+
# Defaults etc.
|
13
|
+
opts = {
|
14
|
+
:puppet => false,
|
15
|
+
}.merge(opts)
|
16
|
+
|
17
|
+
super(opts, clr, &block)
|
18
|
+
end
|
19
|
+
|
11
20
|
# Gathers new results by executing the resource action
|
12
21
|
#
|
13
22
|
# @return [RSpecSystem::Result] raw execution results
|
14
23
|
def execute
|
15
24
|
node = opts[:node]
|
16
|
-
|
25
|
+
|
26
|
+
cmd = "facter --yaml"
|
27
|
+
cmd += " --puppet" if opts[:puppet]
|
28
|
+
|
29
|
+
sh = shell :c => cmd, :n => node
|
17
30
|
|
18
31
|
rd = sh.to_hash
|
19
32
|
rd[:facts] = begin
|
data/rspec-system-puppet.gemspec
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require 'spec_helper_system'
|
2
2
|
|
3
3
|
describe "installation tasks" do
|
4
|
+
let(:test_path) do
|
5
|
+
proj_root + 'spec' + 'fixtures' + 'mymodule'
|
6
|
+
end
|
7
|
+
|
4
8
|
it "check puppet_install works" do
|
5
9
|
puppet_install()
|
6
10
|
end
|
@@ -8,6 +12,8 @@ describe "installation tasks" do
|
|
8
12
|
it 'check puppet_master_install works' do
|
9
13
|
puppet_master_install()
|
10
14
|
|
15
|
+
puppet_module_install(:source => test_path, :module_name => 'mymodule')
|
16
|
+
|
11
17
|
puppet_agent do |r|
|
12
18
|
r.stderr.should == ''
|
13
19
|
r.exit_code.should == 0
|
data/spec/system/facter_spec.rb
CHANGED
@@ -17,6 +17,14 @@ describe "helper facter" do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
it 'puppet option should return valid myfact fact' do
|
21
|
+
facter(:puppet => true) do |r|
|
22
|
+
r.stderr.should be_empty
|
23
|
+
r.facts['myfact'].should =~ /myfact/
|
24
|
+
r.exit_code.should be_zero
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
20
28
|
context 'test as a subject' do
|
21
29
|
context facter do
|
22
30
|
its(:stderr) { should be_empty }
|
@@ -1,15 +1,7 @@
|
|
1
1
|
require 'spec_helper_system'
|
2
2
|
|
3
3
|
describe "helper puppet_module_install" do
|
4
|
-
let(:test_path) do
|
5
|
-
proj_root + 'spec' + 'fixtures' + 'mymodule'
|
6
|
-
end
|
7
|
-
|
8
4
|
it 'should return no errors when including a class' do
|
9
|
-
puppet_module_install(
|
10
|
-
:source => test_path,
|
11
|
-
:module_name => 'mymodule'
|
12
|
-
)
|
13
5
|
pp = <<-EOS.gsub(/^\s{6}/, '')
|
14
6
|
class { 'mymodule':
|
15
7
|
param1 => 'bar',
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-system-puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 2.
|
10
|
+
version: 2.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ken Barber
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-08-
|
18
|
+
date: 2013-08-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec-system
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/rspec-system-puppet/helpers/puppet_module_install.rb
|
61
61
|
- lib/rspec-system-puppet/helpers/puppet_resource.rb
|
62
62
|
- rspec-system-puppet.gemspec
|
63
|
+
- spec/fixtures/mymodule/lib/facter/myfact.rb
|
63
64
|
- spec/fixtures/mymodule/manifests/init.pp
|
64
65
|
- spec/spec_helper.rb
|
65
66
|
- spec/spec_helper_system.rb
|