+
    miAK                     r   ^ RI t ^ RIt^ RIHtHtHtHtHt ^ RIH	t	H
t
HtHtHtHtHtHtHtHt ^ RIHtHt ^ RIHtHtHt ^ RIHtHt ^ RIHt ^ RIH t  ^ R	I!H"t"H#t#H$t$ ^ R
I%H&t& ^ RI'H(t( ]PR                  ! ]PT                  ! ]+4      4      t,]! RR]-3R]-3R]]].]3,          ,          3.4      t/R R lt0R3R R llt1R R lt2R R lt3R R lt4] Pj                  ] Pl                  ] Pn                  ! ] Pp                  4      R R l4       4       4       t9]$! R]Pt                  ]Pv                  ]9]&Px                  ^]#! ]"! R]Pz                  P}                  RP                  ]P                  ! ]
P                  ! 4       R7      4      R 7      R!R"R#7      ]"! R$]P                  R%R&7      ]"! R']P                  P}                  RR(7      R%R&7      ]"! R)]P                  R%R&7      ]"! R*]P                  R%R&7      ]"! R+]P                  P}                  R,R-7      R!R,R..R,R/7      ]"! R0]P                  R!R&7      .R17      .R27      tHR# )4    N)AnyDictList
NamedTupleOptional)
apiconfigcontractentitlementsevent_logger
exceptionslockmessagesstatusutil)ServiceWithDependencies_dependencies)EnableOptionsEnableResult_enable)EnabledService_enabled_services)_is_attached)cli_util)ProArgumentProArgumentGroup
ProCommand)HelpCategory)machine_token_EnableOneServiceResultsuccessneeds_rebooterrorc                P    V ^8  d   QhR\         P                  R\        R\        /# )   cfgvariant
assume_yes)r	   UAConfigstrbool)formats   "5/usr/lib/python3/dist-packages/uaclient/cli/enable.py__annotate__r.   0   s*      
  
	 
 
  
    c                    \         P                  ! V4      p\        P                  ! V 4      p\        P
                  ! WP                  4       4      pV'       g   V! \        P                  4       R # \        V 4      P                  p\        V 4      P                  pV F!  p	\        V V	P                  VRVVR VVR7	       K#  	  R # )NF)	r&   ent_namer'   access_onlyr(   json_output
extra_argsenabled_servicesall_dependencies)r   &create_interactive_only_print_functionr   get_machine_token_filer
   get_enabled_by_default_servicesr   r   NO_SERVICES_TO_AUTO_ENABLEr   r5   r   services_enable_one_servicename)
r&   r'   r(   r3   interactive_only_printmachine_token_fileservices_to_be_enabledr5   r6   enable_by_default_services
   &&&&      r-   _auto_enable_servicesrB   0   s     &LL '==cB%EE,,. "xBBC(->>$S)22%;!.33!#--
	
 &<r/   c                z    V ^8  d   QhR\         P                  R\        R\        \        P
                  ,          /# )r%   r&   r2   progress_object)r	   r)   r+   r   r   AbstractProgress)r,   s   "r-   r.   r.   S   s5     ) )	)) c223	)r/   c                   \         P                  ! V4      p\        P                  ! V RVVR7      pRpRp \        P
                  ! RR7      ;_uu_ 4        VP                  VR7      w  rgRRR4       T'       gH   Te   TP                  e   TP                  p	M\        P                  p	\        P                  ! RT	R7      h\        R.. R. R	7      #   + '       g   i     Lo; i  \         d   p\        P                  ! 4        ThRp?ii ; i)
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_namer2   r4   FNzcli.enable._enable_landscape)lock_holder)progress)servicereason)enableddisabledreboot_requiredr   )r   ProgressWrapperr   LandscapeEntitlementr   	RetryLockenable	Exceptionclear_lock_file_if_presentmessager   GENERIC_UNKNOWN_ISSUEr   EntitlementNotEnabledErrorr   )
r&   r2   r4   rD   rJ   rG   r!   fail_reasonerL   s
   &&&&      r-   _enable_landscaper[   S   s     ""?3H11	I GK^^6
 
 $-#3#3X#3#F G
 "{':':'F ((F33F33
 	
 EB !
 
  '')s5   C$ C*C$ C!	C$ !C$ $D/DDc                    V ^8  d   QhR\         P                  R\        R\        \        ,          R\        \
        ,          R\        R\        R\        /# )r%   r&   rK   r6   r5   rH   r'   service_title)r	   r)   r*   r   r   r   )r,   s   "r-   r.   r.      sf     Y Y	YY 23Y >*	Y
 Y Y Yr/   c                 \  aa . p. pV U	u. uF  qP                   NK  	  p
p	\        V3R  lV 4       R4      pVeq   VP                   U	u. uF"  p	V	P                   V
9   g   K  V	P                   NK$  	  pp	VP                   U	u. uF"  p	V	P                   V
9  g   K  V	P                   NK$  	  pp	V F  p\        P
                  ! V P                  RR7      p\        P                  ! W4      p\        P                  P                  VVR7      pV'       g    \        P                  ! VR7      '       d   K  \        P                  ! VVR7      h	  V Fp  p\        P                  ! V V4      p\        P                  P                  VVR7      p\        P                  ! VR7      '       d   KZ  \        P                   ! VVR7      h	  \        VV3R lV 4       R4      pVe   Se   \        P                  ! V SS4      p\        P                  ! V SVP"                  4      p\        P
                  ! V P                  RR7      p\        P                  P                  VVR7      pV'       g   \        P                  ! VR7      '       g   \        P                  ! VVR7      hR# R# R# u up	i u up	i u up	i )c              3   L   <"   T F  qP                   S8X  g   K  Vx  K  	  R # 5iN)r=   ).0srK   s   & r-   	<genexpr>1prompt_for_dependency_handling.<locals>.<genexpr>   s     :$q'(9$s   $
$Nz features.block_disable_on_enable)r	   path_to_value)service_being_enabledincompatible_service)msg)rf   required_servicec              3      <"   T FA  pVP                   S8X  g   K  VP                  '       g   K*  VP                  S8w  g   K=  Vx  KC  	  R # 5ir`   r=   variant_enabledvariant_name)ra   rb   rK   r'   s   & r-   rc   rd      sI      	
%vv   !!  ')	 A%s   AAA
A)r=   nextincompatible_with
depends_onr   is_config_value_truer&   r   	get_titler   INCOMPATIBLE_SERVICEr,   prompt_for_confirmationr   IncompatibleServiceStopsEnableREQUIRED_SERVICERequiredServiceStopsEnablerm   )r&   rK   r6   r5   rH   r'   r]   incompatible_servicesrequired_servicesrb   enabled_service_namesdependenciesrg   cfg_block_disable_on_enableincompatible_service_titleuser_msgri   required_service_titlerl   to_be_enabled_titleenabled_variant_titles   &f&&&f&              r-   prompt_for_dependency_handlingr      s    -=>-=VV-=>:$:DL  "33!
3vv.. AFF3 	 !
 ",,
,vv22 AFF, 	 
 !6&*&?&?77<'
# &2%;%;&
" 0077"/!; 8 
 'd.J.J/
 /
 ;;&3%?  !6( .!-!7!7=M!N,,33"/3 4 
 ++9977&3!7  . 	
%	
 		O "w':*44S'7K , 6 6/66!
 '+&?&?77<'
# 0077"5!6 8 
 'd.J.J/
 /
 ;;&9%: /
 (;"w ?!


s   J	J$!J$J)J)c                *   V ^8  d   QhR\         R\        \        \        3,          R\        \        ,          R\        \        ,          R\        \        \        \        3,          ,          R\        \        \        \        3,          ,          R\         /# )r%   r3   json_responseprocessed_servicesfailed_serviceserrorswarningsr!   )r+   r   r*   r   r   )r,   s   "r-   r.   r.      sx     
 

S>
 S	
 #Y	

 c3h 
 4S>"
 
r/   c                     V '       dr   VP                  4        VP                  4        V'       d   R MRVR&   W!R&   W1R&   WAR&   WQR&   \        \        P                  ! V\        P
                  RR7      4       R	# R	# )
r!   failureresultr   r   r   r   T)cls	sort_keysN)sortprintjsondumpsr   DatetimeAwareJSONEncoder)r3   r   r   r   r   r   r!   s   &&&&&&&r-   _print_json_outputr      sw     !/6)Ih.@*++:'("(h$,j!JJ11	
 r/   c                    V ^8  d   QhR\         P                  R\        R\        R\        R\        R\        R\        \
        \        ,          ,          R\
        \        ,          R	\
        \        ,          R
\        /
# )r%   r&   r1   r'   r2   r(   r3   r4   r5   r6   return)	r	   r)   r*   r+   r   r   r   r   r    )r,   s   "r-   r.   r.      s     _
 _
	_
_
 _
 	_

 _
 _
 c#_
 >*_
 23_
 _
r/   c	                   aa \         P                  ! V4      p	\        P                  ! V VSVVR 7      p
V
P                  oV
P
                  p\        VV3R lV 4       R4      pVe   \        P                  P                  VR7      pV	! VP                  4       V	! \        P                  P                  VR7      4       \        RRRRRVRVP                  RVP                  /R	7      # V'       g    \        V SVVVSVR
7        V'       d   RpM\         P$                  ! VR7      pSR8X  d   \'        V VVVR7      pM\)        \+        VSVR7      V VR7      p\,        P,                  ! V R7       V'       d(   V	! \        P.                  P                  VR7      4       M&V	! \        P0                  P                  VR7      4       VP2                  pV'       d'   V	! \        P4                  P                  RR7      4       VP                   F  pV	! V4       K  	  \        RVRR	7      #   \        P                   df   p\         P#                  T4       T	! TP                  4       T	! \        P                  P                  TR7      4       \        RRRR	7      u Rp?# Rp?ii ; i  \        P6                   d   pTP8                  R,          pTR,          pTR,          pTR,          pT	! T4       T	! \        P                  P                  TR7      4       \        RRRRRTRTRTRT/R	7      u Rp?# Rp?i\        P                   dy   pT	! TP                  4       T	! \        P                  P                  TR7      4       \        RRRRRTRTP                  RTP:                  RTP8                  /R	7      u Rp?# Rp?ii ; i))r'   r2   r4   c              3      <"   T FI  pVP                   S8X  g   K  S'       d(   VP                  '       g   K2  VP                  S8X  g   KE  Vx  KK  	  R # 5ir`   rk   )ra   rb   	real_namer'   s   & r-   rc   &_enable_one_service.<locals>.<genexpr>  sL      	
%vv"  %% 
 +,..G*C A%s   AAAA

AN)titleFtyperK   rV   message_code)r!   r"   r#   )rH   r'   r]   )r(   rG   )r4   rD   )rK   r'   r2   )rD   r&   install)	operationTrL   coder   additional_info)r   r7   r   entitlement_factoryr=   r   rn   r   ALREADY_ENABLEDr,   rh   ENABLE_FAILEDr    r   r   UbuntuProErrorLOG	exceptionCLIEnableDisableProgressr[   r   r   r   ACCESS_ENABLED_TMPLENABLED_TMPLrO   ENABLE_REBOOT_REQUIRED_TMPLrX   r   msg_code)r&   r1   r'   r2   r(   r3   r4   r5   r6   r>   ent	ent_titlealready_enabledrh   rZ   rJ   enable_resultr"   rV   rL   err_codeerr_msgerr_infor   s   &&f&&&&&&              @r-   r<   r<      s    &LL 
*
*C I		I	
%	
 	O "&&--I->sww'x55<<9<MN&	8377		
 		
 	*  $'*S
H88JOH#-% (	M $$# +
  (M 	#",,33)3D #%%,,9,= %44"44;;' <  %--G"7+ . '%
 	
u (( 
	MM!"155)"&&--I-> +" 
	@ 00 
""8,&>/+,w'x55<<9<MN&	87!8

 
	
 $$ 
quu%x55<<9<MN&	8155

!1#4#4

 
	

sl   2H' J$ A)J$ 7A J$ AJ$ 'J!<AJJ!J!$O9A3L2,O2O	O
A-N=7O=Oc                $    V ^8  d   QhR\         /# )r%   r   )int)r,   s   "r-   r.   r.     s     Y YS Yr/   c               B   . p. p. p. pR\         P                  RR/pV P                  R8H  p\        P                  ! V4      p	\        V RR4      p
V P                  pV P                  pV P                  pV
'       d!   V'       d   \        P                  ! RRR	7      hV
'       d!   V'       d   \        P                  ! RR
R	7      hV'       d!   V'       d   \        P                  ! RR
R	7      hV	! \        P                  4        \        P                  ! VRR7       \/        V4      P0                  '       gg   \        P2                  ! 4       pV	! VP*                  4       VP'                  RRRVP*                  RVP4                  /4       \7        VVVVVVRR7       ^# V'       d   \9        VRRVR7      # \        V R. 4      pV'       g   \        P:                  ! 4       h\<        P>                  ! W4      w  pp\A        V4      PB                  p\E        V4      PF                  pRp\<        PH                  ! VV4       F  p\K        VVV
VVVVPM                  R4      VV4	      pVPN                  '       d-   VP'                  V4       VPP                  '       d   RVR&   Ka  Kc  RpVP'                  V4       VPR                  f   K  VP'                  VPR                  4       K  	  V'       do   RpVV,          p\<        PT                  ! VVR7      pV	! VP*                  4       VP'                  RRRRRVP*                  RVP4                  RVPV                  /4       \        PX                  ! V4      pVP[                  4        \7        VVVVVVVR7       V'       d   ^ # ^#   \        P                  \        P                   3 dc    \"        P%                  RRR7       TP'                  RRR\        P(                  P*                  R\        P(                  P,                  /4        ELi ; i)zVPerform the enable action on a named entitlement.

@return: 0 on success, 1 otherwise
_schema_versionr"   Fr   r'    --access-only	--variant)option1option2--auto)verbosezFailed to refresh contractT)exc_infor   systemrV   r   )r!   )r&   r'   r(   r3   rK   r4   Nr   r   ).r   JSON_SCHEMA_VERSIONr,   r   r7   getattrr2   r(   autor   InvalidOptionCombinationr   REFRESH_CONTRACT_ENABLEr
   refreshConnectivityErrorr   r   warningappendE_REFRESH_CONTRACT_FAILURErh   r=   r   is_attached_and_contract_validContractExpiredErrorr   r   rB   NoServicesToEnabler   get_valid_entitlement_namesr   r5   r   r;   order_entitlements_for_enablingr<   getr!   r"   r#   *create_enable_entitlements_not_found_errorr   UAContractClientupdate_activity_token)argsr&   kwargsr   r   r   r   r   r3   r>   r'   r2   r(   r   expired_errnamesentitlements_foundentitlements_not_foundr5   r6   retr1   r   errcontract_clients   &$,                      r-   action_enabler     s    OFH 	<;;M
 ++'K
 &LL dIr*G""KJ99D;11#[
 	
 411
 	
 t11#X
 	
 8;;<
e, ;;; 557{/;?? 4 4	
 		
 $#	
 	
 D)R(E++--
 	00<(->>$S)22
C @@ %JJ|$

 >>>%%h/"""04n- # C""8,||'fll+-0 11EE"
 	sww'4377!3#6#6	
 //4O))+ 1U ((**C*CD 	
04@8>>BB C C H H	
	
s   N BPPrS   rK   z, r   )optionsstore*)helpactionnargsr   
store_true)r   r   z--assume-yes)commandr   z--betaz--formatcli)defaultr   )r   r   choicesr   r   )	arguments)r   descriptionr   help_categoryhelp_positionargument_groupsr`   )Ir   loggingtypingr   r   r   r   r   uaclientr   r	   r
   r   r   r   r   r   r   r   +uaclient.api.u.pro.services.dependencies.v1r   r   %uaclient.api.u.pro.services.enable.v1r   r   r   -uaclient.api.u.pro.status.enabled_services.v1r   r   (uaclient.api.u.pro.status.is_attached.v1r   uaclient.clir   uaclient.cli.commandsr   r   r   uaclient.cli.parserr   uaclient.filesr   	getLoggerreplace_top_level_logger_name__name__r   r+   r*   r    rB   r[   r   r   r<   verify_json_format_argsassert_rootassert_attached&_raise_enable_disable_unattached_errorr   CLI_ROOT_ENABLECLI_ENABLE_DESC
QUICKSTARTCLI_ENABLE_SERVICEr,   joinvalid_servicesr)   CLI_ENABLE_ACCESS_ONLYCLI_ASSUME_YESCLI_ENABLE_AUTOCLI_ENABLE_BETACLI_FORMAT_DESCCLI_ENABLE_VARIANTenable_command r/   r-   <module>r     sL     8 8   
 B ! K K , (::8DE$	D		(4S>*+  
F)XYx
8_
D 
!!		(IIJY K  "Yx 		!	!(())!44;; $		(77FOO<MN! < 
 #	 #!88'
 "!00777I'
 !11'
 !11'
 !11888G""FO! !44"M+-	
/7r/   