a }|g,@s dZddlZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z dd lm Z dd lm Z dd lmZdd lmZdd lmZddlmZddlmZddlmZe rddlmZd;eee eefdddZeedddZdZhelpstrdefaulting_nargsrrr _get_help_stringWs  z$CustomHelpFormatter._get_help_stringN) r8r9r:r;rActionrr<rFrrrr r=Qsr=c@s>eZdZdZdejejeee e dfe eddddZ dS)_DomainsActionz!Action class for parsing domains.N)parser namespacedomain option_stringrcCst||durt|nddS)z%Just wrap add_domains in argparseese.N) add_domainsr<)r2rIrJrKrLrrr __call__dsz_DomainsAction.__call__)N r8r9r:r;rArgumentParser Namespacer r<rrrrNrrrr rHas  rH)args_or_configdomainsrcCsNg}|s |S|dD]2}t|}||||jvr|j|q|S)aRegisters new domains to be used during the current client run. Domains are not added to the list of requested domains if they have already been registered. :param args_or_config: parsed command line arguments :type args_or_config: argparse.Namespace or configuration.NamespaceConfig :param str domain: one or more comma separated domains :returns: domains after they have been normalized and validated :rtype: `list` of `str` ,)splitr Zenforce_domain_sanitystripappendrS)rRrSZvalidated_domainsrKrrr rMks  rMcs(eZdZdZeedfdd ZZS)CaseInsensitiveListaA list that will ignore case when searching. This class is passed to the `choices` argument of `argparse.add_arguments` through the `helpful` wrapper. It is necessary due to special handling of command line arguments by `set_by_cli` in which the `type_func` is not applied.)elementrcst|tsdSt|S)NF) isinstancer<super __contains__lower)r2rY __class__rr r\s z CaseInsensitiveList.__contains__)r8r9r:r;objectboolr\ __classcell__rrr^r rXsrX)valuercCsd|vsd|vrtd|S)N()zmay not contain parentheses)rr)rcrrr _user_agent_comment_types rfc@s>eZdZdZdejejeee e dfe eddddZ dS)_EncodeReasonActionz+Action class for parsing revocation reason.N)rIrJreasonrLrcCs4|durtdtjt|}t||j|dS)z.Encodes the reason for certificate revocation.NzUnexpected null reason.) ValueErrorrZREVOCATION_REASONSr<r]setattrdest)r2rIrJrhrLcoderrr rNsz_EncodeReasonAction.__call__)NrOrrrr rgs  rg) pref_challsrcsVddddd|D}fdd|D}ddd |D}|rRtd ||S) a Translate and validate preferred challenges. :param pref_challs: list of preferred challenge types :type pref_challs: `list` of `str` :returns: validated list of preferred challenge types :rtype: `list` of `str` :raises errors.Error: if pref_challs is invalid zdns-01zhttp-01)ZdnshttpcSsg|] }|qSr)rV.0crrr z.parse_preferred_challenges..csg|]}||qSr)getroaliasesrr rrrsz, css|]}|tjjvr|VqdSr/)r Z ChallengeZTYPES)rpr"rrr s z-parse_preferred_challenges..zUnrecognized challenges: {0})joinr Errorformat)rmchallsZ unrecognizedrrur parse_preferred_challengess r|c@s>eZdZdZdejejeee e dfe eddddZ dS)_PrefChallActionz.Action class for parsing preferred challenges.N)rIrJrmrLrc Csn|durtdztt|d}Wn6tjy\}zt|t|WYd}~n d}~00|j |dS)NzUnexpected null pref_challs.rT) rir|r<rUr ryr ArgumentErrorrmextend)r2rIrJrmrLr{errorrrr rNs&z_PrefChallAction.__call__)NrOrrrr r}s  r}c@s>eZdZdZdejejeee e dfe eddddZ dS)_DeployHookActionz&Action class for parsing deploy hooks.NrIrJvaluesrLrcCs6|j|jk}|r&|j|kr&t|d||_|_dS)Nz!conflicts with --renew-hook value) deploy_hook renew_hookrr~)r2rIrJrrLZrenew_hook_setrrr rNs  z_DeployHookAction.__call__)NrOrrrr rs  rc@s>eZdZdZdejejeee e dfe eddddZ dS)_RenewHookActionz%Action class for parsing renew hooks.NrcCs.|jdu}|r$|j|kr$t|d||_dS)Nz"conflicts with --deploy-hook value)rrr~r)r2rIrJrrLZdeploy_hook_setrrr rNs  z_RenewHookAction.__call__)NrOrrrr rs  rcCs@z t|}Wnty(tdYn0|dkrsL