+
    ˜qgj“6  ã                   óz  a € R% t)0 t R t^ RIt^ RIt^ RIt^ RIHtHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ]! R	R
.4      tRRRR.R]RR.]! ]4      ,           /t] ^ k ]P4                  ! ]4      tRtRtR&tR R lt R R lt!R'R R llt"R'R lt#R R lt$R R lt%R R  lt&R! R" lt'R# R$ lt(R# )(z1ubuntu_pro: Configure Ubuntu Pro support servicesN)ÚAnyÚList)Úurlparse)ÚperformanceÚsubpÚutil©ÚCloud)ÚConfig)Ú
MetaSchema)ÚPER_INSTANCEzubuntu-advantageÚubuntu_advantageÚidÚcc_ubuntu_proÚdistrosÚubuntuÚ	frequencyÚactivate_by_schema_keysÚ
ubuntu_proÚREDACTEDzUUnable to determine if this is an Ubuntu Pro instance. Fallback to normal Pro attach.c                ó$   € V ^8„  d   QhR\         /# ©é   Úpro_section©Údict)Úformats   "Ú@/usr/lib/python3/dist-packages/cloudinit/config/cc_ubuntu_pro.pyÚ__annotate__r   *   s   € ÷  ñ  ¬$ñ  ó    c                 ó†  € R V 9  d   R# V R ,          p\        V\        4      '       g9   R\        V4      P                   2p\        P                  V4       \        V4      hRV9  d   R# VR,          p\        V\        4      '       g9   R\        V4      P                   2p\        P                  V4       \        V4      hR# )ÚfeaturesNz.'ubuntu_pro.features' should be a dict, not a Údisable_auto_attachzB'ubuntu_pro.features.disable_auto_attach' should be a bool, not a )Ú
isinstancer   ÚtypeÚ__name__ÚLOGÚerrorÚRuntimeErrorÚbool)r   r!   Úmsgr"   s   &   r   Úvalidate_schema_featuresr+   *   sÂ   € Ø˜Ô$Ùð ˜:Õ&€HÜ�h¤×%Ò%ðÜ�X“×'Ñ'Ð(ð*ð 	ô 	�	‰	�#ŒÜ˜3ÓÐð  HÔ,ÙØ"Ð#8Õ9ÐÜÐ)¬4×0Ò0ðÜÐ/Ó0×9Ñ9Ð:ð<ð 	ô 	�	‰	�#ŒÜ˜3ÓÐñ 1r   c                ó$   € V ^8„  d   QhR\         /# ©r   Ú
pro_configr   )r   s   "r   r   r   E   s   € ÷ $
ñ $
¬tñ $
r   c                óÀ  € . p\        V P                  4       4       Fa  w  r#V\        9  d   \        P	                  RV4       K(  Vf   K.   \        V4      pVP                  R9  d   VP                  RV 24       Ka  Kc  	  V'       d*   \        RP                  RP                  V4      4      4      hR#   \        \        3 d    TP                  RT 24        KÀ  i ; i)a›  Validate user-provided ua:config option values.

This function supplements flexible jsonschema validation with specific
value checks to aid in triage of invalid user-provided configuration.

Note: It does not log/raise config values as they could be urls containing
sensitive auth info.

@param pro_config: Dictionary of config value under 'ubuntu_pro'.

@raises: ValueError describing invalid values provided.
z4Not validating unknown ubuntu_pro.config.%s propertyNz-Expected URL scheme http/https for ua:config:zExpected a URL for ua:config:z$Invalid ubuntu_pro configuration:
{}Ú
)ÚhttpÚhttps)ÚsortedÚitemsÚKNOWN_PRO_CONFIG_PROPSr&   Úwarningr   ÚschemeÚappendÚAttributeErrorÚ
ValueErrorr   Újoin)r.   ÚerrorsÚkeyÚvalueÚ
parsed_urls   &    r   Úsupplemental_schema_validationr@   E   sÞ   € ð €FÜ˜Z×-Ñ-Ó/Ö0‰
ˆØÔ,Ô,Ü�K‰KØFØôñ ØŠ]áð	AÜ! %›ˆJØ× Ñ Ð(9Ô9Ø—‘ØCÀCÀ5ÐIöñ :ñ 1÷& ÜØ3×:Ñ:¸4¿9¹9ÀVÓ;LÓMó
ð 	
ñ øô ¤
Ð+ô 	AØ�M‰MÐ9¸#¸Ð?×@ð	Aús   Á0B4Â4%CÃCc                ó$   € V ^8„  d   QhR\         /# r-   )r   )r   s   "r   r   r   l   s   € ÷ )
ñ )
œsñ )
r   c                 ó¢  € V f   R # \        V \        4      '       g#   \        R\        V 4      P                   R24      h\        V 4       . p\        V P                  4       4       F²  w  r#R p/ pVf   \        P                  RV4       RRRV.pMpV R2p\        P                  RV4       \        P                  ! R	V4      '       d   V R
\        P                  ! V4       2pMV R
V 2pRRRV.pRVR R V.,           /p \        P                  ! V3/ VB  K´  	  V'       dR   V F  w  r«\        P'                  RW«4       K  	  \        RP)                  RP+                  R V 4       4      4      4      hR #   \        P                   dD   p\        T4      p	Te   T	P!                  T\"        4      p	TP%                  Y)34        R p?EKd  R p?ii ; i)Nz+ubuntu_pro: config should be a dict, not a z%; skipping enabling config parameterszDisabling Pro config for %sÚproÚconfigÚunsetz	=REDACTEDzEnabling Pro config %sz\sÚ=ÚsetÚ	logstringz#Failure enabling/disabling "%s":
%sz3Failure enabling/disabling Ubuntu Pro config(s): {}ú, c              3   óH   "  € T F  w  rR P                  V4      x € K  	  R# 5i)z"{}"N)r   )Ú.0ÚparamÚ_s   &  r   Ú	<genexpr>Ú!set_pro_config.<locals>.<genexpr>“   s   é € ÐM¹}±8°5˜&Ÿ-™-¨×.Ð.»}ùs   ‚ "éÿÿÿÿ)r#   r   r(   r$   r%   r@   r3   r4   r&   ÚdebugÚreÚsearchÚescaper   ÚProcessExecutionErrorÚstrÚreplacer   r8   r6   r   r;   )r.   Úenable_errorsr=   r>   Úredacted_key_valueÚsubp_kwargsÚ
config_cmdÚ	key_valueÚeÚerr_msgrL   r'   s   &           r   Úset_pro_configr_   l   sÌ  € ØÒÙÜ�j¤$×'Ò'ÜðÜ�zÓ"×+Ñ+Ð,ð -3ð3ó
ð 	
ô
 # :Ô.à€MÜ˜Z×-Ñ-Ó/Ö0‰
ˆØ!ÐØˆØŠ=Ü�I‰IÐ3°SÔ9Ø ¨7°CÐ8‰Jà$' 5¨	Ð!2ÐÜ�I‰IÐ.Ð0BÔCÜ�yŠy˜ ×&Ò&Ø"˜e 1¤R§Y¢Y¨uÓ%5Ð$6Ð7‘	à"˜e 1 U GÐ,�	Ø ¨5°)Ð<ˆJØ&¨
°3°B¨Ð;MÐ:NÕ(NÐOˆKð	1Ü�IŠI�jÑ0 KÔ0ñ! 1÷, Û)‰LˆEÜ�K‰KÐ>ÀÖMñ *äØA×HÑHØ—	‘	ÑM¹}ÓMÓMóó
ð 	
ñ øô ×)Ñ)ô 	1Ü˜!“fˆGØ!Ò-Ø!Ÿ/™/¨%´Ó:�Ø× Ñ  # ×0Ó0ûð		1ús   Ä E6Å6GÆ7G	Ç	Gc                óâ  € Vf   . pMp\        V\        4      '       d   \        P                  R4       V.pMA\        V\        4      '       g,   \        P                  R\        V4      P                  4       . pV'       d   RRRV .pMRRV .pVRR \        .,           p\        P                  RRP                  V4      4        \        P                  ! V^ ^0VR	7       T'       g   R# . ROT,           p \        P                  ! TR^ ^0R7      w  r‰ \         P"                  ! T4      p
. pT
P'                  R. 4       FA  pTR,          R8X  d    \        P                  RTR,          4       K0  TP)                  T4       KC  	  T'       d”   . pT Fj  pTP'                  R4      pTe"   TP)                  T4       RT RTR,           2pMRTR,           RTR,           2p\        P                  ! \        T4       Kl  	  \        RRP                  T4      ,           4      hR#   \        P                   dQ   p\        T4      P                  T \        4      pR
T 2p\        P                  ! \        T4       \        T4      ThRp?ii ; i  \        P                   d(   p\        RRP                  T4      ,           4      ThRp?ii ; i  \         P$                   d   p\        RT 24      ThRp?ii ; i)z=Call ua command line client to attach and/or enable services.NzNubuntu_pro: enable should be a list, not a string; treating as a single enablezIubuntu_pro: enable should be a list, not a %s; skipping enabling servicesrC   Úattachz--no-auto-enablezAttaching to Ubuntu Pro. %sÚ )ÚrcsrH   zFailure attaching Ubuntu Pro:
T)Úcapturerc   z!Error while enabling service(s): rI   zPro response was not json: r<   Úmessage_codezservice-already-enabledzService `%s` already enabled.ÚservicezFailure enabling `z`: ÚmessagezFailure of type `r$   z(Failure enabling Ubuntu Pro service(s): rP   )rC   Úenablez--assume-yesz--formatÚjson)r#   rV   r&   r6   Úlistr$   r%   r   rQ   r;   r   rU   rW   r   Úlogexcr(   ri   ÚloadsÚJSONDecodeErrorÚgetr8   )Útokenrh   Ú
attach_cmdÚredacted_cmdr]   Úerr*   ÚcmdÚenable_stdoutrM   Úenable_resprX   ÚerrÚerror_servicesrf   s   &&             r   Úconfigure_prorx   ˜   s´  € à‚~Ø‰Ü	�FœC×	 Ò	 Ü�‰ð5ô	
ð �‰Ü˜¤×%Ò%Ü�‰ð0ä�‹L×!Ñ!ô	
ð
 ˆ÷ Ø˜XÐ'9¸5ÐA‰
à˜X uÐ-ˆ
Ø˜c˜r�?¤h ZÕ/€LÜ‡I�IÐ+¨S¯X©X°lÓ-CÔDð'ä�	Š	�* 1 a &°LÕA÷ ÙÚ
?À&Õ
H€CðÜŸ9š9 S°$¸QÀ¸FÔCÑˆðÜ—j’j Ó/ˆð< !#€MØ�‰˜x¨Ö,ˆØˆ~ÕÐ";Ô;Ü�I‰IÐ5°s¸9µ~ÔFÙØ×Ñ˜SÖ!ñ	 -÷ Ø$&ˆÛ ˆCØ—g‘g˜iÓ(ˆGØÒ"Ø×%Ñ% gÔ.Ø*¨7¨)°3°s¸9µ~Ð6FÐG‘à)¨#¨f­+¨°c¸#¸i½.Ð9IÐJ�Ü�KŠKœ˜SÖ!ñ !ô Ø6Ø�i‰i˜Ó'õ(ó
ð 	
ñ øôo ×%Ñ%ô 'Ü�‹V�^‰^˜E¤8Ó,ˆØ/°¨tÐ4ˆÜ�Š”C˜ÔÜ˜3Ó QÐ&ûð	'ûô ×%Ñ%ô ÜØ/°$·)±)¸FÓ2CÕCó
àð	ûðûô ×Ñô ÜØ)¨-¨Ð9ó
àð	ûðúsI   ÃH Ã4J ÄK ÈJÈ3AI>É>JÊKÊ"J=Ê=KËK.ËK)Ë)K.c                ó$   € V ^8„  d   QhR\         /# )r   Úcloudr   )r   s   "r   r   r   ü   s   € ÷ ñ ¤%ñ r   c                ó^  € \         P                  ! R4      '       d   R#  V P                  P                  4         T P                  P                  R.4       R#   \         d    \
        P                  ! \        R4       h i ; i  \         d    \
        P                  ! \        R4       h i ; i)z.Install ubuntu-advantage-tools if not present.rC   NzPackage update failedzubuntu-advantage-toolsz(Failed to install ubuntu-advantage-tools)	r   ÚwhichÚdistroÚupdate_package_sourcesÚ	Exceptionr   rk   r&   Úinstall_packages)rz   s   &r   Úmaybe_install_ua_toolsr�   ü   s‰   € ä‡z‚z�%×ÒÙðØ�‰×+Ñ+Ô-ðØ�‰×%Ñ%Ð'?Ð&@ÖAøô	 ô Ü�Š”CÐ0Ô1Øðûô
 ô Ü�Š”CÐCÔDØðús    A »B Á(BÂ(B,c                ó0   € V ^8„  d   QhR\         R\        /# )r   r   Úreturn)r   r)   )r   s   "r   r   r     s   € ÷ %ñ %¤Tð %¬dñ %r   c                 óÂ  € \        V P                  R / 4      P                  RR4      4      pV'       d   R# ^ RIHp ^ RIHp  \        P                  ! RRR7      ;_uu_ 4        V! 4       pRRR4       VP
                  #   + '       g   i     XP
                  # ; i  T d;   p\        P                  R	T4       \        P                  \        4        Rp?R# Rp?ii ; i)
r!   r"   F)ÚUserFacingError)Úshould_auto_attachz6Checking if the instance can be attached to Ubuntu ProÚalways©Úlog_modeNz%Error during `should_auto_attach`: %s)r)   rn   Úuaclient.api.exceptionsr…   Ú4uaclient.api.u.pro.attach.auto.should_auto_attach.v1r†   r   ÚTimedr&   rQ   r6   ÚERROR_MSG_SHOULD_AUTO_ATTACH)r   r"   r…   r†   ÚresultÚexs   &     r   Ú_should_auto_attachr�     s¿   € ÜØ�‰˜
 BÓ'×+Ñ+Ð,AÀ5ÓIóÐ÷ Ùõ 8õð	Ü×ÒØDØ÷
ö 
ñ (Ó)ˆF÷	
ð ×$Ñ$Ð$÷
ö 
ð ×$Ñ$Ð$ûð	 ô Ü�	‰	Ð9¸2Ô>Ü�‰Ô0Ô1Ýûðús6   Á B Á#A?Á+B Á?B	Â
B ÂB ÂCÂ$/CÃCc                ó$   € V ^8„  d   QhR\         /# r   r   )r   s   "r   r   r   (  s   € ÷ Añ Aœñ Ar   c                 ó.  € V P                  R 4      pV'       g#   Rp\        P                  V4       \        V4      hV P                  R4      pV'       d&   \        P	                  RRP                  V4      4       \        WP                  R4      R7       R# )ro   z8`ubuntu_pro.token` required in non-Pro Ubuntu instances.Úenable_betaz<Ignoring `ubuntu_pro.enable_beta` services in Pro attach: %srI   rh   )ro   rh   N)rn   r&   r'   r(   rQ   r;   rx   )r   ro   r*   r“   s   &   r   Ú_attachr”   (  sm   € Ø�O‰O˜GÓ$€EßØHˆÜ�	‰	�#ŒÜ˜3ÓÐØ—/‘/ -Ó0€KßÜ�	‰	ØJØ�I‰I�kÓ"ô	
ô ˜§o¡o°hÓ&?×@r   c                ó$   € V ^8„  d   QhR\         /# r   r   )r   s   "r   r   r   7  s   € ÷ (ñ (œdñ (r   c                 óÜ  € ^ RI HpHp ^ RIHpHp V P                  R4      pV P                  R4      pV! VVR7      p \        P                  ! RRR7      ;_uu_ 4        V! VR	7       R
R
R
4       R
#   + '       g   i     R
# ; i  T d%    Tf   Te   \        P                  R4        R
#  R
# T d6   pRTP                   2p	\        P                  T	4       \        T	4      ThR
p?ii ; i)é    )ÚAlreadyAttachedErrorr…   )ÚFullAutoAttachOptionsÚfull_auto_attachrh   r“   )rh   r“   zAttaching to Ubuntu Pror‡   rˆ   )ÚoptionsNzŠThe instance is already attached to Pro. Leaving enabled services untouched. Ignoring config directives ubuntu_pro: enable and enable_betaz!Error during `full_auto_attach`: )rŠ   r˜   r…   Ú2uaclient.api.u.pro.attach.auto.full_auto_attach.v1r™   rš   rn   r   rŒ   r&   r6   r*   r'   r(   )
r   r˜   r…   r™   rš   rh   r“   r›   r�   r*   s
   &         r   Ú_auto_attachr�   7  sÎ   € ÷ N÷ð �_‰_˜XÓ&€FØ—/‘/ -Ó0€KÙ#ØØô€Gð(Ü×ÒÐ8À8×LÖLÙ WÕ-÷ M×L×LÒLûàô ØÒ" fÒ&8ä�K‰Kð6÷ò '9ð ô (Ø1°"·&±&°Ð:ˆÜ�	‰	�#ŒÜ˜3Ó RÐ'ûð(úsA   ¾ B Á
A2Á(B Á2B	Á=B ÂB Â$C+Â0C+Â5C+Â60C&Ã&C+c          
      óL   € V ^8„  d   QhR\         R\        R\        R\        RR/# )r   ÚnameÚcfgrz   Úargsrƒ   N)rV   r
   r	   rj   )r   s   "r   r   r   Y  s6   € ÷ Bñ B”ð Bœ6ð B¬%ð B´tð BÀñ Br   c                 ó¼  € R p\        \        P                  V4      4      pV'       df   \        V4      ^8”  d"   \	        RRP                  V4      ,          4      h\        P                  RRP                  V4      4       W^ ,          ,          pRV9   d/   V'       d   \        P                  RV^ ,          4       VR,          pVf   \        P                  RV 4       R # \        V\        4      '       g9   R\        V4      P                   2p\        P                  V4       \	        V4      hRV9   d#   R	p\        P                  V4       \	        V4      h\        V4       \        VP!                  R
4      4       \#        V4       \        P                  R4       \%        V4      '       d   \'        V4       R # VP)                  4       R08:  g   \+        V4       R # R # )NzLUnable to configure Ubuntu Pro. Multiple deprecated config keys provided: %srI   z^Deprecated configuration key(s) provided: %s. Expected "ubuntu_pro"; will attempt to continue.r   z;Ignoring deprecated key %s and preferring ubuntu_pro configz=Skipping module named %s, no 'ubuntu_pro' configuration foundz%'ubuntu_pro' should be a dict, not a ÚcommandszPDeprecated configuration "ubuntu-advantage: commands" provided. Expected "token"rD   zETo discover more log info, please check /var/log/ubuntu-advantage.logr!   )rj   ÚDEPRECATED_KEYSÚintersectionÚlenr(   r;   r&   r6   rQ   r#   r   r$   r%   r'   r�   r_   rn   r+   r�   r�   Úkeysr”   )rŸ   r    rz   r¡   r   Ú
deprecatedr*   s   &&&&   r   Úhandler©   Y  sž  € Ø€KÜ”o×2Ñ2°3Ó7Ó8€JßÜˆz‹?˜QÔÜð%Ø'+§y¡y°Ó'<õ=óð ô 	�‰ð@à�I‰I�jÓ!ô	
ð
  Q�-Õ(ˆØ�sÔçÜ�K‰KØMØ˜1•ôð ˜,Õ'ˆØÒÜ�	‰	ØKØô	
ñ 	Ü˜¤T×*Ò*ðÜ�[Ó!×*Ñ*Ð+ð-ð 	ô 	�	‰	�#ŒÜ˜3ÓÐØ�[Ô ð ð 	ô 	�	‰	�#ŒÜ˜3ÓÐä˜5Ô!Ü�;—?‘? 8Ó,Ô-ô ˜[Ô)Ü‡I�IØOôô ˜;×'Ò'Ü�[Ö!ð ×ÑÓ J <Ô/Ü�Öñ 0r   c                ó@   € V ^8„  d   Qh/ ^ \         9   d
   \        ;R&   # )r   Úmeta)Ú__conditional_annotations__r   )r   s   "r   r   r      s   € × 7Ñ 7÷ ò „jñ ò! 8r   )Ú
http_proxyÚhttps_proxyÚglobal_apt_http_proxyÚglobal_apt_https_proxyÚua_apt_http_proxyÚua_apt_https_proxy)N)*r¬   Ú__doc__ri   ÚloggingrR   Útypingr   r   Úurllib.parser   Ú	cloudinitr   r   r   Úcloudinit.cloudr	   Úcloudinit.configr
   Úcloudinit.config.schemar   Úcloudinit.settingsr   rG   r¤   rj   r«   Ú	getLoggerr%   r&   r   r�   r5   r+   r@   r_   rx   r�   r�   r”   r�   r©   r   )r¬   s   @r   Ú<module>r½      sÊ   øðö 8ã Û Û 	ß Ý !ç -Ñ -Ý !Ý #Ý .Ý +áÐ)Ð+=Ð>Ó?€ð 	ˆ/Ø�ˆzØ�Ø ˜~±°_Ó0EÕEð	€ó ð ×Ò˜Ó!€Ø€ð&ð ðÐ õ õ6$
÷N)
ôXa
õHõ %õ8Aõ(÷DBr   