def _auth_from_available(le_client, config, domains=None, certname=None, lineage=None):
 if (lineage is None):
  (action, lineage) = _find_lineage_for_domains_and_certname(config, domains, certname)
 else:
  action = 'renew'
 if (action == 'reinstall'):
  logger.info('Keeping the existing certificate')
  return ('reinstall', lineage)
 hooks.pre_hook(config)
 try:
  if (action == 'renew'):
   logger.info('Renewing an existing certificate')
   renewal.renew_cert(config, domains, le_client, lineage)
  elif (action == 'newcert'):
   logger.info('Obtaining a new certificate')
   lineage = le_client.obtain_and_enroll_certificate(domains, certname)
   if (lineage is False):
    raise errors.Error('Certificate could not be obtained')
 finally:
  hooks.post_hook(config)
 if ((not config.dry_run) and (not (config.verb == 'renew'))):
  _report_new_cert(config, lineage.cert, lineage.fullchain)
 return (action, lineage)

def _auth_from_available ( le_client , config , domains = None , certname = None , lineage = None ) : if ( lineage is None ) : ( action , lineage ) = _find_lineage_for_domains_and_certname ( config , domains , certname ) else : action = 'renew' if ( action == 'reinstall' ) : logger . info ( 'Keeping the existing certificate' ) return ( 'reinstall' , lineage ) hooks . pre_hook ( config ) try : if ( action == 'renew' ) : logger . info ( 'Renewing an existing certificate' ) renewal . renew_cert ( config , domains , le_client , lineage ) elif ( action == 'newcert' ) : logger . info ( 'Obtaining a new certificate' ) lineage = le_client . obtain_and_enroll_certificate ( domains , certname ) if ( lineage is False ) : raise errors . Error ( 'Certificate could not be obtained' ) finally : hooks . post_hook ( config ) if ( ( not config . dry_run ) and ( not ( config . verb == 'renew' ) ) ) : _report_new_cert ( config , lineage . cert , lineage . fullchain ) return ( action , lineage )
authenticate and enroll certificate .