puppet 6.0.4-x86-mingw32 → 6.0.5-x86-mingw32

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.

Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +15 -15
  3. data/Rakefile +3 -1
  4. data/ext/solaris/smf/svc-puppetd +8 -1
  5. data/ext/solaris/smf/svc-puppetmasterd +8 -1
  6. data/lib/puppet/application/device.rb +48 -32
  7. data/lib/puppet/application/ssl.rb +31 -17
  8. data/lib/puppet/defaults.rb +2 -1
  9. data/lib/puppet/face/config.rb +1 -1
  10. data/lib/puppet/forge.rb +4 -1
  11. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +3 -1
  12. data/lib/puppet/pops/model/pn_transformer.rb +5 -0
  13. data/lib/puppet/pops/types/p_timespan_type.rb +2 -2
  14. data/lib/puppet/pops/types/string_converter.rb +11 -2
  15. data/lib/puppet/provider/package/dnf.rb +2 -1
  16. data/lib/puppet/provider/package/windows/exe_package.rb +13 -0
  17. data/lib/puppet/provider/package/windows/msi_package.rb +8 -0
  18. data/lib/puppet/provider/package/windows/package.rb +9 -1
  19. data/lib/puppet/provider/package/yum.rb +1 -1
  20. data/lib/puppet/provider/parsedfile.rb +25 -4
  21. data/lib/puppet/provider/service/smf.rb +54 -0
  22. data/lib/puppet/provider/service/systemd.rb +2 -0
  23. data/lib/puppet/provider/service/upstart.rb +1 -0
  24. data/lib/puppet/rest/route.rb +1 -1
  25. data/lib/puppet/ssl/host.rb +23 -11
  26. data/lib/puppet/transaction.rb +4 -1
  27. data/lib/puppet/transaction/event_manager.rb +13 -1
  28. data/lib/puppet/transaction/resource_harness.rb +3 -1
  29. data/lib/puppet/util/command_line.rb +2 -3
  30. data/lib/puppet/util/filetype.rb +36 -4
  31. data/lib/puppet/util/selinux.rb +1 -1
  32. data/lib/puppet/util/windows/api_types.rb +1 -1
  33. data/lib/puppet/util/windows/registry.rb +29 -5
  34. data/lib/puppet/util/windows/service.rb +106 -99
  35. data/lib/puppet/version.rb +1 -1
  36. data/locales/ja/puppet.po +232 -183
  37. data/locales/puppet.pot +145 -117
  38. data/man/man5/puppet.conf.5 +3 -3
  39. data/man/man8/puppet-agent.8 +1 -1
  40. data/man/man8/puppet-apply.8 +1 -1
  41. data/man/man8/puppet-catalog.8 +1 -1
  42. data/man/man8/puppet-config.8 +2 -2
  43. data/man/man8/puppet-describe.8 +1 -1
  44. data/man/man8/puppet-device.8 +23 -19
  45. data/man/man8/puppet-doc.8 +1 -1
  46. data/man/man8/puppet-epp.8 +1 -1
  47. data/man/man8/puppet-facts.8 +1 -1
  48. data/man/man8/puppet-filebucket.8 +1 -1
  49. data/man/man8/puppet-generate.8 +1 -1
  50. data/man/man8/puppet-help.8 +1 -1
  51. data/man/man8/puppet-key.8 +1 -1
  52. data/man/man8/puppet-lookup.8 +1 -1
  53. data/man/man8/puppet-man.8 +1 -1
  54. data/man/man8/puppet-module.8 +1 -1
  55. data/man/man8/puppet-node.8 +1 -1
  56. data/man/man8/puppet-parser.8 +1 -1
  57. data/man/man8/puppet-plugin.8 +1 -1
  58. data/man/man8/puppet-report.8 +1 -1
  59. data/man/man8/puppet-resource.8 +1 -1
  60. data/man/man8/puppet-script.8 +1 -1
  61. data/man/man8/puppet-ssl.8 +6 -3
  62. data/man/man8/puppet-status.8 +1 -1
  63. data/man/man8/puppet.8 +2 -2
  64. data/spec/fixtures/unit/provider/service/smf/svcs_fmri.out +6 -0
  65. data/spec/fixtures/unit/provider/service/smf/svcs_multiple_fmris.out +13 -0
  66. data/spec/integration/ssl/key_spec.rb +0 -4
  67. data/spec/integration/transaction_spec.rb +559 -0
  68. data/spec/integration/util/windows/registry_spec.rb +39 -0
  69. data/spec/unit/application/device_spec.rb +10 -7
  70. data/spec/unit/application/lookup_spec.rb +2 -1
  71. data/spec/unit/application/ssl_spec.rb +21 -2
  72. data/spec/unit/forge/forge_spec.rb +4 -2
  73. data/spec/unit/functions/logging_spec.rb +10 -3
  74. data/spec/unit/indirector/yaml_spec.rb +1 -1
  75. data/spec/unit/pops/loaders/loader_spec.rb +6 -7
  76. data/spec/unit/pops/model/pn_transformer_spec.rb +4 -0
  77. data/spec/unit/pops/types/p_timespan_type_spec.rb +22 -0
  78. data/spec/unit/pops/types/p_timestamp_type_spec.rb +19 -0
  79. data/spec/unit/pops/types/string_converter_spec.rb +20 -0
  80. data/spec/unit/provider/group/ldap_spec.rb +22 -25
  81. data/spec/unit/provider/group/pw_spec.rb +7 -10
  82. data/spec/unit/provider/nameservice/directoryservice_spec.rb +97 -103
  83. data/spec/unit/provider/package/aix_spec.rb +5 -8
  84. data/spec/unit/provider/package/apt_spec.rb +3 -6
  85. data/spec/unit/provider/package/dnf_spec.rb +36 -37
  86. data/spec/unit/provider/package/dpkg_spec.rb +18 -21
  87. data/spec/unit/provider/package/freebsd_spec.rb +4 -7
  88. data/spec/unit/provider/package/gem_spec.rb +41 -41
  89. data/spec/unit/provider/package/hpux_spec.rb +7 -10
  90. data/spec/unit/provider/package/macports_spec.rb +13 -15
  91. data/spec/unit/provider/package/nim_spec.rb +3 -10
  92. data/spec/unit/provider/package/openbsd_spec.rb +14 -17
  93. data/spec/unit/provider/package/pip3_spec.rb +3 -6
  94. data/spec/unit/provider/package/pip_spec.rb +45 -49
  95. data/spec/unit/provider/package/pkgin_spec.rb +13 -18
  96. data/spec/unit/provider/package/pkgng_spec.rb +21 -24
  97. data/spec/unit/provider/package/puppet_gem_spec.rb +6 -9
  98. data/spec/unit/provider/package/tdnf_spec.rb +9 -12
  99. data/spec/unit/provider/package/yum_spec.rb +30 -16
  100. data/spec/unit/provider/package/zypper_spec.rb +17 -19
  101. data/spec/unit/provider/service/bsd_spec.rb +7 -9
  102. data/spec/unit/provider/service/daemontools_spec.rb +12 -16
  103. data/spec/unit/provider/service/debian_spec.rb +6 -10
  104. data/spec/unit/provider/service/freebsd_spec.rb +2 -2
  105. data/spec/unit/provider/service/openbsd_spec.rb +13 -17
  106. data/spec/unit/provider/service/rcng_spec.rb +2 -4
  107. data/spec/unit/provider/service/redhat_spec.rb +12 -11
  108. data/spec/unit/provider/service/runit_spec.rb +7 -14
  109. data/spec/unit/provider/service/smf_spec.rb +77 -13
  110. data/spec/unit/provider/service/src_spec.rb +11 -16
  111. data/spec/unit/provider/service/systemd_spec.rb +18 -0
  112. data/spec/unit/provider/user/hpux_spec.rb +3 -5
  113. data/spec/unit/provider/user/ldap_spec.rb +29 -32
  114. data/spec/unit/provider/user/pw_spec.rb +10 -13
  115. data/spec/unit/rest/route_spec.rb +1 -1
  116. data/spec/unit/ssl/host_spec.rb +21 -0
  117. data/spec/unit/ssl/key_spec.rb +2 -4
  118. data/spec/unit/transaction/event_manager_spec.rb +12 -1
  119. data/spec/unit/transaction/resource_harness_spec.rb +18 -0
  120. data/spec/unit/transaction_spec.rb +25 -0
  121. data/spec/unit/util/filetype_spec.rb +13 -5
  122. data/spec/unit/util/logging_spec.rb +0 -41
  123. data/spec/unit/util/monkey_patches_spec.rb +18 -5
  124. data/spec/unit/util/selinux_spec.rb +4 -0
  125. metadata +8 -2
@@ -1,9 +1,6 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
 
4
- provider_class = Puppet::Type.type(:package).provider(:pip3)
5
-
6
- describe provider_class do
3
+ describe Puppet::Type.type(:package).provider(:pip3) do
7
4
 
8
5
  it { is_expected.to be_installable }
9
6
  it { is_expected.to be_uninstallable }
@@ -12,11 +9,11 @@ describe provider_class do
12
9
  it { is_expected.to be_install_options }
13
10
 
14
11
  it "should inherit most things from pip provider" do
15
- expect(provider_class < Puppet::Type.type(:package).provider(:pip))
12
+ expect(described_class < Puppet::Type.type(:package).provider(:pip))
16
13
  end
17
14
 
18
15
  it "should use pip3 command" do
19
- expect(provider_class.cmd).to eq(["pip3"])
16
+ expect(described_class.cmd).to eq(["pip3"])
20
17
  end
21
18
 
22
19
  end
@@ -1,21 +1,19 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
 
4
- provider_class = Puppet::Type.type(:package).provider(:pip)
5
3
  osfamilies = { 'windows' => ['pip.exe'], 'other' => ['pip', 'pip-python'] }
6
4
 
7
- describe provider_class do
8
- before do
5
+ describe Puppet::Type.type(:package).provider(:pip) do
6
+ before do
9
7
  @resource = Puppet::Resource.new(:package, "fake_package")
10
- @provider = provider_class.new(@resource)
8
+ @provider = described_class.new(@resource)
11
9
  @client = stub_everything('client')
12
10
  @client.stubs(:call).with('package_releases', 'real_package').returns(["1.3", "1.2.5", "1.2.4"])
13
11
  @client.stubs(:call).with('package_releases', 'fake_package').returns([])
14
12
  end
15
13
 
16
- describe "parse" do
14
+ context "parse" do
17
15
  it "should return a hash on valid input" do
18
- expect(provider_class.parse("real_package==1.2.5")).to eq({
16
+ expect(described_class.parse("real_package==1.2.5")).to eq({
19
17
  :ensure => "1.2.5",
20
18
  :name => "real_package",
21
19
  :provider => :pip,
@@ -23,43 +21,43 @@ describe provider_class do
23
21
  end
24
22
 
25
23
  it "should return nil on invalid input" do
26
- expect(provider_class.parse("foo")).to eq(nil)
24
+ expect(described_class.parse("foo")).to eq(nil)
27
25
  end
28
26
  end
29
27
 
30
- describe "cmd" do
28
+ context "cmd" do
31
29
  it "should return 'pip.exe' by default on Windows systems" do
32
30
  Puppet::Util::Platform.stubs(:windows?).returns true
33
- expect(provider_class.cmd[0]).to eq('pip.exe')
31
+ expect(described_class.cmd[0]).to eq('pip.exe')
34
32
  end
35
33
 
36
34
  it "could return pip-python on legacy redhat systems which rename pip" do
37
35
  Puppet::Util::Platform.stubs(:windows?).returns false
38
- expect(provider_class.cmd[1]).to eq('pip-python')
36
+ expect(described_class.cmd[1]).to eq('pip-python')
39
37
  end
40
38
 
41
39
  it "should return pip by default on other systems" do
42
40
  Puppet::Util::Platform.stubs(:windows?).returns false
43
- expect(provider_class.cmd[0]).to eq('pip')
41
+ expect(described_class.cmd[0]).to eq('pip')
44
42
  end
45
43
  end
46
44
 
47
- describe "instances" do
45
+ context "instances" do
48
46
  osfamilies.each do |osfamily, pip_cmds|
49
47
  it "should return an array on #{osfamily} systems when #{pip_cmds.join(' or ')} is present" do
50
48
  Puppet::Util::Platform.stubs(:windows?).returns (osfamily == 'windows')
51
49
  pip_cmds.each do |pip_cmd|
52
50
  pip_cmds.each do |cmd|
53
51
  unless cmd == pip_cmd
54
- provider_class.expects(:which).with(cmd).returns(nil)
52
+ described_class.expects(:which).with(cmd).returns(nil)
55
53
  end
56
54
  end
57
- provider_class.stubs(:pip_version).returns('8.0.1')
58
- provider_class.expects(:which).with(pip_cmd).returns("/fake/bin/#{pip_cmd}")
55
+ described_class.stubs(:pip_version).returns('8.0.1')
56
+ described_class.expects(:which).with(pip_cmd).returns("/fake/bin/#{pip_cmd}")
59
57
  p = stub("process")
60
58
  p.expects(:collect).yields("real_package==1.2.5")
61
- provider_class.expects(:execpipe).with(["/fake/bin/#{pip_cmd}", "freeze"]).yields(p)
62
- provider_class.instances
59
+ described_class.expects(:execpipe).with(["/fake/bin/#{pip_cmd}", "freeze"]).yields(p)
60
+ described_class.instances
63
61
  end
64
62
  end
65
63
 
@@ -68,12 +66,12 @@ describe provider_class do
68
66
  versions.each do |version|
69
67
  it "should use the --all option when version is '#{version}'" do
70
68
  Puppet::Util::Platform.stubs(:windows?).returns (osfamily == 'windows')
71
- provider_class.stubs(:pip_cmd).returns('/fake/bin/pip')
72
- provider_class.stubs(:pip_version).returns(version)
69
+ described_class.stubs(:pip_cmd).returns('/fake/bin/pip')
70
+ described_class.stubs(:pip_version).returns(version)
73
71
  p = stub("process")
74
72
  p.expects(:collect).yields("real_package==1.2.5")
75
- provider_class.expects(:execpipe).with(["/fake/bin/pip", "freeze", "--all"]).yields(p)
76
- provider_class.instances
73
+ described_class.expects(:execpipe).with(["/fake/bin/pip", "freeze", "--all"]).yields(p)
74
+ described_class.instances
77
75
  end
78
76
  end
79
77
  end
@@ -81,20 +79,20 @@ describe provider_class do
81
79
  it "should return an empty array on #{osfamily} systems when #{pip_cmds.join(' and ')} are missing" do
82
80
  Puppet::Util::Platform.stubs(:windows?).returns (osfamily == 'windows')
83
81
  pip_cmds.each do |cmd|
84
- provider_class.expects(:which).with(cmd).returns nil
82
+ described_class.expects(:which).with(cmd).returns nil
85
83
  end
86
- expect(provider_class.instances).to eq([])
84
+ expect(described_class.instances).to eq([])
87
85
  end
88
86
  end
89
87
  end
90
88
 
91
- describe "query" do
89
+ context "query" do
92
90
  before do
93
91
  @resource[:name] = "real_package"
94
92
  end
95
93
 
96
94
  it "should return a hash when pip and the package are present" do
97
- provider_class.expects(:instances).returns [provider_class.new({
95
+ described_class.expects(:instances).returns [described_class.new({
98
96
  :ensure => "1.2.5",
99
97
  :name => "real_package",
100
98
  :provider => :pip,
@@ -108,14 +106,14 @@ describe provider_class do
108
106
  end
109
107
 
110
108
  it "should return nil when the package is missing" do
111
- provider_class.expects(:instances).returns []
109
+ described_class.expects(:instances).returns []
112
110
  expect(@provider.query).to eq(nil)
113
111
  end
114
112
 
115
113
  it "should be case insensitive" do
116
114
  @resource[:name] = "Real_Package"
117
115
 
118
- provider_class.expects(:instances).returns [provider_class.new({
116
+ described_class.expects(:instances).returns [described_class.new({
119
117
  :ensure => "1.2.5",
120
118
  :name => "real_package",
121
119
  :provider => :pip,
@@ -127,16 +125,15 @@ describe provider_class do
127
125
  :provider => :pip,
128
126
  })
129
127
  end
130
-
131
128
  end
132
129
 
133
- describe "latest" do
130
+ context "latest" do
134
131
  context "with pip version < 1.5.4" do
135
132
  before :each do
136
- provider_class.stubs(:pip_version).returns('1.0.1')
137
- provider_class.stubs(:which).with('pip').returns("/fake/bin/pip")
138
- provider_class.stubs(:which).with('pip-python').returns("/fake/bin/pip")
139
- provider_class.stubs(:which).with('pip.exe').returns("/fake/bin/pip")
133
+ described_class.stubs(:pip_version).returns('1.0.1')
134
+ described_class.stubs(:which).with('pip').returns("/fake/bin/pip")
135
+ described_class.stubs(:which).with('pip-python').returns("/fake/bin/pip")
136
+ described_class.stubs(:which).with('pip.exe').returns("/fake/bin/pip")
140
137
  end
141
138
 
142
139
  it "should find a version number for new_pip_package" do
@@ -188,12 +185,11 @@ describe provider_class do
188
185
  context "with pip version >= 1.5.4" do
189
186
  # For Pip 1.5.4 and above, you can get a version list from CLI - which allows for native pip behavior
190
187
  # with regards to custom repositories, proxies and the like
191
-
192
188
  before :each do
193
- provider_class.stubs(:pip_version).returns('1.5.4')
194
- provider_class.stubs(:which).with('pip').returns("/fake/bin/pip")
195
- provider_class.stubs(:which).with('pip-python').returns("/fake/bin/pip")
196
- provider_class.stubs(:which).with('pip.exe').returns("/fake/bin/pip")
189
+ described_class.stubs(:pip_version).returns('1.5.4')
190
+ described_class.stubs(:which).with('pip').returns("/fake/bin/pip")
191
+ described_class.stubs(:which).with('pip-python').returns("/fake/bin/pip")
192
+ described_class.stubs(:which).with('pip.exe').returns("/fake/bin/pip")
197
193
  end
198
194
 
199
195
  it "should find a version number for real_package" do
@@ -239,7 +235,7 @@ describe provider_class do
239
235
  end
240
236
  end
241
237
 
242
- describe "install" do
238
+ context "install" do
243
239
  before do
244
240
  @resource[:name] = "fake_package"
245
241
  @url = "git+https://example.com/fake_package.git"
@@ -304,7 +300,7 @@ describe provider_class do
304
300
  end
305
301
  end
306
302
 
307
- describe "uninstall" do
303
+ context "uninstall" do
308
304
  it "should uninstall" do
309
305
  @resource[:name] = "fake_package"
310
306
  @provider.expects(:lazy_pip).
@@ -313,29 +309,29 @@ describe provider_class do
313
309
  end
314
310
  end
315
311
 
316
- describe "update" do
312
+ context "update" do
317
313
  it "should just call install" do
318
314
  @provider.expects(:install).returns(nil)
319
315
  @provider.update
320
316
  end
321
317
  end
322
318
 
323
- describe "pip_version" do
319
+ context "pip_version" do
324
320
  it "should return nil on missing pip" do
325
- provider_class.stubs(:pip_cmd).returns(nil)
326
- expect(provider_class.pip_version).to eq(nil)
321
+ described_class.stubs(:pip_cmd).returns(nil)
322
+ expect(described_class.pip_version).to eq(nil)
327
323
  end
328
324
 
329
325
  it "should look up version if pip is present" do
330
- provider_class.stubs(:pip_cmd).returns('/fake/bin/pip')
326
+ described_class.stubs(:pip_cmd).returns('/fake/bin/pip')
331
327
  p = stub("process")
332
328
  p.expects(:collect).yields('pip 8.0.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)')
333
- provider_class.expects(:execpipe).with(['/fake/bin/pip', '--version']).yields(p)
334
- expect(provider_class.pip_version).to eq('8.0.2')
329
+ described_class.expects(:execpipe).with(['/fake/bin/pip', '--version']).yields(p)
330
+ expect(described_class.pip_version).to eq('8.0.2')
335
331
  end
336
332
  end
337
333
 
338
- describe "lazy_pip" do
334
+ context "lazy_pip" do
339
335
  after(:each) do
340
336
  Puppet::Type::Package::ProviderPip.instance_variable_set(:@confine_collection, nil)
341
337
  end
@@ -1,19 +1,16 @@
1
1
  require "spec_helper"
2
2
 
3
- provider_class = Puppet::Type.type(:package).provider(:pkgin)
4
-
5
- describe provider_class do
3
+ describe Puppet::Type.type(:package).provider(:pkgin) do
6
4
  let(:resource) { Puppet::Type.type(:package).new(:name => "vim", :provider => :pkgin) }
7
5
  subject { resource.provider }
8
6
 
9
7
  describe "Puppet provider interface" do
10
8
  it "can return the list of all packages" do
11
- expect(provider_class).to respond_to(:instances)
9
+ expect(described_class).to respond_to(:instances)
12
10
  end
13
11
  end
14
12
 
15
13
  describe "#install" do
16
-
17
14
  describe "a package not installed" do
18
15
  before { resource[:ensure] = :absent }
19
16
  it "uses pkgin install to install" do
@@ -29,7 +26,6 @@ describe provider_class do
29
26
  subject.install
30
27
  end
31
28
  end
32
-
33
29
  end
34
30
 
35
31
  describe "#uninstall" do
@@ -45,19 +41,19 @@ describe provider_class do
45
41
  end
46
42
 
47
43
  before do
48
- provider_class.stubs(:pkgin).with(:list).returns(pkgin_ls_output)
44
+ described_class.stubs(:pkgin).with(:list).returns(pkgin_ls_output)
49
45
  end
50
46
 
51
47
  it "returns an array of providers for each package" do
52
- instances = provider_class.instances
48
+ instances = described_class.instances
53
49
  expect(instances).to have(2).items
54
50
  instances.each do |instance|
55
- expect(instance).to be_a(provider_class)
51
+ expect(instance).to be_a(described_class)
56
52
  end
57
53
  end
58
54
 
59
55
  it "populates each provider with an installed package" do
60
- zlib_provider, zziplib_provider = provider_class.instances
56
+ zlib_provider, zziplib_provider = described_class.instances
61
57
  expect(zlib_provider.get(:name)).to eq("zlib")
62
58
  expect(zlib_provider.get(:ensure)).to eq("1.2.3")
63
59
  expect(zziplib_provider.get(:name)).to eq("zziplib")
@@ -67,7 +63,7 @@ describe provider_class do
67
63
 
68
64
  describe "#latest" do
69
65
  before do
70
- provider_class.stubs(:pkgin).with(:search, "vim").returns(pkgin_search_output)
66
+ described_class.stubs(:pkgin).with(:search, "vim").returns(pkgin_search_output)
71
67
  end
72
68
 
73
69
  context "when the package is installed" do
@@ -119,7 +115,7 @@ SEARCH
119
115
  end
120
116
 
121
117
  it "returns the newest available version" do
122
- provider_class.stubs(:pkgin).with(:search, "vim").returns(pkgin_search_output)
118
+ described_class.stubs(:pkgin).with(:search, "vim").returns(pkgin_search_output)
123
119
  expect(subject.latest).to eq("7.3")
124
120
  end
125
121
  end
@@ -140,7 +136,7 @@ SEARCH
140
136
  let(:package) { "vim-7.2.446;=;Vim editor (vi clone) without GUI" }
141
137
 
142
138
  it "extracts the name and status" do
143
- expect(provider_class.parse_pkgin_line(package)).to eq({ :name => "vim" ,
139
+ expect(described_class.parse_pkgin_line(package)).to eq({ :name => "vim" ,
144
140
  :status => "=" ,
145
141
  :ensure => "7.2.446" })
146
142
  end
@@ -150,7 +146,7 @@ SEARCH
150
146
  let(:package) { "ruby18-puppet-0.25.5nb1;>;Configuration management framework written in Ruby" }
151
147
 
152
148
  it "extracts the name and status" do
153
- expect(provider_class.parse_pkgin_line(package)).to eq({ :name => "ruby18-puppet",
149
+ expect(described_class.parse_pkgin_line(package)).to eq({ :name => "ruby18-puppet",
154
150
  :status => ">" ,
155
151
  :ensure => "0.25.5nb1" })
156
152
  end
@@ -160,7 +156,7 @@ SEARCH
160
156
  let(:package) { "ruby200-facter-2.4.3nb1;=;Cross-platform Ruby library for retrieving facts from OS" }
161
157
 
162
158
  it "extracts the name and status" do
163
- expect(provider_class.parse_pkgin_line(package)).to eq({ :name => "ruby200-facter",
159
+ expect(described_class.parse_pkgin_line(package)).to eq({ :name => "ruby200-facter",
164
160
  :status => "=" ,
165
161
  :ensure => "2.4.3nb1" })
166
162
  end
@@ -170,18 +166,17 @@ SEARCH
170
166
  let(:package) { "vim-7.2.446;Vim editor (vi clone) without GUI" }
171
167
 
172
168
  it "extracts the name and status" do
173
- expect(provider_class.parse_pkgin_line(package)).to eq({ :name => "vim" ,
169
+ expect(described_class.parse_pkgin_line(package)).to eq({ :name => "vim" ,
174
170
  :status => nil ,
175
171
  :ensure => "7.2.446" })
176
172
  end
177
-
178
173
  end
179
174
 
180
175
  context "with an invalid package" do
181
176
  let(:package) { "" }
182
177
 
183
178
  it "returns nil" do
184
- expect(provider_class.parse_pkgin_line(package)).to be_nil
179
+ expect(described_class.parse_pkgin_line(package)).to be_nil
185
180
  end
186
181
  end
187
182
  end
@@ -1,10 +1,7 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
  require 'puppet/provider/package/pkgng'
4
3
 
5
- provider_class = Puppet::Type.type(:package).provider(:pkgng)
6
-
7
- describe provider_class do
4
+ describe Puppet::Type.type(:package).provider(:pkgng) do
8
5
  let(:name) { 'bash' }
9
6
  let(:installed_name) { 'zsh' }
10
7
  let(:pkgng) { 'pkgng' }
@@ -38,41 +35,41 @@ describe provider_class do
38
35
  end
39
36
 
40
37
  before do
41
- provider_class.stubs(:command).with(:pkg) { '/usr/local/sbin/pkg' }
38
+ described_class.stubs(:command).with(:pkg) { '/usr/local/sbin/pkg' }
42
39
 
43
40
  info = File.read(my_fixture('pkg.info'))
44
- provider_class.stubs(:get_query).returns(info)
41
+ described_class.stubs(:get_query).returns(info)
45
42
 
46
43
  version_list = File.read(my_fixture('pkg.version'))
47
- provider_class.stubs(:get_version_list).returns(version_list)
44
+ described_class.stubs(:get_version_list).returns(version_list)
48
45
  end
49
46
 
50
47
  context "#instances" do
51
48
  it "should return the empty set if no packages are listed" do
52
- provider_class.stubs(:get_query).returns('')
53
- provider_class.stubs(:get_version_list).returns('')
54
- expect(provider_class.instances).to be_empty
49
+ described_class.stubs(:get_query).returns('')
50
+ described_class.stubs(:get_version_list).returns('')
51
+ expect(described_class.instances).to be_empty
55
52
  end
56
53
 
57
54
  it "should return all packages when invoked" do
58
- expect(provider_class.instances.map(&:name).sort).to eq(
55
+ expect(described_class.instances.map(&:name).sort).to eq(
59
56
  %w{ca_root_nss curl nmap pkg gnupg zsh tac_plus}.sort)
60
57
  end
61
58
 
62
59
  it "should set latest to current version when no upgrade available" do
63
- nmap = provider_class.instances.find {|i| i.properties[:origin] == 'security/nmap' }
60
+ nmap = described_class.instances.find {|i| i.properties[:origin] == 'security/nmap' }
64
61
 
65
62
  expect(nmap.properties[:version]).to eq(nmap.properties[:latest])
66
63
  end
67
64
 
68
65
  it "should return an empty array when pkg calls raise an exception" do
69
- provider_class.stubs(:get_query).raises(Puppet::ExecutionFailure, 'An error occurred.')
70
- expect(provider_class.instances).to eq([])
66
+ described_class.stubs(:get_query).raises(Puppet::ExecutionFailure, 'An error occurred.')
67
+ expect(described_class.instances).to eq([])
71
68
  end
72
69
 
73
70
  describe "version" do
74
71
  it "should retrieve the correct version of the current package" do
75
- zsh = provider_class.instances.find {|i| i.properties[:origin] == 'shells/zsh' }
72
+ zsh = described_class.instances.find {|i| i.properties[:origin] == 'shells/zsh' }
76
73
  expect( zsh.properties[:version]).to eq('5.0.2_1')
77
74
  end
78
75
  end
@@ -118,32 +115,32 @@ describe provider_class do
118
115
 
119
116
  context "#prefetch" do
120
117
  it "should fail gracefully when " do
121
- provider_class.stubs(:instances).returns([])
122
- expect{ provider_class.prefetch({}) }.to_not raise_error
118
+ described_class.stubs(:instances).returns([])
119
+ expect{ described_class.prefetch({}) }.to_not raise_error
123
120
  end
124
121
  end
125
122
 
126
123
  context "#query" do
127
124
  it "should return the installed version if present" do
128
- provider_class.prefetch({installed_name => installed_resource})
125
+ described_class.prefetch({installed_name => installed_resource})
129
126
  expect(installed_provider.query).to eq({:version=>'5.0.2_1'})
130
127
  end
131
128
 
132
129
  it "should return nil if not present" do
133
130
  fixture = File.read(my_fixture('pkg.query_absent'))
134
- provider_class.stubs(:get_resource_info).with('bash').returns(fixture)
131
+ described_class.stubs(:get_resource_info).with('bash').returns(fixture)
135
132
  expect(provider.query).to equal(nil)
136
133
  end
137
134
  end
138
135
 
139
136
  describe "latest" do
140
137
  it "should retrieve the correct version of the latest package" do
141
- provider_class.prefetch( { installed_name => installed_resource })
138
+ described_class.prefetch( { installed_name => installed_resource })
142
139
  expect(installed_provider.latest).not_to be_nil
143
140
  end
144
141
 
145
142
  it "should set latest to newer package version when available" do
146
- instances = provider_class.instances
143
+ instances = described_class.instances
147
144
  curl = instances.find {|i| i.properties[:origin] == 'ftp/curl' }
148
145
  expect(curl.properties[:latest]).to eq('7.33.0_2')
149
146
  end
@@ -164,13 +161,13 @@ describe provider_class do
164
161
  describe "get_latest_version" do
165
162
  it "should rereturn nil when the current package is the latest" do
166
163
  version_list = File.read(my_fixture('pkg.version'))
167
- nmap_latest_version = provider_class.get_latest_version('security/nmap', version_list)
164
+ nmap_latest_version = described_class.get_latest_version('security/nmap', version_list)
168
165
  expect(nmap_latest_version).to be_nil
169
166
  end
170
167
 
171
168
  it "should match the package name exactly" do
172
169
  version_list = File.read(my_fixture('pkg.version'))
173
- bash_comp_latest_version = provider_class.get_latest_version('shells/bash-completion', version_list)
170
+ bash_comp_latest_version = described_class.get_latest_version('shells/bash-completion', version_list)
174
171
  expect(bash_comp_latest_version).to eq('2.1_3')
175
172
  end
176
173
  end
@@ -179,7 +176,7 @@ describe provider_class do
179
176
  context "on FreeBSD" do
180
177
  it "should be the default provider" do
181
178
  Facter.expects(:value).with(:operatingsystem).at_least_once.returns :freebsd
182
- expect(provider_class).to be_default
179
+ expect(described_class).to be_default
183
180
  end
184
181
  end
185
182
  end