def _expires(name):
 cert_file = _cert_file(name, 'cert')
 if ('tls.cert_info' in __salt__):
  expiry = __salt__['tls.cert_info'](cert_file)['not_after']
 else:
  openssl_cmd = 'openssl x509 -in {0} -noout -enddate'.format(cert_file)
  strptime_sux_cmd = 'date --date="$({0} | cut -d= -f2)" +%s'.format(openssl_cmd)
  expiry = float(__salt__['cmd.shell'](strptime_sux_cmd, output_loglevel='quiet'))
 return datetime.datetime.fromtimestamp(expiry)

def _expires ( name ) : cert_file = _cert_file ( name , 'cert' ) if ( 'tls.cert_info' in __salt__ ) : expiry = __salt__ [ 'tls.cert_info' ] ( cert_file ) [ 'not_after' ] else : openssl_cmd = 'openssl x509 -in {0} -noout -enddate' . format ( cert_file ) strptime_sux_cmd = 'date --date="$({0} | cut -d= -f2)" +%s' . format ( openssl_cmd ) expiry = float ( __salt__ [ 'cmd.shell' ] ( strptime_sux_cmd , output_loglevel = 'quiet' ) ) return datetime . datetime . fromtimestamp ( expiry )
return the expiry date of a cert :return datetime object of expiry date .