On Thu, May 17, 2012 at 05:04:29PM -0400, Trevor Vaughan wrote:
> Sure....
>
> For the following manifest:
>
> service { 'haldaemon':
> ensure => 'running',
> enable => 'true',
> hasrestart => 'true',
> hasstatus => 'true'
> }
>
> The result is:
>
> info: /Stage[main]/Service[haldaemon]: Starting to evaluate the resource
> debug: Service[haldaemon](provider=redhat): Executing '/sbin/service
> haldaemon status'
> debug: Puppet::Type::Service::ProviderRedhat: Executing
> '/sbin/chkconfig haldaemon'
> info: /Stage[main]/Service[haldaemon]: Evaluated in 2.36 seconds
>
> For the following Ruby code:
>
> #!/usr/bin/ruby
>
> time_start = Time.now
> %x{/sbin/service haldaemon status}
> %x{/sbin/chkconfig haldaemon}
> time_end = Time.now
>
> puts "Run time is: #{time_end - time_start}"
>
> The result is:
>
> Run time is: 0.23108
>
> Now, I understand that there's more going on under the hood of Puppet, but
> that's all it *says* that it is doing and I'm not quite sure where 2 more
> seconds of time is being lost.
>
> The most interesting thing about this is that it's not consistent. One
> time, it'll be 3 seconds, then the next, a different one will take far
> longer. Very odd.
>
> Thanks,
>
> Trevor
>
Just want to mention that you are not the first one who thinks the
service type is to slow:
http://projects.puppetlabs.com/issues/13575
So if you get any more insight view feel free to update the ticket :-)
I thought that it may be because puppet will not catch the output of executed
commands directly but redirects the output to a tempfile, reads the tempfile
and then deletes the tempfile again. It even handles the fact, that the tempfile
may not be present and puppet has to wait for the file to be created. But
looking
at your output it seems that the `wait_for_output` method is not triggered in
your
case.
It may be interesting to now if the time is really lost in the execute
method or elsewhere. Maybe adding some more debug output like:
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb
index 5b5a9d7..94c7e32 100644
--- a/lib/puppet/util.rb
+++ b/lib/puppet/util.rb
@@ -365,6 +365,8 @@ module Util
str = command
end
+ Puppet.info "Start #{command} at #{Time.now}" if command =~
/\/sbin\/(chkconfig|service)/
+
if respond_to? :debug
debug "Executing '#{str}'"
else
@@ -406,6 +408,8 @@ module Util
raise ExecutionFailure, "Execution of '#{str}' returned #{exit_status}:
#{output}"
end
+ Puppet.info "Start #{command} at #{Time.now}" if command =~
/\/sbin\/(chkconfig|service)/
+
output
end
can help here?
-Stefan
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" 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-dev?hl=en.