# File lib/puppet/sslcertificates/ca.rb, line 287
287:   def ttl
288:     days = @config[:ca_days]
289:     if days && days.size > 0
290:       warnonce "Parameter ca_ttl is not set. Using depecated ca_days instead."
291:       return @config[:ca_days] * 24 * 60 * 60
292:     else
293:       ttl = @config[:ca_ttl]
294:       if ttl.is_a?(String)
295:         unless ttl =~ /^(\d+)(y|d|h|s)$/
296:           raise ArgumentError, "Invalid ca_ttl #{ttl}"
297:         end
298:         case $2
299:         when 'y'
300:           unit = 365 * 24 * 60 * 60
301:         when 'd'
302:           unit = 24 * 60 * 60
303:         when 'h'
304:           unit = 60 * 60
305:         when 's'
306:           unit = 1
307:         else
308:           raise ArgumentError, "Invalid unit for ca_ttl #{ttl}"
309:         end
310:         return $1.to_i * unit
311:       else
312:         return ttl
313:       end
314:     end
315:   end