1 require 'puppet_x/certregen/util'
8 # @param cert [Puppet::SSL::Certificate]
9 # @return [Hash<Symbol, String>]
11 if cert.content.not_after < Time.now
21 :expiration_date => cert.content.not_after
25 data[:expires_in] = PuppetX::Certregen::Util.duration(cert.content.not_after - Time.now)
31 # Is this certificate expiring or expired?
33 # @param cert [Puppet::SSL::Certificate]
34 # @param percent [Integer]
35 def expiring?(cert, percent = 10)
36 remaining = cert.content.not_after - Time.now
37 lifetime = cert.content.not_after - (cert.content.not_before + 86400)
38 remaining / lifetime < (percent / 100.0)