/usr/lib/python3/dist-packages/uaclient/cli/__pycache__
NameSizeModeActions
api.cpython-310.pyc21050644editdlrm
attach.cpython-310.pyc40180644editdlrm
auto_attach.cpython-310.pyc11240644editdlrm
cli_util.cpython-310.pyc86480644editdlrm
collect_logs.cpython-310.pyc17610644editdlrm
commands.cpython-310.pyc38540644editdlrm
config.cpython-310.pyc66390644editdlrm
cve.cpython-310.pyc46180644editdlrm
cves.cpython-310.pyc31850644editdlrm
detach.cpython-310.pyc29830644editdlrm
disable.cpython-310.pyc63980644editdlrm
enable.cpython-310.pyc109110644editdlrm
fix.cpython-310.pyc205560644editdlrm
formatter.cpython-310.pyc79720644editdlrm
help.cpython-310.pyc13360644editdlrm
parser.cpython-310.pyc32940644editdlrm
refresh.cpython-310.pyc23760644editdlrm
security_status.cpython-310.pyc18530644editdlrm
status.cpython-310.pyc18640644editdlrm
system.cpython-310.pyc12430644editdlrm
__init__.cpython-310.pyc72210644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/cli/__pycache__/enable.cpython-310.pyc (10911B)
o KiAK@sddlZddlZddlmZmZmZmZmZddlm Z m Z m Z m Z m Z mZmZmZmZmZddlmZmZddlmZmZmZddlmZmZddlmZddlm Z dd l!m"Z"m#Z#m$Z$dd l%m&Z&dd l'm(Z(e)e*e+Z,ed d e-fde-fdeee.effgZ/de j0de.de-fddZ1 dFde j0de-dee j2fddZ3de j0de.deedeede.de.de.fddZ4d e-d!ee.efd"ee.d#ee.d$eee.efd%eee.efd e-fd&d'Z5de j0d(e.de.de-de-d e-d)eee.deedeed*e/fd+d,Z6e j7e j8e 9e j:d*e;fd-d.ZeejHjAd?d@d4d?dAgd?dBe"dCejId4d9gdDgdEZJdS)GN)AnyDictList NamedTupleOptional) apiconfigcontract entitlements event_logger exceptionslockmessagesstatusutil)ServiceWithDependencies _dependencies) EnableOptions EnableResult_enable)EnabledService_enabled_services) _is_attached)cli_util) ProArgumentProArgumentGroup ProCommand) HelpCategory) machine_token_EnableOneServiceResultsuccess needs_rebooterrorcfgvariant assume_yesc Cstt|}t|}t||}|s|tjdSt |j }t |j }|D]} t || j|d||d||d q'dS)NF) r#ent_namer$ access_onlyr% json_output extra_argsenabled_servicesall_dependencies)r&create_interactive_only_print_functionrget_machine_token_filer get_enabled_by_default_servicesr rNO_SERVICES_TO_AUTO_ENABLErr*rservices_enable_one_servicename) r#r$r%r(interactive_only_printmachine_token_fileservices_to_be_enabledr*r+enable_by_default_servicer75/usr/lib/python3/dist-packages/uaclient/cli/enable.py_auto_enable_services0s2    r9r'progress_objectc Cst|}tj|d||d}d}d}z tjdd|j|d\}}Wdn1s,wYWntyD}zt|d}~ww|s^|durT|j durT|j } nt j } t j d| dtdggdgd S) a Landscape gets special treatment because it currently not supported by our enable API. This function is a temporary workaround until we have a proper API for enabling landscape, which will happen after Landscape is fully integrated with the contracts backend. landscape) called_namer'r)FNzcli.enable._enable_landscape) lock_holder)progress)servicereason)enableddisabledreboot_requiredr)rProgressWrapperr LandscapeEntitlementr RetryLockenable Exceptionclear_lock_file_if_presentmessagerGENERIC_UNKNOWN_ISSUEr EntitlementNotEnabledErrorr) r#r'r)r:r>r;r fail_reasoner@r7r7r8_enable_landscapeSs>  rOr?r+r*r< service_titlecsg}g}dd|Dtfdd|Dd} | dur/fdd| jD}fdd| jD}|D]'} tj|jdd} t|| } tj j || d } | sQtj | d sXt j || d q1|D]}t||}tjj ||d } tj | d sxt j||d q[tfd d|Dd}|durdurt|}t||j}tj|jdd} tj j ||d } | stj | d st j ||d dSdSdS) NcSsg|]}|jqSr7r2.0sr7r7r8 sz2prompt_for_dependency_handling..c3s|] }|jkr|VqdSNrQrR)r?r7r8 sz1prompt_for_dependency_handling..csg|] }|jvr|jqSr7rQrRenabled_service_namesr7r8rU  csg|] }|jvr|jqSr7rQrRrXr7r8rUrZz features.block_disable_on_enable)r path_to_value)service_being_enabledincompatible_service)msg)r\required_servicec3s.|]}|jkr|jr|jkr|VqdSrVr2variant_enabled variant_namerR)r?r$r7r8rWs  )nextincompatible_with depends_onris_config_value_truer#r get_titlerINCOMPATIBLE_SERVICEformatprompt_for_confirmationr IncompatibleServiceStopsEnableREQUIRED_SERVICERequiredServiceStopsEnablerb)r#r?r+r*r<r$rPincompatible_servicesrequired_services dependenciesr]cfg_block_disable_on_enableincompatible_service_titleuser_msgr_required_service_titlerato_be_enabled_titleenabled_variant_titler7)rYr?r$r8prompt_for_dependency_handlings        rwr( json_responseprocessed_servicesfailed_serviceserrorswarningscCsb|r/|||rdnd|d<||d<||d<||d<||d<ttj|tjdd dSdS) Nr failureresultryrzr{r|T)cls sort_keys)sortprintjsondumpsrDatetimeAwareJSONEncoder)r(rxryrzr{r|r r7r7r8_print_json_outputs  rr&r)returnc  st|} tj||||d} | j| j} tfdd|Dd} | durItjj | d} | | j | tj j | dt ddd|| j | jddS|sz t ||||| d Wn-tjy}z t|| |j | tj j | dt ddddWYd}~Sd}~wwz_|rd}ntj|d }d krt||||d }n tt||d ||d}tj|d|r| tjj | dn | tjj | d|j}|r| tjj dd|jD]}| |qt d|ddWStjy$}z1|jd}|d}|d}|d}| || tj j | dt ddd||||ddWYd}~Sd}~wtjyU}z$| |j | tj j | dt ddd||j |j|jddWYd}~Sd}~ww)N)r$r'r)c3s2|]}|jkrr|jr|jkr|VqdSrVr`rR real_namer$r7r8rWs  z&_enable_one_service..)titleFr?)typer?rJ message_code)r r!r")r<r$rP)r%r;)r)r:)r?r$r')r:r#install) operationTr@coderadditional_inforr?rJrr)rr,r entitlement_factoryr2rrcrALREADY_ENABLEDrir^ ENABLE_FAILEDrrwr UbuntuProErrorLOG exceptionCLIEnableDisableProgressrOrrrACCESS_ENABLED_TMPL ENABLED_TMPLrCENABLE_REBOOT_REQUIRED_TMPLrLrmsg_code)r#r&r$r'r%r(r)r*r+r3ent ent_titlealready_enabledr^rNr> enable_resultr!rJr@err_codeerr_msgerr_infor7rr8r1s                   r1c Ksg}g}g}g}tjdd}|jdk}t|} t|dd} |j} |j} |j} | r2| r2t j ddd| r=| r=t j dd d| rH| rHt j dd d| t j z t j|dd Wn!t jt jfywtjd d d |dt jjt jjdYnwt|jst }| |j|d|j|jdt||||||dddS| rt|dd |dSt|dg}|st t||\}}t |j!}t"|j#}d }t$||D]4}t%||| | | ||&d|| }|j'r|||j(rd |d<qd}|||j)dur||j)q|r&d}||7}tj*||d}| |j|dd|j|j|j+dt ,|}|-t|||||||d|r?dSdS)z^Perform the enable action on a named entitlement. @return: 0 on success, 1 otherwise F)_schema_versionr!rr$ --access-only --variant)option1option2--auto)verbosezFailed to refresh contractT)exc_infosystem)rrJr)r )r#r$r%r(r?r)r!Nrrr).r JSON_SCHEMA_VERSIONrirr,getattrr'r%autor InvalidOptionCombinationrREFRESH_CONTRACT_ENABLEr refreshConnectivityErrorrrwarningappendE_REFRESH_CONTRACT_FAILUREr^r2ris_attached_and_contract_validContractExpiredErrorrrr9NoServicesToEnabler get_valid_entitlement_namesrr*rr0order_entitlements_for_enablingr1getr r!r"*create_enable_entitlements_not_found_errorrUAContractClientupdate_activity_token)argsr#kwargsryrzr{r|rxr(r3r$r'r%r expired_errnamesentitlements_foundentitlements_not_foundr*r+retr&r~errcontract_clientr7r7r8 action_enables                 rrGz, r)optionsstore*)helpactionnargsr store_true)rrz --assume-yes)commandrz--betaz--formatcli)defaultr)rrchoicesrr) arguments)r descriptionr help_category help_positionargument_groupsrV)Krloggingtypingrrrrruaclientrrr r r r r rrr+uaclient.api.u.pro.services.dependencies.v1rr%uaclient.api.u.pro.services.enable.v1rrr-uaclient.api.u.pro.status.enabled_services.v1rr(uaclient.api.u.pro.status.is_attached.v1r uaclient.cliruaclient.cli.commandsrrruaclient.cli.parserruaclient.filesr getLoggerreplace_top_level_logger_name__name__rboolstrrUAConfigr9AbstractProgressrOrwrr1verify_json_format_args assert_rootassert_attached&_raise_enable_disable_unattached_errorintrCLI_ROOT_ENABLECLI_ENABLE_DESC QUICKSTARTCLI_ENABLE_SERVICErijoinvalid_servicesCLI_ENABLE_ACCESS_ONLYCLI_ASSUME_YESCLI_ENABLE_AUTOCLI_ENABLE_BETACLI_FORMAT_DESCCLI_ENABLE_VARIANTenable_commandr7r7r7r8s$0       ' , \     #