Issue #3851 has been updated by Markus Roberts.

Status changed from Ready for Testing to Code Insufficient

The patch as specified above is too aggressive; it fixes the incorrect cases 
but also causes the correct cases to fail due to nested arrays.  Instead:

<pre>
diff --git a/lib/puppet/provider/service/base.rb 
b/lib/puppet/provider/service/base.rb
index 0bf2b20..183bf33 100755
--- a/lib/puppet/provider/service/base.rb
+++ b/lib/puppet/provider/service/base.rb
@@ -141,7 +141,7 @@ Puppet::Type.type(:service).provide :base do
         if c = @resource[type]
             cmd = [c]
         else
-            cmd = self.send("%scmd" % type)
+            cmd = [send("#{type}cmd")].flatten
         end
         return texecute(type, cmd, fof)
     end
</pre>

----------------------------------------
Bug #3851: "Must pass an array to execute()" error using base service provider
http://projects.puppetlabs.com/issues/3851

Author: Peter Meier
Status: Code Insufficient
Priority: Normal
Assigned to: 
Category: service
Target version: 0.25.6
Affected version: 0.25.4
Keywords: 
Branch: http://github.com/jes5199/puppet/tree/bug/master/3851


The following manifest:

<pre>
  service{'smtpd':
    ensure => running,
    provider => 'base',
    binary => '/usr/sbin/smtpd',
  }
</pre>

produces the following error:
<pre>
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:243:in `execute'
/usr/local/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:132:in 
`texecute'
/usr/local/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:146:in 
`ucommand'
/usr/local/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:86:in `start'
/usr/local/lib/ruby/site_ruby/1.8/puppet/type/service.rb:61:in `set_running'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:109:in `send'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:109:in `call_valuemethod'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:298:in `set'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:363:in `sync'
/usr/local/lib/ruby/site_ruby/1.8/puppet/type/service.rb:72:in `sync'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction/change.rb:54:in `go'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction/change.rb:72:in `forward'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:120:in `apply_changes'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:113:in `collect'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:113:in `apply_changes'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:85:in `apply'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:251:in 
`eval_children_and_apply_resource'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'
/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:250:in 
`eval_children_and_apply_resource'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:207:in `eval_resource'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:296:in `evaluate'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'
/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:295:in `evaluate'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `collect'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `evaluate'
/usr/local/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'
/usr/local/lib/ruby/site_ruby/1.8/puppet/configurer.rb:169:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark'
/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark'
/usr/local/lib/ruby/site_ruby/1.8/puppet/configurer.rb:168:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/local/lib/ruby/1.8/sync.rb:230:in `synchronize'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:134:in `with_client'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in `onetime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in `exit_on_fail'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/local/sbin/puppetd:159
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:243:in `execute'
/usr/local/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:132:in 
`texecute'
/usr/local/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:146:in 
`ucommand'
/usr/local/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:86:in `start'
/usr/local/lib/ruby/site_ruby/1.8/puppet/type/service.rb:61:in `set_running'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:109:in `send'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:109:in `call_valuemethod'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:298:in `set'
/usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:363:in `sync'
/usr/local/lib/ruby/site_ruby/1.8/puppet/type/service.rb:72:in `sync'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction/change.rb:54:in `go'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction/change.rb:72:in `forward'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:120:in `apply_changes'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:113:in `collect'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:113:in `apply_changes'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:85:in `apply'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:251:in 
`eval_children_and_apply_resource'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'
/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:250:in 
`eval_children_and_apply_resource'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:207:in `eval_resource'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:296:in `evaluate'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:418:in `thinmark'
/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:417:in `thinmark'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:295:in `evaluate'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `collect'
/usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:289:in `evaluate'
/usr/local/lib/ruby/site_ruby/1.8/puppet/resource/catalog.rb:142:in `apply'
/usr/local/lib/ruby/site_ruby/1.8/puppet/configurer.rb:169:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:178:in `benchmark'
/usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:177:in `benchmark'
/usr/local/lib/ruby/site_ruby/1.8/puppet/configurer.rb:168:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/local/lib/ruby/1.8/sync.rb:230:in `synchronize'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:53:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:134:in `with_client'
/usr/local/lib/ruby/site_ruby/1.8/puppet/agent.rb:51:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application/puppetd.rb:103:in `onetime'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `send'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:226:in `run_command'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:306:in `exit_on_fail'
/usr/local/lib/ruby/site_ruby/1.8/puppet/application.rb:217:in `run'
/usr/local/sbin/puppetd:159
err: //openbsd-smtpd::base/Service[smtpd]/ensure: change from stopped to 
running failed: Could not set running on ensure: Must pass an array to 
execute() at 
/srv/puppet/development/modules/public/openbsd-smtpd/manifests/base.pp:23
</pre>

Bugs #2552 and #2525 seem to be related, but their fixes are applied, hence we 
still have some things burdened.

The following patch on line 132 in @lib/puppet/provider/service/base.rb@ is a 
quickfix for that problem:

<pre>
-            execute(command, :failonfail => fof, :squelch => true)
+            execute([command], :failonfail => fof, :squelch => true)
</pre>

I didn't test that one enough nor did I look for other side effects. But it 
just works fine for the moment where I have currently not much time to look 
into it deeper.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to