puppet 7.21.0 → 7.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +16 -16
  3. data/Guardfile.example +1 -1
  4. data/ext/project_data.yaml +1 -1
  5. data/ext/windows/service/daemon.rb +1 -1
  6. data/lib/puppet/indirector/facts/facter.rb +4 -1
  7. data/lib/puppet/parser/functions/fqdn_rand.rb +1 -1
  8. data/lib/puppet/version.rb +1 -1
  9. data/man/man5/puppet.conf.5 +2 -2
  10. data/man/man8/puppet-agent.8 +1 -1
  11. data/man/man8/puppet-apply.8 +1 -1
  12. data/man/man8/puppet-catalog.8 +1 -1
  13. data/man/man8/puppet-config.8 +1 -1
  14. data/man/man8/puppet-describe.8 +1 -1
  15. data/man/man8/puppet-device.8 +1 -1
  16. data/man/man8/puppet-doc.8 +1 -1
  17. data/man/man8/puppet-epp.8 +1 -1
  18. data/man/man8/puppet-facts.8 +1 -1
  19. data/man/man8/puppet-filebucket.8 +1 -1
  20. data/man/man8/puppet-generate.8 +1 -1
  21. data/man/man8/puppet-help.8 +1 -1
  22. data/man/man8/puppet-lookup.8 +1 -1
  23. data/man/man8/puppet-module.8 +1 -1
  24. data/man/man8/puppet-node.8 +1 -1
  25. data/man/man8/puppet-parser.8 +1 -1
  26. data/man/man8/puppet-plugin.8 +1 -1
  27. data/man/man8/puppet-report.8 +1 -1
  28. data/man/man8/puppet-resource.8 +1 -1
  29. data/man/man8/puppet-script.8 +1 -1
  30. data/man/man8/puppet-ssl.8 +1 -1
  31. data/man/man8/puppet.8 +2 -2
  32. data/spec/integration/application/agent_spec.rb +1 -1
  33. data/spec/unit/application/agent_spec.rb +1 -1
  34. data/spec/unit/application/device_spec.rb +1 -1
  35. data/spec/unit/application/resource_spec.rb +1 -1
  36. data/spec/unit/daemon_spec.rb +1 -1
  37. data/spec/unit/file_bucket/dipper_spec.rb +1 -1
  38. data/spec/unit/file_serving/fileset_spec.rb +14 -14
  39. data/spec/unit/file_system_spec.rb +3 -1
  40. data/spec/unit/graph/simple_graph_spec.rb +1 -1
  41. data/spec/unit/indirector/facts/facter_spec.rb +18 -3
  42. data/spec/unit/indirector/file_server_spec.rb +5 -5
  43. data/spec/unit/indirector/node/plain_spec.rb +1 -1
  44. data/spec/unit/parser/functions/fqdn_rand_spec.rb +1 -1
  45. data/spec/unit/provider/file/posix_spec.rb +4 -4
  46. data/spec/unit/provider/ldap_spec.rb +1 -1
  47. data/spec/unit/provider/nameservice_spec.rb +15 -15
  48. data/spec/unit/provider/package/aix_spec.rb +1 -1
  49. data/spec/unit/provider/package/nim_spec.rb +2 -2
  50. data/spec/unit/provider/service/bsd_spec.rb +4 -4
  51. data/spec/unit/provider/service/debian_spec.rb +2 -2
  52. data/spec/unit/provider/service/gentoo_spec.rb +20 -20
  53. data/spec/unit/provider/service/openbsd_spec.rb +18 -18
  54. data/spec/unit/provider/service/openrc_spec.rb +19 -19
  55. data/spec/unit/provider/service/systemd_spec.rb +22 -22
  56. data/spec/unit/provider/service/upstart_spec.rb +6 -6
  57. data/spec/unit/provider/user/aix_spec.rb +1 -1
  58. data/spec/unit/provider/user/hpux_spec.rb +1 -1
  59. data/spec/unit/provider/user/openbsd_spec.rb +1 -1
  60. data/spec/unit/provider/user/useradd_spec.rb +1 -1
  61. data/spec/unit/resource/type_spec.rb +2 -2
  62. data/spec/unit/ssl/base_spec.rb +1 -1
  63. data/spec/unit/ssl/certificate_request_spec.rb +1 -1
  64. data/spec/unit/ssl/certificate_spec.rb +1 -1
  65. data/spec/unit/transaction/event_manager_spec.rb +2 -2
  66. data/spec/unit/type/exec_spec.rb +1 -1
  67. data/spec/unit/util/backups_spec.rb +1 -1
  68. data/spec/unit/util/filetype_spec.rb +3 -3
  69. data/spec/unit/util/resource_template_spec.rb +1 -1
  70. metadata +8 -2
@@ -1,6 +1,8 @@
1
1
  require 'spec_helper'
2
2
  require 'puppet/indirector/facts/facter'
3
3
 
4
+ class Puppet::Node::Facts::Facter::MyCollection < Hash; end
5
+
4
6
  describe Puppet::Node::Facts::Facter do
5
7
  FS = Puppet::FileSystem
6
8
 
@@ -87,11 +89,24 @@ describe Puppet::Node::Facts::Facter do
87
89
  it "can exclude legacy facts" do
88
90
  Puppet[:include_legacy_facts] = false
89
91
 
90
- facts = Puppet::Node::Facts.new("foo")
91
- expect(Puppet::Node::Facts).to receive(:new).and_return(facts)
92
92
  expect(Puppet.runtime[:facter]).to receive(:resolve).with('')
93
+ .and_return({'kernelversion' => '1.2.3'})
93
94
 
94
- @facter.find(@request)
95
+ values = @facter.find(@request).values
96
+ expect(values).to be_an_instance_of(Hash)
97
+ expect(values).to include({'kernelversion' => '1.2.3'})
98
+ end
99
+
100
+ it "can exclude legacy facts using buggy facter implementations that return a Hash subclass" do
101
+ Puppet[:include_legacy_facts] = false
102
+
103
+ collection = Puppet::Node::Facts::Facter::MyCollection["kernelversion" => '1.2.3']
104
+ expect(Puppet.runtime[:facter]).to receive(:resolve).with('')
105
+ .and_return(collection)
106
+
107
+ values = @facter.find(@request).values
108
+ expect(values).to be_an_instance_of(Hash)
109
+ expect(values).to include({'kernelversion' => '1.2.3'})
95
110
  end
96
111
  end
97
112
 
@@ -183,10 +183,10 @@ describe Puppet::Indirector::FileServer do
183
183
  expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one", "two" => "/two")
184
184
 
185
185
  one = double('one', :collect => nil)
186
- expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
186
+ expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
187
187
 
188
188
  two = double('two', :collect => nil)
189
- expect(model).to receive(:new).with("/two", :relative_path => "two").and_return(two)
189
+ expect(model).to receive(:new).with("/two", {:relative_path => "two"}).and_return(two)
190
190
 
191
191
  # order can't be guaranteed
192
192
  result = indirection.search(uri)
@@ -205,7 +205,7 @@ describe Puppet::Indirector::FileServer do
205
205
  expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one")
206
206
 
207
207
  one = double('one', :collect => nil)
208
- expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
208
+ expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
209
209
  expect(one).to receive(:links=).with(true)
210
210
 
211
211
  indirection.search(uri, links: true)
@@ -221,7 +221,7 @@ describe Puppet::Indirector::FileServer do
221
221
  expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one")
222
222
 
223
223
  one = double('one', :collect => nil)
224
- expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
224
+ expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
225
225
 
226
226
  expect(one).to receive(:checksum_type=).with(:checksum)
227
227
 
@@ -238,7 +238,7 @@ describe Puppet::Indirector::FileServer do
238
238
  expect(Puppet::FileServing::Fileset).to receive(:merge).and_return("one" => "/one")
239
239
 
240
240
  one = double('one')
241
- expect(model).to receive(:new).with("/one", :relative_path => "one").and_return(one)
241
+ expect(model).to receive(:new).with("/one", {:relative_path => "one"}).and_return(one)
242
242
  expect(one).to receive(:collect)
243
243
 
244
244
  indirection.search(uri)
@@ -21,7 +21,7 @@ describe Puppet::Node::Plain do
21
21
  end
22
22
 
23
23
  it "should find facts if none are supplied" do
24
- expect(Puppet::Node::Facts.indirection).to receive(:find).with(nodename, :environment => environment).and_return(indirection_facts)
24
+ expect(Puppet::Node::Facts.indirection).to receive(:find).with(nodename, {:environment => environment}).and_return(indirection_facts)
25
25
  request.options.delete(:facts)
26
26
  node = node_indirection.find(request)
27
27
  expect(node.parameters).to include(indirection_fact_values)
@@ -80,7 +80,7 @@ describe "the fqdn_rand function" do
80
80
  extra = args[:extra_identifier] || []
81
81
 
82
82
  scope = create_test_scope_for_node('localhost')
83
- scope.compiler.topscope['fqdn'] = host.freeze
83
+ scope.set_facts({ 'networking' => { 'fqdn' => host }})
84
84
 
85
85
  scope.function_fqdn_rand([max] + extra)
86
86
  end
@@ -39,7 +39,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
39
39
 
40
40
  describe "#uid2name" do
41
41
  it "should return the name of the user identified by the id" do
42
- allow(Etc).to receive(:getpwuid).with(501).and_return(Struct::Passwd.new('jilluser', nil, 501))
42
+ allow(Etc).to receive(:getpwuid).with(501).and_return(Etc::Passwd.new('jilluser', nil, 501))
43
43
 
44
44
  expect(provider.uid2name(501)).to eq('jilluser')
45
45
  end
@@ -61,7 +61,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
61
61
 
62
62
  describe "#name2uid" do
63
63
  it "should return the id of the user if it exists" do
64
- passwd = Struct::Passwd.new('bobbo', nil, 502)
64
+ passwd = Etc::Passwd.new('bobbo', nil, 502)
65
65
 
66
66
  allow(Etc).to receive(:getpwnam).with('bobbo').and_return(passwd)
67
67
  allow(Etc).to receive(:getpwuid).with(502).and_return(passwd)
@@ -131,7 +131,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
131
131
 
132
132
  describe "#gid2name" do
133
133
  it "should return the name of the group identified by the id" do
134
- allow(Etc).to receive(:getgrgid).with(501).and_return(Struct::Passwd.new('unicorns', nil, nil, 501))
134
+ allow(Etc).to receive(:getgrgid).with(501).and_return(Etc::Passwd.new('unicorns', nil, nil, 501))
135
135
 
136
136
  expect(provider.gid2name(501)).to eq('unicorns')
137
137
  end
@@ -153,7 +153,7 @@ describe Puppet::Type.type(:file).provider(:posix), :if => Puppet.features.posix
153
153
 
154
154
  describe "#name2gid" do
155
155
  it "should return the id of the group if it exists" do
156
- passwd = Struct::Passwd.new('penguins', nil, nil, 502)
156
+ passwd = Etc::Passwd.new('penguins', nil, nil, 502)
157
157
 
158
158
  allow(Etc).to receive(:getgrnam).with('penguins').and_return(passwd)
159
159
  allow(Etc).to receive(:getgrgid).with(502).and_return(passwd)
@@ -73,7 +73,7 @@ describe Puppet::Provider::Ldap do
73
73
  it "should create a provider with :ensure => :absent" do
74
74
  expect(@manager).to receive(:find).with("one").and_return(nil)
75
75
 
76
- expect(@class).to receive(:new).with(:ensure => :absent).and_return("myprovider")
76
+ expect(@class).to receive(:new).with({:ensure => :absent}).and_return("myprovider")
77
77
 
78
78
  expect(@resource).to receive(:provider=).with("myprovider")
79
79
 
@@ -30,8 +30,8 @@ describe Puppet::Provider::NameService do
30
30
  # These are values getpwent might give you
31
31
  let :users do
32
32
  [
33
- Struct::Passwd.new('root', 'x', 0, 0),
34
- Struct::Passwd.new('foo', 'x', 1000, 2000),
33
+ Etc::Passwd.new('root', 'x', 0, 0),
34
+ Etc::Passwd.new('foo', 'x', 1000, 2000),
35
35
  nil
36
36
  ]
37
37
  end
@@ -39,13 +39,13 @@ describe Puppet::Provider::NameService do
39
39
  # These are values getgrent might give you
40
40
  let :groups do
41
41
  [
42
- Struct::Group.new('root', 'x', 0, %w{root}),
43
- Struct::Group.new('bin', 'x', 1, %w{root bin daemon}),
42
+ Etc::Group.new('root', 'x', 0, %w{root}),
43
+ Etc::Group.new('bin', 'x', 1, %w{root bin daemon}),
44
44
  nil
45
45
  ]
46
46
  end
47
47
 
48
- # A fake struct besides Struct::Group and Struct::Passwd
48
+ # A fake struct besides Etc::Group and Etc::Passwd
49
49
  let :fakestruct do
50
50
  Struct.new(:foo, :bar)
51
51
  end
@@ -82,11 +82,11 @@ describe Puppet::Provider::NameService do
82
82
 
83
83
  let(:utf_8_mixed_users) {
84
84
  [
85
- Struct::Passwd.new('root', 'x', 0, 0),
86
- Struct::Passwd.new('foo', 'x', 1000, 2000),
87
- Struct::Passwd.new(utf_8_jose, utf_8_jose, 1001, 2000), # UTF-8 character
85
+ Etc::Passwd.new('root', 'x', 0, 0),
86
+ Etc::Passwd.new('foo', 'x', 1000, 2000),
87
+ Etc::Passwd.new(utf_8_jose, utf_8_jose, 1001, 2000), # UTF-8 character
88
88
  # In a UTF-8 environment, ruby will return strings labeled as UTF-8 even if they're not valid in UTF-8
89
- Struct::Passwd.new(invalid_utf_8_jose, invalid_utf_8_jose, 1002, 2000),
89
+ Etc::Passwd.new(invalid_utf_8_jose, invalid_utf_8_jose, 1002, 2000),
90
90
  nil
91
91
  ]
92
92
  }
@@ -94,10 +94,10 @@ describe Puppet::Provider::NameService do
94
94
  let(:latin_1_mixed_users) {
95
95
  [
96
96
  # In a LATIN-1 environment, ruby will return *all* strings labeled as LATIN-1
97
- Struct::Passwd.new('root'.force_encoding(Encoding::ISO_8859_1), 'x', 0, 0),
98
- Struct::Passwd.new('foo'.force_encoding(Encoding::ISO_8859_1), 'x', 1000, 2000),
99
- Struct::Passwd.new(utf_8_labeled_as_latin_1_jose, utf_8_labeled_as_latin_1_jose, 1002, 2000),
100
- Struct::Passwd.new(valid_latin1_jose, valid_latin1_jose, 1001, 2000), # UTF-8 character
97
+ Etc::Passwd.new('root'.force_encoding(Encoding::ISO_8859_1), 'x', 0, 0),
98
+ Etc::Passwd.new('foo'.force_encoding(Encoding::ISO_8859_1), 'x', 1000, 2000),
99
+ Etc::Passwd.new(utf_8_labeled_as_latin_1_jose, utf_8_labeled_as_latin_1_jose, 1002, 2000),
100
+ Etc::Passwd.new(valid_latin1_jose, valid_latin1_jose, 1001, 2000), # UTF-8 character
101
101
  nil
102
102
  ]
103
103
  }
@@ -197,9 +197,9 @@ describe Puppet::Provider::NameService do
197
197
  end
198
198
 
199
199
  it "should pass the Puppet::Etc :canonical_name Struct member to the constructor" do
200
- users = [ Struct::Passwd.new(invalid_utf_8_jose, invalid_utf_8_jose, 1002, 2000), nil ]
200
+ users = [ Etc::Passwd.new(invalid_utf_8_jose, invalid_utf_8_jose, 1002, 2000), nil ]
201
201
  allow(Etc).to receive(:getpwent).and_return(*users)
202
- expect(provider.class).to receive(:new).with(:name => escaped_utf_8_jose, :canonical_name => invalid_utf_8_jose, :ensure => :present)
202
+ expect(provider.class).to receive(:new).with({:name => escaped_utf_8_jose, :canonical_name => invalid_utf_8_jose, :ensure => :present})
203
203
  provider.class.instances
204
204
  end
205
205
  end
@@ -16,7 +16,7 @@ describe Puppet::Type.type(:package).provider(:aix) do
16
16
 
17
17
  it "should uninstall a package" do
18
18
  expect(@provider).to receive(:installp).with('-gu', 'mypackage')
19
- expect(@provider.class).to receive(:pkglist).with(:pkgname => 'mypackage').and_return(nil)
19
+ expect(@provider.class).to receive(:pkglist).with({:pkgname => 'mypackage'}).and_return(nil)
20
20
  @provider.uninstall
21
21
  end
22
22
 
@@ -158,14 +158,14 @@ OUTPUT
158
158
  it "should call installp to uninstall a bff package" do
159
159
  expect(@provider).to receive(:lslpp).with("-qLc", "mypackage.foo").and_return("#bos.atm:bos.atm.atmle:7.1.2.0: : :C: :ATM LAN Emulation Client Support : : : : : : :0:0:/:1241")
160
160
  expect(@provider).to receive(:installp).with("-gu", "mypackage.foo")
161
- expect(@provider.class).to receive(:pkglist).with(:pkgname => 'mypackage.foo').and_return(nil)
161
+ expect(@provider.class).to receive(:pkglist).with({:pkgname => 'mypackage.foo'}).and_return(nil)
162
162
  @provider.uninstall
163
163
  end
164
164
 
165
165
  it "should call rpm to uninstall an rpm package" do
166
166
  expect(@provider).to receive(:lslpp).with("-qLc", "mypackage.foo").and_return("cdrecord:cdrecord-1.9-6:1.9-6: : :C:R:A command line CD/DVD recording program.: :/bin/rpm -e cdrecord: : : : :0: :/opt/freeware:Wed Jun 29 09:41:32 PDT 2005")
167
167
  expect(@provider).to receive(:rpm).with("-e", "mypackage.foo")
168
- expect(@provider.class).to receive(:pkglist).with(:pkgname => 'mypackage.foo').and_return(nil)
168
+ expect(@provider.class).to receive(:pkglist).with({:pkgname => 'mypackage.foo'}).and_return(nil)
169
169
  @provider.uninstall
170
170
  end
171
171
  end
@@ -94,13 +94,13 @@ describe 'Puppet::Type::Service::Provider::Bsd',
94
94
 
95
95
  it "should use the supplied start command if specified" do
96
96
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
97
- expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
97
+ expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
98
98
  provider.start
99
99
  end
100
100
 
101
101
  it "should start the serviced directly otherwise" do
102
102
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
103
- expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
103
+ expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
104
104
  expect(provider).to receive(:search).with('sshd').and_return('/etc/rc.d/sshd')
105
105
  provider.start
106
106
  end
@@ -113,13 +113,13 @@ describe 'Puppet::Type::Service::Provider::Bsd',
113
113
 
114
114
  it "should use the supplied stop command if specified" do
115
115
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
116
- expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
116
+ expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
117
117
  provider.stop
118
118
  end
119
119
 
120
120
  it "should stop the serviced directly otherwise" do
121
121
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
122
- expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
122
+ expect(provider).to receive(:execute).with(['/etc/rc.d/sshd', :onestop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
123
123
  expect(provider).to receive(:search).with('sshd').and_return('/etc/rc.d/sshd')
124
124
  provider.stop
125
125
  end
@@ -87,7 +87,7 @@ describe 'Puppet::Type::Service::Provider::Debian',
87
87
 
88
88
  context "when checking whether it is enabled" do
89
89
  it "should execute the query command" do
90
- expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start"], :failonfail => false)
90
+ expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start"], {:failonfail => false})
91
91
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
92
92
  @provider.enabled?
93
93
  end
@@ -104,7 +104,7 @@ describe 'Puppet::Type::Service::Provider::Debian',
104
104
 
105
105
  it "should consider nonexistent services to be disabled" do
106
106
  @provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist'))
107
- expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], :failonfail => false)
107
+ expect(@provider).to receive(:execute).with(["/usr/sbin/invoke-rc.d", "--quiet", "--query", "doesnotexist", "start"], {:failonfail => false})
108
108
  .and_return(Puppet::Util::Execution::ProcessOutput.new("", 1))
109
109
  expect(@provider.enabled?).to be(:false)
110
110
  end
@@ -79,13 +79,13 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
79
79
  describe "#start" do
80
80
  it "should use the supplied start command if specified" do
81
81
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
82
- expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
82
+ expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
83
83
  provider.start
84
84
  end
85
85
 
86
86
  it "should start the service with <initscript> start otherwise" do
87
87
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
88
- expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
88
+ expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
89
89
  expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
90
90
  provider.start
91
91
  end
@@ -94,13 +94,13 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
94
94
  describe "#stop" do
95
95
  it "should use the supplied stop command if specified" do
96
96
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
97
- expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
97
+ expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
98
98
  provider.stop
99
99
  end
100
100
 
101
101
  it "should stop the service with <initscript> stop otherwise" do
102
102
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
103
- expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
103
+ expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
104
104
  expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
105
105
  provider.stop
106
106
  end
@@ -160,27 +160,27 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
160
160
  describe "when a special status command is specified" do
161
161
  it "should use the status command from the resource" do
162
162
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
163
- expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
163
+ expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
164
164
  expect(provider).to receive(:execute)
165
- .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
165
+ .with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
166
166
  .and_return(process_output)
167
167
  provider.status
168
168
  end
169
169
 
170
170
  it "should return :stopped when the status command returns with a non-zero exitcode" do
171
171
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
172
- expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
172
+ expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
173
173
  expect(provider).to receive(:execute)
174
- .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
174
+ .with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
175
175
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3))
176
176
  expect(provider.status).to eq(:stopped)
177
177
  end
178
178
 
179
179
  it "should return :running when the status command returns with a zero exitcode" do
180
180
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
181
- expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
181
+ expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
182
182
  expect(provider).to receive(:execute)
183
- .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
183
+ .with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
184
184
  .and_return(process_output)
185
185
  expect(provider.status).to eq(:running)
186
186
  end
@@ -189,14 +189,14 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
189
189
  describe "when hasstatus is false" do
190
190
  it "should return running if a pid can be found" do
191
191
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
192
- expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
192
+ expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
193
193
  expect(provider).to receive(:getpid).and_return(1000)
194
194
  expect(provider.status).to eq(:running)
195
195
  end
196
196
 
197
197
  it "should return stopped if no pid can be found" do
198
198
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
199
- expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
199
+ expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
200
200
  expect(provider).to receive(:getpid).and_return(nil)
201
201
  expect(provider.status).to eq(:stopped)
202
202
  end
@@ -207,7 +207,7 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
207
207
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
208
208
  expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
209
209
  expect(provider).to receive(:execute)
210
- .with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
210
+ .with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
211
211
  .and_return(process_output)
212
212
  expect(provider.status).to eq(:running)
213
213
  end
@@ -216,7 +216,7 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
216
216
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
217
217
  expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
218
218
  expect(provider).to receive(:execute)
219
- .with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
219
+ .with(['/etc/init.d/sshd',:status], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
220
220
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3))
221
221
  expect(provider.status).to eq(:stopped)
222
222
  end
@@ -226,24 +226,24 @@ describe 'Puppet::Type::Service::Provider::Gentoo',
226
226
  describe "#restart" do
227
227
  it "should use the supplied restart command if specified" do
228
228
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
229
- expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
230
- expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
229
+ expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
230
+ expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
231
231
  provider.restart
232
232
  end
233
233
 
234
234
  it "should restart the service with <initscript> restart if hasrestart is true" do
235
235
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => true))
236
236
  expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
237
- expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
237
+ expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
238
238
  provider.restart
239
239
  end
240
240
 
241
241
  it "should restart the service with <initscript> stop/start if hasrestart is false" do
242
242
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => false))
243
243
  expect(provider).to receive(:search).with('sshd').and_return('/etc/init.d/sshd')
244
- expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
245
- expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
246
- expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
244
+ expect(provider).not_to receive(:execute).with(['/etc/init.d/sshd',:restart], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
245
+ expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:stop], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
246
+ expect(provider).to receive(:execute).with(['/etc/init.d/sshd',:start], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
247
247
  provider.restart
248
248
  end
249
249
  end
@@ -28,7 +28,7 @@ describe 'Puppet::Type::Service::Provider::Openbsd',
28
28
  context "#start" do
29
29
  it "should use the supplied start command if specified" do
30
30
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
31
- expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
31
+ expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
32
32
  provider.start
33
33
  end
34
34
 
@@ -42,7 +42,7 @@ describe 'Puppet::Type::Service::Provider::Openbsd',
42
42
  context "#stop" do
43
43
  it "should use the supplied stop command if specified" do
44
44
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
45
- expect(provider).to receive(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
45
+ expect(provider).to receive(:execute).with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
46
46
  provider.stop
47
47
  end
48
48
 
@@ -56,27 +56,27 @@ describe 'Puppet::Type::Service::Provider::Openbsd',
56
56
  context "#status" do
57
57
  it "should use the status command from the resource" do
58
58
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
59
- expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
59
+ expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
60
60
  expect(provider).to receive(:execute)
61
- .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
61
+ .with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
62
62
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
63
63
  provider.status
64
64
  end
65
65
 
66
66
  it "should return :stopped when status command returns with a non-zero exitcode" do
67
67
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
68
- expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
68
+ expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
69
69
  expect(provider).to receive(:execute)
70
- .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
70
+ .with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
71
71
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 3))
72
72
  expect(provider.status).to eq(:stopped)
73
73
  end
74
74
 
75
75
  it "should return :running when status command returns with a zero exitcode" do
76
76
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
77
- expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
77
+ expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', :get, 'sshd', :status], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
78
78
  expect(provider).to receive(:execute)
79
- .with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
79
+ .with(['/bin/foo'], {:failonfail => false, :override_locale => false, :squelch => false, :combine => true})
80
80
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
81
81
  expect(provider.status).to eq(:running)
82
82
  end
@@ -85,9 +85,9 @@ describe 'Puppet::Type::Service::Provider::Openbsd',
85
85
  context "#restart" do
86
86
  it "should use the supplied restart command if specified" do
87
87
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
88
- expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', '-f', :restart, 'sshd'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
88
+ expect(provider).not_to receive(:execute).with(['/usr/sbin/rcctl', '-f', :restart, 'sshd'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
89
89
  expect(provider).to receive(:execute)
90
- .with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => false, :combine => true)
90
+ .with(['/bin/foo'], {:failonfail => true, :override_locale => false, :squelch => false, :combine => true})
91
91
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
92
92
  provider.restart
93
93
  end
@@ -110,13 +110,13 @@ describe 'Puppet::Type::Service::Provider::Openbsd',
110
110
  context "#enabled?" do
111
111
  it "should return :true if the service is enabled" do
112
112
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
113
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'status'], :failonfail => false, :combine => false, :squelch => false).and_return(double(:exitstatus => 0))
113
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'status'], {:failonfail => false, :combine => false, :squelch => false}).and_return(double(:exitstatus => 0))
114
114
  expect(provider.enabled?).to eq(:true)
115
115
  end
116
116
 
117
117
  it "should return :false if the service is disabled" do
118
118
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
119
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'status'], :failonfail => false, :combine => false, :squelch => false).and_return(Puppet::Util::Execution::ProcessOutput.new('NO', 1))
119
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'status'], {:failonfail => false, :combine => false, :squelch => false}).and_return(Puppet::Util::Execution::ProcessOutput.new('NO', 1))
120
120
  expect(provider.enabled?).to eq(:false)
121
121
  end
122
122
  end
@@ -147,19 +147,19 @@ describe 'Puppet::Type::Service::Provider::Openbsd',
147
147
  context "#running?" do
148
148
  it "should run rcctl check to check the service" do
149
149
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
150
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], :failonfail => false, :combine => false, :squelch => false).and_return('sshd(ok)')
150
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], {:failonfail => false, :combine => false, :squelch => false}).and_return('sshd(ok)')
151
151
  expect(provider.running?).to be_truthy
152
152
  end
153
153
 
154
154
  it "should return true if the service is running" do
155
155
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
156
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], :failonfail => false, :combine => false, :squelch => false).and_return('sshd(ok)')
156
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], {:failonfail => false, :combine => false, :squelch => false}).and_return('sshd(ok)')
157
157
  expect(provider.running?).to be_truthy
158
158
  end
159
159
 
160
160
  it "should return nil if the service is not running" do
161
161
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
162
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], :failonfail => false, :combine => false, :squelch => false).and_return('sshd(failed)')
162
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'check', 'sshd'], {:failonfail => false, :combine => false, :squelch => false}).and_return('sshd(failed)')
163
163
  expect(provider.running?).to be_nil
164
164
  end
165
165
  end
@@ -167,19 +167,19 @@ describe 'Puppet::Type::Service::Provider::Openbsd',
167
167
  context "#flags" do
168
168
  it "should return flags when set" do
169
169
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :flags => '-6'))
170
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'flags'], :failonfail => false, :combine => false, :squelch => false).and_return('-6')
170
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'flags'], {:failonfail => false, :combine => false, :squelch => false}).and_return('-6')
171
171
  provider.flags
172
172
  end
173
173
 
174
174
  it "should return empty flags" do
175
175
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
176
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'flags'], :failonfail => false, :combine => false, :squelch => false).and_return('')
176
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'sshd', 'flags'], {:failonfail => false, :combine => false, :squelch => false}).and_return('')
177
177
  provider.flags
178
178
  end
179
179
 
180
180
  it "should return flags for special services" do
181
181
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'pf'))
182
- expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'pf', 'flags'], :failonfail => false, :combine => false, :squelch => false).and_return('YES')
182
+ expect(provider).to receive(:execute).with(['/usr/sbin/rcctl', 'get', 'pf', 'flags'], {:failonfail => false, :combine => false, :squelch => false}).and_return('YES')
183
183
  provider.flags
184
184
  end
185
185
  end