HEX
Server: Apache
System: Linux a16-asgard6.hospedagemuolhost.com.br 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: maoristu4c3dbd03 (1436)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/lib64/python3.9/site-packages/rhsmlib/dbus/__pycache__/base_object.cpython-39.pyc
a

X�Zh��@s�ddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZm
Z
mZddlmZddlZer�ddlmZdd	lmZdd
lmZddlmZe
�e�e�ZGdd
�d
�ZGdd�dejj�Z dS)�N)�
TYPE_CHECKING)�utils)�	injection)�init_dep_injection)�	constants�
exceptions�util)�config)�BusName)�
UEPConnection)�
CPProvider)�Identityc@sReZdZdZed�dd�Zdd�dd�Zedd�d	d
�Zdeeedd
�dd�Z	dS)�BaseImplementationz�Core implementation for subscription-manager D-Bus API.

    This base class allows us to contain useful functions in one place, without
    having to duplicate the work. Individual D-Bus object implementations
    subclass this base.
    )�returncCst�tj�}|��S)zHUses the Identity class to determine if the system is registered or not.)�inj�requireZIDENTITYZis_valid)�self�identity�r�>/usr/lib64/python3.9/site-packages/rhsmlib/dbus/base_object.py�
is_registered-sz BaseImplementation.is_registeredNcCs|��st�d��dS)z8Raise a D-Bus exception if the system is not registered.zIThis object requires the consumer to be registered before it can be used.N)r�dbusZ
DBusException)rrrr�ensure_registered2s�z$BaseImplementation.ensure_registered)�
proxy_optionsrcCs,|��D]}|dvrt�d|�d���qdS)z�Ensure that the dictionary only contains keys related to proxy configuration.

        :raises exceptions.Failed: Some key is not a proxy option.
        )�proxy_hostname�
proxy_port�
proxy_user�proxy_password�no_proxyzError: z is not a valid proxy optionN)�keysrZFailed)rr�keyrrr�_validate_only_proxy_options9sz/BaseImplementation._validate_only_proxy_optionsFr)�options�
proxy_only�basic_auth_methodrcCsPt�tj���}t�tj�}|r*|�|�i}|d}|�d|d�|d<|�d|�	d��|d<|�d|d�|d<|�d|d�|d	<|�d
|�	d
��|d<|�d|d�|d
<|�d|d�|d<|�d|d�|d<|j
fi|��|�t�
��|���r|du�r|��Sd|v�rDd|v�rD|�|d|d�|��S|��SdS)z�Create a UEPConnection object.

        Takes connection options and returns appropriate connection object,
        depending on the system registration status and the options provided
        in the dictionary.
        Zserver�host�hostname�portZssl_portZhandler�prefixrZproxy_hostname_argrZproxy_port_argrZproxy_user_argrZproxy_password_argrZno_proxy_argF�username�passwordN)r	ZConfig�rhsmZget_config_parserrrZCP_PROVIDERr!�getZget_intZset_connection_infoZset_correlation_idrZgenerate_correlation_idrZget_consumer_auth_cpZ
set_user_passZget_basic_auth_cpZget_no_auth_cp)rr"r#r$ZconfZcp_providerZconnection_infoZ
server_secrrr�	build_uepBs,	
zBaseImplementation.build_uep)FF)
�__name__�
__module__�__qualname__�__doc__�boolrr�dictr!r-rrrrr%s
��rcs^eZdZdZejZejZde	dd��fdd�
Z
ejej
ddd	�ejejd
d
d����Z�ZS)�
BaseObjectz�Core implementation for subscription-manager D-Bus API.

    This base class provides a common way of publishing the individual D-Bus
    objects to the API. Individual D-Bus objects subclass this base.
    Nr
)�object_path�bus_namecs$|dur|j}t�j|||d�dS)N)�connr5r6)�default_dbus_path�super�__init__)rr7r5r6��	__class__rrr:uszBaseObject.__init__�sza{sv})Zin_signatureZ
out_signaturecCstjidd�S)a�Announce that our API does not have any properties/attributes.

        This is part of the specification:
        > If org.freedesktop.DBus.Properties.GetAll is called with a valid
        > interface name which contains no properties, an empty array should
        > be returned.
        https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties
        �sv)Z	signature)rZ
Dictionary)r�_Zsenderrrr�GetAllzszBaseObject.GetAll)NNN)N)r.r/r0r1rZINTERFACE_BASEZinterface_nameZROOT_DBUS_PATHr8�strr:rZdbus_service_methodZDBUS_PROPERTIES_INTERFACEZdbus_handle_senderZdbus_handle_exceptionsr@�
__classcell__rrr;rr4js�r4)!ZloggingZdbus.servicer�typingrZsubscription_managerrrrZ"subscription_manager.injectioninitrZrhsmlib.dbusrrrZrhsmlib.servicesr	Zrhsm.configr+r
Zrhsm.connectionrZ subscription_manager.cp_providerrZsubscription_manager.identityr
Z	getLoggerr.�logrZserviceZObjectr4rrrr�<module>s"
E