Skip to content
This repository has been archived by the owner on Nov 28, 2018. It is now read-only.

improve readability for puppetd agent lastrun action #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dhgwilliam
Copy link

add logic to report lastrun time in seconds, minutes or hours

@ripienaar
Copy link
Contributor

nice, would you mind opening a ticket for this? We need to track the CLA signing and stuff

thanks

@dhgwilliam
Copy link
Author

Sorry, I forgot to add this https://projects.puppetlabs.com/issues/15497

@ripienaar
Copy link
Contributor

sweet, I dont watch that project so missed it - moved it over to the right project, will review

@ripienaar
Copy link
Contributor

Would it be better to use something like this?

    def seconds_to_human(seconds)
      days = seconds.to_i / 86400
      seconds -= 86400 * days

      hours = seconds.to_i / 3600
      seconds -= 3600 * hours

      minutes = seconds.to_i / 60
      seconds -= 60 * minutes

      if days > 1
        return sprintf("%d days %02d hours %02d minutes %02d seconds", days, hours, minutes, seconds)
      elsif days == 1
        return sprintf("%d day %02d hours %02d minutes %02d seconds", days, hours, minutes, seconds)
      elsif hours > 0
        return sprintf("%d hours %02d minutes %02d seconds", hours, minutes, seconds)
      elsif minutes > 0
        return sprintf("%d minutes %02d seconds", minutes, seconds)
      else
        return sprintf("%02d seconds", seconds)
      end
    end

When updating an agent we also need to update the metadata version top of the agent and ddl files

@puppetcla
Copy link

CLA Signed by dhgwilliam on 2012-03-13 21:00:00 -0700

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants