puppet 5.5.8 → 5.5.10
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -14
- data/Rakefile +3 -1
- data/ext/solaris/smf/svc-puppetd +8 -1
- data/ext/solaris/smf/svc-puppetmasterd +8 -1
- data/lib/puppet/application/device.rb +45 -29
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/forge.rb +4 -1
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +3 -1
- data/lib/puppet/pops/types/p_timespan_type.rb +2 -2
- data/lib/puppet/pops/types/string_converter.rb +11 -2
- data/lib/puppet/provider/cron/crontab.rb +1 -1
- data/lib/puppet/provider/package/windows/exe_package.rb +13 -0
- data/lib/puppet/provider/package/windows/msi_package.rb +8 -0
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/parsedfile.rb +25 -4
- data/lib/puppet/provider/service/smf.rb +54 -0
- data/lib/puppet/transaction.rb +4 -1
- data/lib/puppet/transaction/event_manager.rb +13 -1
- data/lib/puppet/transaction/resource_harness.rb +3 -1
- data/lib/puppet/util/command_line.rb +2 -3
- data/lib/puppet/util/filetype.rb +36 -4
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/registry.rb +29 -5
- data/lib/puppet/util/windows/service.rb +106 -99
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +97 -69
- data/man/man5/puppet.conf.5 +2 -2
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +2 -2
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +23 -19
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/unit/provider/service/smf/svcs_fmri.out +6 -0
- data/spec/fixtures/unit/provider/service/smf/svcs_multiple_fmris.out +13 -0
- data/spec/integration/ssl/key_spec.rb +0 -4
- data/spec/integration/transaction_spec.rb +1 -1
- data/spec/integration/util/windows/registry_spec.rb +39 -0
- data/spec/unit/application/device_spec.rb +4 -1
- data/spec/unit/application/lookup_spec.rb +10 -9
- data/spec/unit/forge/forge_spec.rb +4 -2
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/pops/loaders/loader_spec.rb +6 -7
- data/spec/unit/pops/types/p_timespan_type_spec.rb +22 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -0
- data/spec/unit/pops/types/string_converter_spec.rb +20 -0
- data/spec/unit/provider/cron/parsed_spec.rb +4 -3
- data/spec/unit/provider/group/ldap_spec.rb +22 -25
- data/spec/unit/provider/group/pw_spec.rb +7 -10
- data/spec/unit/provider/host/parsed_spec.rb +3 -17
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +97 -103
- data/spec/unit/provider/package/aix_spec.rb +5 -8
- data/spec/unit/provider/package/apt_spec.rb +3 -6
- data/spec/unit/provider/package/dnf_spec.rb +29 -31
- data/spec/unit/provider/package/dpkg_spec.rb +18 -21
- data/spec/unit/provider/package/freebsd_spec.rb +4 -7
- data/spec/unit/provider/package/gem_spec.rb +41 -41
- data/spec/unit/provider/package/hpux_spec.rb +7 -10
- data/spec/unit/provider/package/macports_spec.rb +13 -15
- data/spec/unit/provider/package/nim_spec.rb +3 -10
- data/spec/unit/provider/package/openbsd_spec.rb +14 -17
- data/spec/unit/provider/package/pip3_spec.rb +3 -6
- data/spec/unit/provider/package/pip_spec.rb +44 -72
- data/spec/unit/provider/package/pkgin_spec.rb +13 -18
- data/spec/unit/provider/package/pkgng_spec.rb +21 -24
- data/spec/unit/provider/package/puppet_gem_spec.rb +6 -9
- data/spec/unit/provider/package/tdnf_spec.rb +9 -12
- data/spec/unit/provider/package/yum_spec.rb +29 -15
- data/spec/unit/provider/package/zypper_spec.rb +17 -19
- data/spec/unit/provider/service/bsd_spec.rb +8 -12
- data/spec/unit/provider/service/daemontools_spec.rb +12 -20
- data/spec/unit/provider/service/debian_spec.rb +8 -16
- data/spec/unit/provider/service/freebsd_spec.rb +2 -5
- data/spec/unit/provider/service/openbsd_spec.rb +12 -18
- data/spec/unit/provider/service/rcng_spec.rb +3 -7
- data/spec/unit/provider/service/redhat_spec.rb +21 -23
- data/spec/unit/provider/service/runit_spec.rb +9 -19
- data/spec/unit/provider/service/smf_spec.rb +82 -21
- data/spec/unit/provider/service/src_spec.rb +14 -23
- data/spec/unit/provider/user/hpux_spec.rb +2 -5
- data/spec/unit/provider/user/ldap_spec.rb +29 -32
- data/spec/unit/provider/user/pw_spec.rb +10 -13
- data/spec/unit/ssl/key_spec.rb +2 -4
- data/spec/unit/transaction/event_manager_spec.rb +12 -1
- data/spec/unit/transaction/resource_harness_spec.rb +18 -0
- data/spec/unit/transaction_spec.rb +25 -0
- data/spec/unit/util/filetype_spec.rb +13 -5
- data/spec/unit/util/logging_spec.rb +0 -41
- data/spec/unit/util/monkey_patches_spec.rb +18 -5
- data/spec/unit/util/selinux_spec.rb +4 -0
- metadata +6 -2
@@ -1,9 +1,6 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
describe provider_class do
|
3
|
+
describe Puppet::Type.type(:package).provider(:freebsd) do
|
7
4
|
before :each do
|
8
5
|
# Create a mock resource
|
9
6
|
@resource = stub 'resource'
|
@@ -15,16 +12,16 @@ describe provider_class do
|
|
15
12
|
@resource.stubs(:[]).with(:name).returns "mypackage"
|
16
13
|
@resource.stubs(:[]).with(:ensure).returns :installed
|
17
14
|
|
18
|
-
@provider =
|
15
|
+
@provider = subject()
|
19
16
|
@provider.resource = @resource
|
20
17
|
end
|
21
18
|
|
22
19
|
it "should have an install method" do
|
23
|
-
@provider =
|
20
|
+
@provider = subject()
|
24
21
|
expect(@provider).to respond_to(:install)
|
25
22
|
end
|
26
23
|
|
27
|
-
|
24
|
+
context "when installing" do
|
28
25
|
before :each do
|
29
26
|
@resource.stubs(:should).with(:ensure).returns(:installed)
|
30
27
|
end
|
@@ -1,10 +1,7 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
context 'installing myresource' do
|
7
|
-
describe provider_class do
|
3
|
+
context Puppet::Type.type(:package).provider(:gem) do
|
4
|
+
context 'installing myresource' do
|
8
5
|
let(:resource) do
|
9
6
|
Puppet::Type.type(:package).new(
|
10
7
|
:name => 'myresource',
|
@@ -13,7 +10,7 @@ context 'installing myresource' do
|
|
13
10
|
end
|
14
11
|
|
15
12
|
let(:provider) do
|
16
|
-
provider =
|
13
|
+
provider = described_class.new
|
17
14
|
provider.resource = resource
|
18
15
|
provider
|
19
16
|
end
|
@@ -22,9 +19,9 @@ context 'installing myresource' do
|
|
22
19
|
resource.provider = provider
|
23
20
|
end
|
24
21
|
|
25
|
-
|
22
|
+
context "when installing" do
|
26
23
|
it "should use the path to the gem" do
|
27
|
-
|
24
|
+
described_class.stubs(:command).with(:gemcmd).returns "/my/gem"
|
28
25
|
provider.expects(:execute).with { |args| args[0] == "/my/gem" }.returns ""
|
29
26
|
provider.install
|
30
27
|
end
|
@@ -60,42 +57,47 @@ context 'installing myresource' do
|
|
60
57
|
provider.install
|
61
58
|
end
|
62
59
|
|
63
|
-
|
64
|
-
|
60
|
+
context "when a source is specified" do
|
61
|
+
context "as a normal file" do
|
65
62
|
it "should use the file name instead of the gem name" do
|
66
63
|
resource[:source] = "/my/file"
|
67
64
|
provider.expects(:execute).with { |args| args[2] == "/my/file" }.returns ""
|
68
65
|
provider.install
|
69
66
|
end
|
70
67
|
end
|
71
|
-
|
68
|
+
|
69
|
+
context "as a file url" do
|
72
70
|
it "should use the file name instead of the gem name" do
|
73
71
|
resource[:source] = "file:///my/file"
|
74
72
|
provider.expects(:execute).with { |args| args[2] == "/my/file" }.returns ""
|
75
73
|
provider.install
|
76
74
|
end
|
77
75
|
end
|
78
|
-
|
76
|
+
|
77
|
+
context "as a puppet url" do
|
79
78
|
it "should fail" do
|
80
79
|
resource[:source] = "puppet://my/file"
|
81
80
|
expect { provider.install }.to raise_error(Puppet::Error)
|
82
81
|
end
|
83
82
|
end
|
84
|
-
|
83
|
+
|
84
|
+
context "as a non-file and non-puppet url" do
|
85
85
|
it "should treat the source as a gem repository" do
|
86
86
|
resource[:source] = "http://host/my/file"
|
87
87
|
provider.expects(:execute).with { |args| args[2..4] == ["--source", "http://host/my/file", "myresource"] }.returns ""
|
88
88
|
provider.install
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
|
+
context "as a windows path on windows", :if => Puppet.features.microsoft_windows? do
|
92
93
|
it "should treat the source as a local path" do
|
93
94
|
resource[:source] = "c:/this/is/a/path/to/a/gem.gem"
|
94
95
|
provider.expects(:execute).with { |args| args[2] == "c:/this/is/a/path/to/a/gem.gem" }.returns ""
|
95
96
|
provider.install
|
96
97
|
end
|
97
98
|
end
|
98
|
-
|
99
|
+
|
100
|
+
context "with an invalid uri" do
|
99
101
|
it "should fail" do
|
100
102
|
URI.expects(:parse).raises(ArgumentError)
|
101
103
|
resource[:source] = "http:::::uppet:/:/my/file"
|
@@ -105,7 +107,7 @@ context 'installing myresource' do
|
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
108
|
-
|
110
|
+
context "#latest" do
|
109
111
|
it "should return a single value for 'latest'" do
|
110
112
|
#gemlist is used for retrieving both local and remote version numbers, and there are cases
|
111
113
|
# (particularly local) where it makes sense for it to return an array. That doesn't make
|
@@ -131,55 +133,55 @@ context 'installing myresource' do
|
|
131
133
|
end
|
132
134
|
end
|
133
135
|
|
134
|
-
|
136
|
+
context "#instances" do
|
135
137
|
before do
|
136
|
-
|
138
|
+
described_class.stubs(:command).with(:gemcmd).returns "/my/gem"
|
137
139
|
end
|
138
140
|
|
139
141
|
it "should return an empty array when no gems installed" do
|
140
|
-
|
141
|
-
expect(
|
142
|
+
described_class.expects(:execute).with(%w{/my/gem list --local}, {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}}).returns("\n")
|
143
|
+
expect(described_class.instances).to eq([])
|
142
144
|
end
|
143
145
|
|
144
146
|
it "should return ensure values as an array of installed versions" do
|
145
|
-
|
147
|
+
described_class.expects(:execute).with(%w{/my/gem list --local}, {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}}).returns <<-HEREDOC.gsub(/ /, '')
|
146
148
|
systemu (1.2.0)
|
147
149
|
vagrant (0.8.7, 0.6.9)
|
148
150
|
HEREDOC
|
149
151
|
|
150
|
-
expect(
|
152
|
+
expect(described_class.instances.map {|p| p.properties}).to eq([
|
151
153
|
{:ensure => ["1.2.0"], :provider => :gem, :name => 'systemu'},
|
152
154
|
{:ensure => ["0.8.7", "0.6.9"], :provider => :gem, :name => 'vagrant'}
|
153
155
|
])
|
154
156
|
end
|
155
157
|
|
156
158
|
it "should ignore platform specifications" do
|
157
|
-
|
159
|
+
described_class.expects(:execute).with(%w{/my/gem list --local}, {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}}).returns <<-HEREDOC.gsub(/ /, '')
|
158
160
|
systemu (1.2.0)
|
159
161
|
nokogiri (1.6.1 ruby java x86-mingw32 x86-mswin32-60, 1.4.4.1 x86-mswin32)
|
160
162
|
HEREDOC
|
161
163
|
|
162
|
-
expect(
|
164
|
+
expect(described_class.instances.map {|p| p.properties}).to eq([
|
163
165
|
{:ensure => ["1.2.0"], :provider => :gem, :name => 'systemu'},
|
164
166
|
{:ensure => ["1.6.1", "1.4.4.1"], :provider => :gem, :name => 'nokogiri'}
|
165
167
|
])
|
166
168
|
end
|
167
169
|
|
168
170
|
it "should not list 'default: ' text from rubygems''" do
|
169
|
-
|
171
|
+
described_class.expects(:execute).with(%w{/my/gem list --local}, anything).returns <<-HEREDOC.gsub(/ /, '')
|
170
172
|
bundler (1.16.1, default: 1.16.0, 1.15.1)
|
171
173
|
HEREDOC
|
172
174
|
|
173
|
-
expect(
|
175
|
+
expect(described_class.instances.map {|p| p.properties}).to eq([
|
174
176
|
{:name => 'bundler', :ensure => ["1.16.1", "1.16.0", "1.15.1"], :provider => :gem}
|
175
177
|
])
|
176
178
|
end
|
177
179
|
|
178
180
|
it "should not fail when an unmatched line is returned" do
|
179
|
-
|
181
|
+
described_class.expects(:execute).with(%w{/my/gem list --local}, {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}}).
|
180
182
|
returns(File.read(my_fixture('line-with-1.8.5-warning')))
|
181
183
|
|
182
|
-
expect(
|
184
|
+
expect(described_class.instances.map {|p| p.properties}).
|
183
185
|
to eq([{:provider=>:gem, :ensure=>["0.3.2"], :name=>"columnize"},
|
184
186
|
{:provider=>:gem, :ensure=>["1.1.3"], :name=>"diff-lcs"},
|
185
187
|
{:provider=>:gem, :ensure=>["0.0.1"], :name=>"metaclass"},
|
@@ -193,18 +195,18 @@ context 'installing myresource' do
|
|
193
195
|
end
|
194
196
|
end
|
195
197
|
|
196
|
-
|
197
|
-
|
198
|
+
context "listing gems" do
|
199
|
+
context "searching for a single package" do
|
198
200
|
it "searches for an exact match" do
|
199
|
-
|
201
|
+
described_class.expects(:execute).with(includes('\Abundler\z'), {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}}).returns(File.read(my_fixture('gem-list-single-package')))
|
200
202
|
expected = {:name => 'bundler', :ensure => %w[1.6.2], :provider => :gem}
|
201
|
-
expect(
|
203
|
+
expect(described_class.gemlist({:justme => 'bundler'})).to eq(expected)
|
202
204
|
end
|
203
205
|
end
|
204
206
|
end
|
205
207
|
|
206
|
-
|
207
|
-
|
208
|
+
context 'insync?' do
|
209
|
+
context 'for array of versions' do
|
208
210
|
let(:is) { ['1.3.4', '3.6.1', '5.1.2'] }
|
209
211
|
|
210
212
|
it 'returns true for ~> 1.3' do
|
@@ -233,7 +235,7 @@ context 'installing myresource' do
|
|
233
235
|
end
|
234
236
|
end
|
235
237
|
|
236
|
-
|
238
|
+
context 'for string version' do
|
237
239
|
let(:is) { '1.3.4' }
|
238
240
|
|
239
241
|
it 'returns true for ~> 1.3' do
|
@@ -273,10 +275,8 @@ context 'installing myresource' do
|
|
273
275
|
end
|
274
276
|
end
|
275
277
|
end
|
276
|
-
end
|
277
278
|
|
278
|
-
context 'uninstalling myresource' do
|
279
|
-
describe provider_class do
|
279
|
+
context 'uninstalling myresource' do
|
280
280
|
let(:resource) do
|
281
281
|
Puppet::Type.type(:package).new(
|
282
282
|
:name => 'myresource',
|
@@ -285,7 +285,7 @@ context 'uninstalling myresource' do
|
|
285
285
|
end
|
286
286
|
|
287
287
|
let(:provider) do
|
288
|
-
provider =
|
288
|
+
provider = described_class.new
|
289
289
|
provider.resource = resource
|
290
290
|
provider
|
291
291
|
end
|
@@ -294,9 +294,9 @@ context 'uninstalling myresource' do
|
|
294
294
|
resource.provider = provider
|
295
295
|
end
|
296
296
|
|
297
|
-
|
297
|
+
context "when uninstalling" do
|
298
298
|
it "should use the path to the gem" do
|
299
|
-
|
299
|
+
described_class.stubs(:command).with(:gemcmd).returns "/my/gem"
|
300
300
|
provider.expects(:execute).with { |args| args[0] == "/my/gem" }.returns ""
|
301
301
|
provider.uninstall
|
302
302
|
end
|
@@ -1,9 +1,6 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
describe provider_class do
|
3
|
+
describe Puppet::Type.type(:package).provider(:hpux) do
|
7
4
|
before(:each) do
|
8
5
|
# Create a mock resource
|
9
6
|
@resource = stub 'resource'
|
@@ -16,33 +13,33 @@ describe provider_class do
|
|
16
13
|
@resource.stubs(:[]).with(:source).returns "mysource"
|
17
14
|
@resource.stubs(:[]).with(:ensure).returns :installed
|
18
15
|
|
19
|
-
@provider =
|
16
|
+
@provider = subject()
|
20
17
|
@provider.stubs(:resource).returns @resource
|
21
18
|
end
|
22
19
|
|
23
20
|
it "should have an install method" do
|
24
|
-
@provider =
|
21
|
+
@provider = subject()
|
25
22
|
expect(@provider).to respond_to(:install)
|
26
23
|
end
|
27
24
|
|
28
25
|
it "should have an uninstall method" do
|
29
|
-
@provider =
|
26
|
+
@provider = subject()
|
30
27
|
expect(@provider).to respond_to(:uninstall)
|
31
28
|
end
|
32
29
|
|
33
30
|
it "should have a swlist method" do
|
34
|
-
@provider =
|
31
|
+
@provider = subject()
|
35
32
|
expect(@provider).to respond_to(:swlist)
|
36
33
|
end
|
37
34
|
|
38
|
-
|
35
|
+
context "when installing" do
|
39
36
|
it "should use a command-line like 'swinstall -x mount_all_filesystems=false -s SOURCE PACKAGE-NAME'" do
|
40
37
|
@provider.expects(:swinstall).with('-x', 'mount_all_filesystems=false', '-s', 'mysource', 'mypackage')
|
41
38
|
@provider.install
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
45
|
-
|
42
|
+
context "when uninstalling" do
|
46
43
|
it "should use a command-line like 'swremove -x mount_all_filesystems=false PACKAGE-NAME'" do
|
47
44
|
@provider.expects(:swremove).with('-x', 'mount_all_filesystems=false', 'mypackage')
|
48
45
|
@provider.uninstall
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
describe provider_class do
|
3
|
+
describe Puppet::Type.type(:package).provider(:macports) do
|
6
4
|
let :resource_name do
|
7
5
|
"foo"
|
8
6
|
end
|
@@ -21,7 +19,7 @@ describe provider_class do
|
|
21
19
|
{:name => resource_name, :ensure => "1.2.3", :revision => "1", :provider => :macports}
|
22
20
|
end
|
23
21
|
|
24
|
-
|
22
|
+
context "provider features" do
|
25
23
|
subject { provider }
|
26
24
|
|
27
25
|
it { is_expected.to be_installable }
|
@@ -30,30 +28,30 @@ describe provider_class do
|
|
30
28
|
it { is_expected.to be_versionable }
|
31
29
|
end
|
32
30
|
|
33
|
-
|
31
|
+
context "when listing all instances" do
|
34
32
|
it "should call port -q installed" do
|
35
|
-
|
36
|
-
|
33
|
+
described_class.expects(:port).with("-q", :installed).returns("")
|
34
|
+
described_class.instances
|
37
35
|
end
|
38
36
|
|
39
37
|
it "should create instances from active ports" do
|
40
|
-
|
41
|
-
expect(
|
38
|
+
described_class.expects(:port).returns("foo @1.234.5_2 (active)")
|
39
|
+
expect(described_class.instances.size).to eq(1)
|
42
40
|
end
|
43
41
|
|
44
42
|
it "should ignore ports that aren't activated" do
|
45
|
-
|
46
|
-
expect(
|
43
|
+
described_class.expects(:port).returns("foo @1.234.5_2")
|
44
|
+
expect(described_class.instances.size).to eq(0)
|
47
45
|
end
|
48
46
|
|
49
47
|
it "should ignore variants" do
|
50
|
-
expect(
|
48
|
+
expect(described_class.parse_installed_query_line("bar @1.0beta2_38_1+x11+java (active)")).
|
51
49
|
to eq({:provider=>:macports, :revision=>"1", :name=>"bar", :ensure=>"1.0beta2_38"})
|
52
50
|
end
|
53
51
|
|
54
52
|
end
|
55
53
|
|
56
|
-
|
54
|
+
context "when installing" do
|
57
55
|
it "should not specify a version when ensure is set to latest" do
|
58
56
|
resource[:ensure] = :latest
|
59
57
|
provider.expects(:port).with { |flag, method, name, version|
|
@@ -79,7 +77,7 @@ describe provider_class do
|
|
79
77
|
end
|
80
78
|
end
|
81
79
|
|
82
|
-
|
80
|
+
context "when querying for the latest version" do
|
83
81
|
let :new_info_line do
|
84
82
|
"1.2.3 2"
|
85
83
|
end
|
@@ -120,7 +118,7 @@ describe provider_class do
|
|
120
118
|
end
|
121
119
|
end
|
122
120
|
|
123
|
-
|
121
|
+
context "when updating a port" do
|
124
122
|
it "should execute port install if the port is installed" do
|
125
123
|
resource[:name] = resource_name
|
126
124
|
resource[:ensure] = :present
|
@@ -1,10 +1,6 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
describe provider_class do
|
7
|
-
|
3
|
+
describe Puppet::Type.type(:package).provider(:nim) do
|
8
4
|
before(:each) do
|
9
5
|
# Create a mock resource
|
10
6
|
@resource = stub 'resource'
|
@@ -17,12 +13,12 @@ describe provider_class do
|
|
17
13
|
@resource.stubs(:[]).with(:source).returns "mysource"
|
18
14
|
@resource.stubs(:[]).with(:ensure).returns :installed
|
19
15
|
|
20
|
-
@provider =
|
16
|
+
@provider = subject()
|
21
17
|
@provider.resource = @resource
|
22
18
|
end
|
23
19
|
|
24
20
|
it "should have an install method" do
|
25
|
-
@provider =
|
21
|
+
@provider = subject()
|
26
22
|
expect(@provider).to respond_to(:install)
|
27
23
|
end
|
28
24
|
|
@@ -48,7 +44,6 @@ END
|
|
48
44
|
|
49
45
|
context "when installing" do
|
50
46
|
it "should install a package" do
|
51
|
-
|
52
47
|
@resource.stubs(:should).with(:ensure).returns(:installed)
|
53
48
|
Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo'").returns(bff_showres_output)
|
54
49
|
@provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo 1.2.3.8")
|
@@ -56,7 +51,6 @@ END
|
|
56
51
|
end
|
57
52
|
|
58
53
|
context "when installing versioned packages" do
|
59
|
-
|
60
54
|
it "should fail if the package is not available on the lpp source" do
|
61
55
|
nimclient_showres_output = ""
|
62
56
|
|
@@ -131,7 +125,6 @@ OUTPUT
|
|
131
125
|
expect { @provider.install }.to raise_error(Puppet::Error, "NIM package provider is unable to downgrade packages")
|
132
126
|
end
|
133
127
|
|
134
|
-
|
135
128
|
it "should succeed if an RPM package is available on the lpp source" do
|
136
129
|
nimclient_sequence = sequence('nimclient')
|
137
130
|
|
@@ -1,12 +1,9 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
1
|
require 'spec_helper'
|
3
2
|
require 'stringio'
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
describe provider_class do
|
4
|
+
describe Puppet::Type.type(:package).provider(:openbsd) do
|
8
5
|
let(:package) { Puppet::Type.type(:package).new(:name => 'bash', :provider => 'openbsd') }
|
9
|
-
let(:provider) {
|
6
|
+
let(:provider) { described_class.new(package) }
|
10
7
|
|
11
8
|
def expect_read_from_pkgconf(lines)
|
12
9
|
pkgconf = stub(:readlines => lines)
|
@@ -37,7 +34,7 @@ describe provider_class do
|
|
37
34
|
expect(ENV).not_to be_key('PKG_PATH')
|
38
35
|
end
|
39
36
|
|
40
|
-
|
37
|
+
context 'provider features' do
|
41
38
|
it { is_expected.to be_installable }
|
42
39
|
it { is_expected.to be_install_options }
|
43
40
|
it { is_expected.to be_uninstallable }
|
@@ -49,34 +46,34 @@ describe provider_class do
|
|
49
46
|
before :each do
|
50
47
|
# Stub some provider methods to avoid needing the actual software
|
51
48
|
# installed, so we can test on whatever platform we want.
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
described_class.stubs(:command).with(:pkginfo).returns('/bin/pkg_info')
|
50
|
+
described_class.stubs(:command).with(:pkgadd).returns('/bin/pkg_add')
|
51
|
+
described_class.stubs(:command).with(:pkgdelete).returns('/bin/pkg_delete')
|
55
52
|
end
|
56
53
|
|
57
54
|
context "#instances" do
|
58
55
|
it "should return nil if execution failed" do
|
59
|
-
|
60
|
-
expect(
|
56
|
+
described_class.expects(:execpipe).raises(Puppet::ExecutionFailure, 'wawawa')
|
57
|
+
expect(described_class.instances).to be_nil
|
61
58
|
end
|
62
59
|
|
63
60
|
it "should return the empty set if no packages are listed" do
|
64
|
-
|
65
|
-
expect(
|
61
|
+
described_class.expects(:execpipe).with(%w{/bin/pkg_info -a}).yields(StringIO.new(''))
|
62
|
+
expect(described_class.instances).to be_empty
|
66
63
|
end
|
67
64
|
|
68
65
|
it "should return all packages when invoked" do
|
69
66
|
fixture = File.read(my_fixture('pkginfo.list'))
|
70
|
-
|
71
|
-
expect(
|
67
|
+
described_class.expects(:execpipe).with(%w{/bin/pkg_info -a}).yields(fixture)
|
68
|
+
expect(described_class.instances.map(&:name).sort).to eq(
|
72
69
|
%w{bash bzip2 expat gettext libiconv lzo openvpn python vim wget}.sort
|
73
70
|
)
|
74
71
|
end
|
75
72
|
|
76
73
|
it "should return all flavors if set" do
|
77
74
|
fixture = File.read(my_fixture('pkginfo_flavors.list'))
|
78
|
-
|
79
|
-
instances =
|
75
|
+
described_class.expects(:execpipe).with(%w{/bin/pkg_info -a}).yields(fixture)
|
76
|
+
instances = described_class.instances.map {|p| {:name => p.get(:name),
|
80
77
|
:ensure => p.get(:ensure), :flavor => p.get(:flavor)}}
|
81
78
|
expect(instances.size).to eq(2)
|
82
79
|
expect(instances[0]).to eq({:name => 'bash', :ensure => '3.1.17', :flavor => 'static'})
|