Issue #13441 has been updated by Ken Barber.

Project changed from Puppet Labs Modules to Puppet


----------------------------------------
Bug #13441: A command that times out will not re-execute if "tries" is set.
https://projects.puppetlabs.com/issues/13441#change-62053

Author: Lars Kellogg-Stedman
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


I was expecting something like this to retry execution if the command timed out:

    exec { '/path/to/mycommand':
      tries => 2,
      timeout => 10,
    }

Unfortunately, the exception generated by a timeout resumes control outside of 
the retry loop:

        begin
          tries.times do |try|
            # Only add debug messages for tries > 1 to reduce log spam.
            debug("Exec try #{try+1}/#{tries}") if tries > 1
            @output, @status = provider.run(self.resource[:command])
            break if self.should.include?(@status.exitstatus.to_s)
            if try_sleep > 0 and tries > 1
              debug("Sleeping for #{try_sleep} seconds between tries")
              sleep try_sleep
            end
          end
        rescue Timeout::Error
          self.fail "Command exceeded timeout" % value.inspect
        end

I'm not sure how to deal with commands that may need to be retried due to 
timeouts.  Would it be possible to move the retry loop outside of the try/catch?



-- 
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