# File lib/puppet/sslcertificates/ca.rb, line 308
308:     def ttl
309:         days = @config[:ca_days]
310:         if days && days.size > 0
311:             warnonce "Parameter ca_ttl is not set. Using depecated ca_days instead."
312:             return @config[:ca_days] * 24 * 60 * 60
313:         else
314:             ttl = @config[:ca_ttl]
315:             if ttl.is_a?(String)
316:                 unless ttl =~ /^(\d+)(y|d|h|s)$/
317:                     raise ArgumentError, "Invalid ca_ttl #{ttl}"
318:                 end
319:                 case $2
320:                 when 'y'
321:                     unit = 365 * 24 * 60 * 60
322:                 when 'd'
323:                     unit = 24 * 60 * 60
324:                 when 'h'
325:                     unit = 60 * 60
326:                 when 's'
327:                     unit = 1
328:                 else
329:                     raise ArgumentError, "Invalid unit for ca_ttl #{ttl}"
330:                 end
331:                 return $1.to_i * unit
332:             else
333:                 return ttl
334:             end
335:         end
336:     end