/usr/lib/python3/dist-packages/uaclient/api/u/pro/services/enable/__pycache__
NameSizeModeActions
v1.cpython-310.pyc73650644editdlrm
__init__.cpython-310.pyc1700644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/api/u/pro/services/enable/__pycache__/v1.cpython-310.pyc (7365B)
o Ki&@sddlZddlmZmZmZmZmZddlmZm Z m Z m Z m Z ddl mZmZmZddlmZddlmZmZddlmZddlmZdd lmZdd lmZmZmZm Z m!Z!e"e #e$Z%Gd d d eZ&Gd ddeeZ'dededej(deeej(de)deej(eeff ddZ*dedee+fddZ, d.de&deede'fddZ- d.de&dedeede'fddZ.edd e.e&d!d"Z/d#d!d$e'ej0d%fej1d&fej2d'fej3d(fej4d)fej5d*fgd+d,d-Z6dS)/N)IterableListOptionalTupleType) entitlementslockmessagesstatusutil)AbstractProgressProgressWrapper exceptions) APIEndpoint)AdditionalInfoErrorWarningObject)_enabled_services) _is_attached)UAConfig) BoolDataValue DataObjectFieldStringDataValue data_listc@sZeZdZededdededddededddgZd dd dedeede fd d Z d S) EnableOptionsservicezPro service to be enableddocvariantFz2Optional variant of the Pro service to be enabled. access_onlyz^If true and the target service supports it, only enable access to the service (default: false)N)rrcCs||_||_||_dSN)rrr)selfrrrr"G/usr/lib/python3/dist-packages/uaclient/api/u/pro/services/enable/v1.py__init__*s zEnableOptions.__init__) __name__ __module__ __qualname__rrrfieldsstrrboolr$r"r"r"r#rs0 rc @sreZdZedeeddedeeddededdedeed dgZdee dee de dee fd d Z d S) EnableResultenabledz#List of services that were enabled.rdisabledz$List of services that were disabled.reboot_requiredz?True if one of the services that was enabled requires a reboot.r zaList of information message strings about the service that was just enabled. Possibly translated.cCs||_||_||_||_dSr r,r-r.r )r!r,r-r.r r"r"r#r$Ts zEnableResult.__init__N) r%r&r'rrrrr(rr)r*r$r"r"r"r#r+6s>r+cfgprogress entitlementavailable_variantsrreturnc Csd}|D]}|||d}|dtjjkr|r|}nq|dur/|jdur/|j||d}|durc|dtjdt j j t j j |jt j jdifgt jj |jd}|t|j|jd|jidfS|dfS) N)r0rrmessage_operationmsg)r) variant_namer7)titlecodemeta)applicability_statusrApplicabilityStatus APPLICABLEvariant_auto_selectdefault_variantemitr prompt_for_confirmationr AUTO_SELECTING_VARIANTformatTxtColorBOLDr7ENDCAUTO_SELECTED_VARIANT_WARNINGrr6name) r0r1r2r3rrv_clsvwarningr"r"r#_auto_select_variantbsJ  rLcCsddt|jDS)NcSsg|]}|jqSr")rH.0sr"r"r# sz+_enabled_services_names..)renabled_servicesr0r"r"r#_enabled_services_namessrSoptionsprogress_objectcCst|t|dS)N)rU)_enabler)rTrUr"r"r#enablesrWc st|}g}tstt|jstjdkr t t |}t fddt |j Dd}|r=tggdgdStj|jjpFdjd}|\}} |j} t|tjjk|j | grvt|||| jd \}} | rv|| ||_d} d} ztjd d | |\} } Wdn1swYWnt!y}zt"|d}~ww| s| dur| j#dur| j#}nt$j%}tj&j|d t |}d d|j'(dgpgD}t)j)|d|*tt+t,t-|.t-|t+t,t-|.t-||/|d}||_0|S)z Enable a Pro service. This will automatically disable incompatible services and enable required services that that target service depends on. landscapec3s8|]}|jjkrjr|jr|jjkr|VqdSr )rHrrvariant_enabledr7rMrTr"r# s  z_enable..NFr/)r0rHrr)r0r1r2r3rzu.pro.services.enable.v1) lock_holder)rreasoncSsg|] }t|tr|qSr") isinstancer))rNr6r"r"r#rPs z_enable.. post_enablerR)1r r we_are_currently_rootrNonRootUserErrorr is_attachedUnattachedErrorr NotSupportedrSnextrrQr+rentitlement_factoryrrr;variantsallr<r= is_variantrLvaluesappendcalculate_total_enable_steps total_stepsr RetryLockrW Exceptionclear_lock_file_if_presentmessager GENERIC_UNKNOWN_ISSUEEntitlementNotEnabledError messaginggetr finishsortedlistset difference_check_for_rebootwarnings)rTr0rUr1r}enabled_services_beforealready_enabledr2 applicability_r3auto_select_warningsuccess fail_reasoner^enabled_services_afterpost_enable_messagesresultr"rZr#rVs            rVv1 EnableServiceT)versionrHfn options_clssupports_progress32zw from uaclient.api.u.pro.services.enable.v1 import enable, EnableOptions result = enable(EnableOptions(service="usg")) zWhen called as non-root userzCWhen called on a machine that is not attached to a Pro subscriptionz_When called for a service that doesn't support being enabled via API (currently only Landscape)zxWhen the service argument is not a valid Pro service name or if the variant is not a valid variant of the target servicez8When another Ubuntu Pro related operation is in progressz When the service fails to enablez3pro api u.pro.services.enable.v1 --args service=usgzp { "disabled": [], "enabled": [ "usg" ], "messages": [], "reboot_required": false } ) introduced_inrequires_networkexample_python result_classr example_cli example_jsonr )7loggingtypingrrrrruaclientrrr r r uaclient.apir r ruaclient.api.apiruaclient.api.data_typesrr-uaclient.api.u.pro.status.enabled_services.v1r(uaclient.api.u.pro.status.is_attached.v1ruaclient.configruaclient.data_typesrrrrr getLoggerreplace_top_level_logger_namer%LOGrr+ UAEntitlementr*rLr)rSrWrVendpointrbrdreEntitlementNotFoundError LockHeldErrorrt_docr"r"r"r#s     ,  /   ~