puppet 4.2.0-x86-mingw32 → 4.2.1-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 (77) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/ext/project_data.yaml +1 -1
  4. data/ext/suse/client.init +23 -10
  5. data/lib/hiera/puppet_function.rb +5 -5
  6. data/lib/puppet/application/agent.rb +14 -4
  7. data/lib/puppet/application/apply.rb +13 -4
  8. data/lib/puppet/defaults.rb +1 -1
  9. data/lib/puppet/environments.rb +85 -5
  10. data/lib/puppet/functions/epp.rb +29 -37
  11. data/lib/puppet/functions/hiera_include.rb +2 -2
  12. data/lib/puppet/functions/inline_epp.rb +44 -71
  13. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  14. data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +25 -18
  15. data/lib/puppet/node.rb +11 -5
  16. data/lib/puppet/parser/functions/epp.rb +29 -37
  17. data/lib/puppet/parser/functions/inline_epp.rb +35 -60
  18. data/lib/puppet/pops/issues.rb +6 -2
  19. data/lib/puppet/pops/patterns.rb +3 -0
  20. data/lib/puppet/pops/types/type_parser.rb +2 -2
  21. data/lib/puppet/pops/validation/checker4_0.rb +4 -0
  22. data/lib/puppet/provider/zone/solaris.rb +2 -2
  23. data/lib/puppet/type.rb +4 -4
  24. data/lib/puppet/util.rb +9 -1
  25. data/lib/puppet/util/command_line.rb +4 -0
  26. data/lib/puppet/version.rb +1 -1
  27. data/spec/integration/parser/compiler_spec.rb +7 -5
  28. data/spec/integration/provider/package_spec.rb +3 -1
  29. data/spec/integration/ssl/certificate_authority_spec.rb +0 -1
  30. data/spec/integration/ssl/certificate_request_spec.rb +0 -1
  31. data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -1
  32. data/spec/integration/ssl/host_spec.rb +0 -1
  33. data/spec/integration/util/rdoc/parser_spec.rb +1 -1
  34. data/spec/unit/application/apply_spec.rb +1 -1
  35. data/spec/unit/application/filebucket_spec.rb +1 -1
  36. data/spec/unit/application_spec.rb +3 -3
  37. data/spec/unit/environments_spec.rb +2 -0
  38. data/spec/unit/face/node_spec.rb +1 -1
  39. data/spec/unit/file_serving/configuration_spec.rb +1 -1
  40. data/spec/unit/functions/hiera_spec.rb +2 -2
  41. data/spec/unit/graph/sequential_prioritizer_spec.rb +1 -1
  42. data/spec/unit/indirector/indirection_spec.rb +2 -2
  43. data/spec/unit/indirector/ssl_file_spec.rb +1 -1
  44. data/spec/unit/indirector/yaml_spec.rb +1 -1
  45. data/spec/unit/module_tool/application_spec.rb +1 -1
  46. data/spec/unit/module_tool/applications/builder_spec.rb +1 -1
  47. data/spec/unit/network/authstore_spec.rb +1 -1
  48. data/spec/unit/network/http/compression_spec.rb +1 -1
  49. data/spec/unit/network/http/handler_spec.rb +0 -5
  50. data/spec/unit/network/rights_spec.rb +3 -3
  51. data/spec/unit/node_spec.rb +27 -0
  52. data/spec/unit/parser/ast/leaf_spec.rb +1 -1
  53. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +1 -0
  54. data/spec/unit/pops/types/type_parser_spec.rb +8 -0
  55. data/spec/unit/pops/validator/validator_spec.rb +19 -0
  56. data/spec/unit/property_spec.rb +1 -1
  57. data/spec/unit/provider/service/debian_spec.rb +1 -0
  58. data/spec/unit/provider/service/gentoo_spec.rb +1 -0
  59. data/spec/unit/provider/service/init_spec.rb +6 -0
  60. data/spec/unit/provider/service/openrc_spec.rb +1 -0
  61. data/spec/unit/provider/service/src_spec.rb +1 -0
  62. data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -1
  63. data/spec/unit/provider/zone/solaris_spec.rb +19 -0
  64. data/spec/unit/resource_spec.rb +2 -2
  65. data/spec/unit/settings_spec.rb +1 -1
  66. data/spec/unit/ssl/certificate_authority_spec.rb +5 -3
  67. data/spec/unit/ssl/host_spec.rb +2 -2
  68. data/spec/unit/type/host_spec.rb +4 -4
  69. data/spec/unit/type/tidy_spec.rb +4 -4
  70. data/spec/unit/type/vlan_spec.rb +1 -1
  71. data/spec/unit/util/ldap/generator_spec.rb +1 -1
  72. data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
  73. data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -1
  74. data/spec/unit/util/network_device_spec.rb +1 -1
  75. data/spec/unit/util/storage_spec.rb +5 -1
  76. data/spec/unit/util_spec.rb +21 -2
  77. metadata +3195 -3217
@@ -12,7 +12,9 @@ describe "Package provider" do
12
12
  options = {:name => "nosuch#{provider.name}", :provider => provider.name}
13
13
 
14
14
  pkg = Puppet::Type.newpackage(options)
15
- expect { pkg.provider.install }.to raise_error
15
+ expect { pkg.provider.install }.to raise_error { |error|
16
+ expect(error).not_to eq("")
17
+ }
16
18
  end
17
19
 
18
20
  it "should be able to get a list of existing packages" do
@@ -13,7 +13,6 @@ describe Puppet::SSL::CertificateAuthority, :unless => Puppet.features.microsoft
13
13
 
14
14
  Puppet.settings[:confdir] = dir
15
15
  Puppet.settings[:vardir] = dir
16
- Puppet.settings[:group] = Process.gid
17
16
 
18
17
  Puppet::SSL::Host.ca_location = :local
19
18
 
@@ -12,7 +12,6 @@ describe Puppet::SSL::CertificateRequest do
12
12
 
13
13
  Puppet.settings[:confdir] = dir
14
14
  Puppet.settings[:vardir] = dir
15
- Puppet.settings[:group] = Process.gid
16
15
 
17
16
  Puppet::SSL::Host.ca_location = :none
18
17
 
@@ -12,7 +12,6 @@ describe Puppet::SSL::CertificateRevocationList do
12
12
 
13
13
  Puppet.settings[:confdir] = dir
14
14
  Puppet.settings[:vardir] = dir
15
- Puppet.settings[:group] = Process.gid
16
15
 
17
16
  Puppet::SSL::Host.ca_location = :local
18
17
  end
@@ -12,7 +12,6 @@ describe Puppet::SSL::Host do
12
12
 
13
13
  Puppet.settings[:confdir] = dir
14
14
  Puppet.settings[:vardir] = dir
15
- Puppet.settings[:group] = Process.gid
16
15
 
17
16
  Puppet::SSL::Host.ca_location = :local
18
17
 
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
  require 'puppet/util/rdoc'
4
4
 
5
- describe "RDoc::Parser" do
5
+ describe "RDoc::Parser", :unless => Puppet.features.microsoft_windows? do
6
6
  require 'puppet_spec/files'
7
7
  include PuppetSpec::Files
8
8
 
@@ -359,7 +359,7 @@ describe Puppet::Application::Apply do
359
359
  it "should raise an error if we can't find the facts" do
360
360
  Puppet::Node::Facts.indirection.expects(:find).returns(nil)
361
361
 
362
- expect { @apply.main }.to raise_error
362
+ expect { @apply.main }.to raise_error(RuntimeError, /Could not find facts/)
363
363
  end
364
364
  end
365
365
 
@@ -173,7 +173,7 @@ describe Puppet::Application::Filebucket do
173
173
  describe "the command backup" do
174
174
  it "should fail if no arguments are specified" do
175
175
  @filebucket.stubs(:args).returns([])
176
- expect { @filebucket.backup }.to raise_error
176
+ expect { @filebucket.backup }.to raise_error(RuntimeError, /You must specify a file to back up/)
177
177
  end
178
178
 
179
179
  it "should call the client backup method for each given parameter" do
@@ -147,7 +147,7 @@ describe Puppet::Application do
147
147
  # no-op
148
148
  end
149
149
  end
150
- }.to raise_error
150
+ }.to raise_error(Puppet::Settings::ValidationError, /Invalid run mode/)
151
151
  end
152
152
 
153
153
  it "should have a run entry-point" do
@@ -468,7 +468,7 @@ describe Puppet::Application do
468
468
  ROUTES
469
469
  end
470
470
 
471
- expect { @app.configure_indirector_routes }.to raise_error
471
+ expect { @app.configure_indirector_routes }.to raise_error(Psych::SyntaxError, /mapping values are not allowed in this context/)
472
472
  end
473
473
  end
474
474
 
@@ -564,7 +564,7 @@ describe Puppet::Application do
564
564
  raise "I can't believe it, it works!"
565
565
  end
566
566
 
567
- expect { @app.handle_test2 }.to raise_error
567
+ expect { @app.handle_test2 }.to raise_error(RuntimeError, /I can't believe it, it works!/)
568
568
  end
569
569
 
570
570
  it "should declare the option to OptionParser" do
@@ -642,6 +642,8 @@ config_version=$vardir/random/scripts
642
642
  end
643
643
 
644
644
  def expired?(env_name)
645
+ # make expired? idempotent
646
+ return true if @expired_envs.include? (env_name)
645
647
  @expired_envs << env_name
646
648
  @expiration_sequence.pop
647
649
  end
@@ -47,7 +47,7 @@ describe Puppet::Face[:node, '0.0.1'] do
47
47
  end
48
48
 
49
49
  it "should not accept a call with no arguments" do
50
- expect { subject.clean() }.to raise_error
50
+ expect { subject.clean() }.to raise_error(RuntimeError, /At least one node should be passed/)
51
51
  end
52
52
 
53
53
  it "should accept a node name" do
@@ -17,7 +17,7 @@ describe Puppet::FileServing::Configuration do
17
17
  end
18
18
 
19
19
  it "should make :new a private method" do
20
- expect { Puppet::FileServing::Configuration.new }.to raise_error
20
+ expect { Puppet::FileServing::Configuration.new }.to raise_error(NoMethodError, /private method `new' called/)
21
21
  end
22
22
 
23
23
  it "should return the same configuration each time 'configuration' is called" do
@@ -108,7 +108,7 @@ describe 'when calling' do
108
108
 
109
109
  it 'should use the array resolution_type' do
110
110
  Hiera.any_instance.expects(:lookup).with { |*args| expect(args[4]).to be(:array) }.returns(%w[foo bar baz])
111
- hiera_include.expects(:call_function).with('include', %w[foo bar baz])
111
+ hiera_include.expects(:call_function_with_scope).with(scope, 'include', %w[foo bar baz])
112
112
  hiera_include.call(scope, 'key', {'key' => 'foo_result'})
113
113
  end
114
114
 
@@ -118,7 +118,7 @@ describe 'when calling' do
118
118
  end
119
119
 
120
120
  it 'should use default block' do
121
- hiera_include.expects(:call_function).with('include', %w[key foo])
121
+ hiera_include.expects(:call_function_with_scope).with(scope,'include', %w[key foo])
122
122
  hiera_include.call(scope, 'foo') { |k| ['key', k] }
123
123
  end
124
124
  end
@@ -27,6 +27,6 @@ describe Puppet::Graph::SequentialPrioritizer do
27
27
  it "fails to prioritize a key contained in an unknown container" do
28
28
  expect do
29
29
  priorities.generate_priority_contained_in("unknown", "child 1")
30
- end.to raise_error
30
+ end.to raise_error(NoMethodError, /`down' for nil/)
31
31
  end
32
32
  end
@@ -115,7 +115,7 @@ describe Puppet::Indirector::Indirection do
115
115
  describe "when initializing" do
116
116
  # (LAK) I've no idea how to test this, really.
117
117
  it "should store a reference to itself before it consumes its options" do
118
- expect { @indirection = Puppet::Indirector::Indirection.new(Object.new, :testingness, :not_valid_option) }.to raise_error
118
+ expect { @indirection = Puppet::Indirector::Indirection.new(Object.new, :testingness, :not_valid_option) }.to raise_error(NoMethodError, /undefined method/)
119
119
  expect(Puppet::Indirector::Indirection.instance(:testingness)).to be_instance_of(Puppet::Indirector::Indirection)
120
120
  Puppet::Indirector::Indirection.instance(:testingness).delete
121
121
  end
@@ -509,7 +509,7 @@ describe Puppet::Indirector::Indirection do
509
509
 
510
510
  @cache.expects(:save).never
511
511
  @terminus.expects(:save).raises "eh"
512
- expect { @indirection.save(@instance) }.to raise_error
512
+ expect { @indirection.save(@instance) }.to raise_error(RuntimeError, /eh/)
513
513
  end
514
514
  end
515
515
  end
@@ -108,7 +108,7 @@ describe Puppet::Indirector::SslFile do
108
108
  "//?/c:/foo",
109
109
  ].each do |input|
110
110
  it "should resist directory traversal attacks (#{input.inspect})" do
111
- expect { @searcher.path(input) }.to raise_error
111
+ expect { @searcher.path(input) }.to raise_error(ArgumentError, /invalid key/)
112
112
  end
113
113
  end
114
114
 
@@ -82,7 +82,7 @@ describe Puppet::Indirector::Yaml do
82
82
  "//?/c:/foo",
83
83
  ].each do |input|
84
84
  it "should resist directory traversal attacks (#{input.inspect})" do
85
- expect { @store.path(input) }.to raise_error
85
+ expect { @store.path(input) }.to raise_error(ArgumentError)
86
86
  end
87
87
  end
88
88
  end
@@ -18,7 +18,7 @@ describe Puppet::ModuleTool::Applications::Application do
18
18
 
19
19
  bad_versions.each do |ver|
20
20
  it "should not accept version string #{ver}" do
21
- expect { app.parse_filename("puppetlabs-ntp-#{ver}") }.to raise_error
21
+ expect { app.parse_filename("puppetlabs-ntp-#{ver}") }.to raise_error(ArgumentError, /(Invalid version format|Could not parse filename)/)
22
22
  end
23
23
  end
24
24
  end
@@ -319,7 +319,7 @@ symlinkfile
319
319
  end
320
320
 
321
321
  it "give an error about symlinks" do
322
- expect { builder.run }.to raise_error
322
+ expect { builder.run }.to raise_error(Puppet::ModuleTool::Errors::ModuleToolError, /Found symlinks/)
323
323
  end
324
324
  end
325
325
 
@@ -180,7 +180,7 @@ describe Puppet::Network::AuthStore::Declaration do
180
180
  ].each { |invalid_ip|
181
181
  describe "when the pattern is an invalid IPv6 address such as #{invalid_ip}" do
182
182
  it "should raise an exception" do
183
- expect { Puppet::Network::AuthStore::Declaration.new(:allow,invalid_ip) }.to raise_error
183
+ expect { Puppet::Network::AuthStore::Declaration.new(:allow,invalid_ip) }.to raise_error(Puppet::AuthStoreError, /Invalid pattern/)
184
184
  end
185
185
  end
186
186
  }
@@ -173,7 +173,7 @@ describe "http compression" do
173
173
  it "should raise the error the second time" do
174
174
  @inflater.stubs(:inflate).raises(Zlib::DataError.new("not a zlib stream"))
175
175
  Zlib::Inflate.expects(:new).with.returns(@inflater)
176
- expect { @adapter.uncompress("chunk") }.to raise_error
176
+ expect { @adapter.uncompress("chunk") }.to raise_error(Zlib::DataError, /not a zlib stream/)
177
177
  end
178
178
 
179
179
  it "should finish the stream on close" do
@@ -131,11 +131,6 @@ describe Puppet::Network::HTTP::Handler do
131
131
  handler.process(request, response)
132
132
  end
133
133
 
134
- it "should raise an error if the request is formatted in an unknown format" do
135
- handler.stubs(:content_type_header).returns "unknown format"
136
- expect { handler.request_format(request) }.to raise_error
137
- end
138
-
139
134
  it "should still find the correct format if content type contains charset information" do
140
135
  request = Puppet::Network::HTTP::Request.new({ 'content-type' => "text/plain; charset=UTF-8" },
141
136
  {}, 'GET', '/', nil)
@@ -29,7 +29,7 @@ describe Puppet::Network::Rights do
29
29
  end
30
30
 
31
31
  it "should throw an error if type can't be determined" do
32
- expect { @right.newright("name") }.to raise_error
32
+ expect { @right.newright("name") }.to raise_error(ArgumentError, /Unknown right type/)
33
33
  end
34
34
 
35
35
  describe "when creating new path ACLs" do
@@ -40,7 +40,7 @@ describe Puppet::Network::Rights do
40
40
  end
41
41
 
42
42
  it "should throw an error if the acl uri path is not absolute" do
43
- expect { @right.newright("name")}.to raise_error
43
+ expect { @right.newright("name")}.to raise_error(ArgumentError, /Unknown right type/)
44
44
  end
45
45
 
46
46
  it "should create a new ACL with the correct path" do
@@ -351,7 +351,7 @@ describe Puppet::Network::Rights do
351
351
  it "should raise an error if the method is already filtered" do
352
352
  @acl.restrict_method(:save)
353
353
 
354
- expect { @acl.restrict_method(:save) }.to raise_error
354
+ expect { @acl.restrict_method(:save) }.to raise_error(ArgumentError, /'save' is already in the '\/path'/)
355
355
  end
356
356
 
357
357
  it "should allow setting an environment filters" do
@@ -88,6 +88,33 @@ describe Puppet::Node do
88
88
  end
89
89
  end
90
90
 
91
+ describe "when serializing using yaml" do
92
+ before do
93
+ @node = Puppet::Node.new("mynode")
94
+ end
95
+
96
+ it "a node can roundtrip" do
97
+ expect(YAML.load(@node.to_yaml).name).to eql("mynode")
98
+ end
99
+
100
+ it "limits the serialization of environment to be just the name" do
101
+ # it is something like 138 when serializing everything in a default environment
102
+ expect(@node.to_yaml.size).to be < 70
103
+ end
104
+ end
105
+
106
+ describe "when serializing using yaml and values classes and parameters are missing in deserialized hash" do
107
+ it "a node can roundtrip" do
108
+ @node = Puppet::Node.from_data_hash({'name' => "mynode"})
109
+ expect(YAML.load(@node.to_yaml).name).to eql("mynode")
110
+ end
111
+
112
+ it "errors if name is nil" do
113
+ expect { Puppet::Node.from_data_hash({ })}.to raise_error(ArgumentError, /No name provided in serialized data/)
114
+ end
115
+
116
+ end
117
+
91
118
  describe "when converting to json" do
92
119
  before do
93
120
  @node = Puppet::Node.new("mynode")
@@ -93,7 +93,7 @@ describe Puppet::Parser::AST::HostName do
93
93
  end
94
94
 
95
95
  it "should raise an error if hostname is not valid" do
96
- expect { Puppet::Parser::AST::HostName.new( :value => "not a hostname!" ) }.to raise_error
96
+ expect { Puppet::Parser::AST::HostName.new( :value => "not a hostname!" ) }.to raise_error(Puppet::DevError, /'not a hostname!' is not a valid hostname/)
97
97
  end
98
98
 
99
99
  it "should not raise an error if hostname is a regex" do
@@ -16,6 +16,7 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
16
16
  include PuppetSpec::Scope
17
17
  before(:each) do
18
18
  Puppet[:strict_variables] = true
19
+ Puppet[:data_binding_terminus] = 'none'
19
20
 
20
21
  # Tests needs a known configuration of node/scope/compiler since it parses and evaluates
21
22
  # snippets as the compiler will evaluate them, butwithout the overhead of compiling a complete
@@ -66,6 +66,14 @@ describe Puppet::Pops::Types::TypeParser do
66
66
  expect(parser.parse("Hash[Scalar, Integer]")).to be_the_type(types.hash_of(types.integer))
67
67
  end
68
68
 
69
+ it 'interprets an Integer with one parameter to have unbounded upper range' do
70
+ expect(parser.parse('Integer[0]')).to eq(parser.parse('Integer[0,default]'))
71
+ end
72
+
73
+ it 'interprets a Float with one parameter to have unbounded upper range' do
74
+ expect(parser.parse('Float[0]')).to eq(parser.parse('Float[0,default]'))
75
+ end
76
+
69
77
  it "parses a parameterized type into the type object" do
70
78
  parameterized_array = types.array_of(types.integer)
71
79
  parameterized_hash = types.hash_of(types.integer, types.boolean)
@@ -177,6 +177,25 @@ describe "validating 4x" do
177
177
  end
178
178
  end
179
179
 
180
+ context 'for badly formed non-numeric parameter names' do
181
+ ['Ateam', 'a::team'].each do |word|
182
+ it "produces an error when $#{word} is used as a parameter in a class" do
183
+ source = "class x ($#{word}) {}"
184
+ expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_PARAM_NAME)
185
+ end
186
+
187
+ it "produces an error when $#{word} is used as a parameter in a define" do
188
+ source = "define x ($#{word}) {}"
189
+ expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_PARAM_NAME)
190
+ end
191
+
192
+ it "produces an error when $#{word} is used as a parameter in a lambda" do
193
+ source = "with() |$#{word}| {}"
194
+ expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_PARAM_NAME)
195
+ end
196
+ end
197
+ end
198
+
180
199
  context 'top level constructs in conditionals' do
181
200
  ['class', 'define', 'node'].each do |word|
182
201
  it "produces an error when $#{word} is nested in an if expression" do
@@ -230,7 +230,7 @@ describe Puppet::Property do
230
230
  it "should fail if the value is not a defined value or alias and does not match a regex" do
231
231
  subclass.newvalue(:foo)
232
232
 
233
- expect { property.should = "bar" }.to raise_error
233
+ expect { property.should = "bar" }.to raise_error(Puppet::Error, /Invalid value "bar"./)
234
234
  end
235
235
 
236
236
  it "should succeeed if the value is one of the defined values" do
@@ -84,6 +84,7 @@ describe provider_class do
84
84
  describe "when checking whether it is enabled" do
85
85
  it "should call Kernel.system() with the appropriate parameters" do
86
86
  @provider.expects(:system).with("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start").once
87
+ $CHILD_STATUS.stubs(:exitstatus).returns(0)
87
88
  @provider.enabled?
88
89
  end
89
90
 
@@ -159,6 +159,7 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
159
159
  provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
160
160
  provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true).never
161
161
  provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
162
+ $CHILD_STATUS.stubs(:exitstatus).returns 0
162
163
  provider.status
163
164
  end
164
165
 
@@ -147,10 +147,14 @@ describe Puppet::Type.type(:service).provider(:init) do
147
147
  expect(provider).to respond_to(method)
148
148
  end
149
149
  describe "when running #{method}" do
150
+ before :each do
151
+ $CHILD_STATUS.stubs(:exitstatus).returns(0)
152
+ end
150
153
 
151
154
  it "should use any provided explicit command" do
152
155
  resource[method] = "/user/specified/command"
153
156
  provider.expects(:execute).with { |command, *args| command == ["/user/specified/command"] }
157
+
154
158
  provider.send(method)
155
159
  end
156
160
 
@@ -158,6 +162,7 @@ describe Puppet::Type.type(:service).provider(:init) do
158
162
  resource[:hasrestart] = :true
159
163
  resource[:hasstatus] = :true
160
164
  provider.expects(:execute).with { |command, *args| command == ["/service/path/myservice",method]}
165
+
161
166
  provider.send(method)
162
167
  end
163
168
  end
@@ -170,6 +175,7 @@ describe Puppet::Type.type(:service).provider(:init) do
170
175
  end
171
176
  it "should execute the command" do
172
177
  provider.expects(:texecute).with(:status, ['/service/path/myservice', :status], false).returns("")
178
+ $CHILD_STATUS.stubs(:exitstatus).returns(0)
173
179
  provider.status
174
180
  end
175
181
  it "should consider the process running if the command returns 0" do
@@ -146,6 +146,7 @@ describe Puppet::Type.type(:service).provider(:openrc) do
146
146
  provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
147
147
  provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => false, :combine => true).never
148
148
  provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => false, :combine => true)
149
+ $CHILD_STATUS.stubs(:exitstatus).returns 0
149
150
  provider.status
150
151
  end
151
152
 
@@ -99,6 +99,7 @@ _EOF_
99
99
  describe "when checking if it is enabled" do
100
100
  it "should execute the lsitab command" do
101
101
  @provider.expects(:execute).with(['/usr/sbin/lsitab', 'myservice'], {:combine => true, :failonfail => false})
102
+ $CHILD_STATUS.stubs(:exitstatus).returns(0)
102
103
  @provider.enabled?
103
104
  end
104
105