File: //usr/lib64/python3.9/site-packages/rhsmlib/dbus/objects/__pycache__/syspurpose.cpython-39.pyc
a
X�Zh� � @ s� d Z ddlmZ ddlZddlZddlZddlmZmZm Z m
Z
ddlmZ ddl
mZ ddlmZ ddlmZ dd lmZ er�dd
lmZ e� e�e�ZG dd� dej�ZG d
d� dej�ZG dd� dej�ZdS )z�
This module contains implementation of D-Bus object representing system purpose.
It uses interface: com.redhat.RHSM1.Syspurpose and path:
/com/redhat/RHSM1/Syspurpose
� )�
TYPE_CHECKINGN)� constants�base_object�util�
dbus_utils)�
syspurpose)�SyspurposeStore)�init_dep_injection)� ungettext)�Locale)�
UEPConnectionc @ s2 e Zd ZdZdej ZdZdZdd� Z dd� Z
d S )
�ThreeWayMergeConflictz@
Raise this exception, when client application tries to
z%s.ErrorF�warnc C s
|| _ dS )z�
Initialize this exception
:param conflict_fields: dictionary with conflicted attributes.
The key is attribute and value is current value set on server.
N��conflict_fields)�selfr � r �E/usr/lib64/python3.9/site-packages/rhsmlib/dbus/objects/syspurpose.py�__init__2 s zThreeWayMergeConflict.__init__c C sN g }| j �� D ]\}}|�dj||d�� qd�|�}tddt|��j|d�S )zW
Text representation of exception
:return: string of exception
z%{conflict_attr} of "{existing_value}")Z
conflict_attrZexisting_valuez, zuWarning: The following field was recently set for this system by the entitlement server administrator: {conflict_msg}zwWarning: The following fields were recently set for this system by the entitlement server administrator: {conflict_msg})�conflict_msg)r �items�append�format�joinr
�len)r � conflicts�key�valuer r r r �__str__: s ��
��zThreeWayMergeConflict.__str__N)�__name__�
__module__�__qualname__�__doc__r �SYSPURPOSE_INTERFACEZ_dbus_error_nameZinclude_tracebackZseverityr r r r r r r
) s
r
c @ sF e Zd Zed�dd�Zed�dd�Zed�dd�Zeed�d d
�ZdS )�SyspurposeDBusImplementation)�returnc
C sP d}t �|�}z
|j}W n2 tyJ } zt�t|���W Y d }~n
d }~0 0 |S )Nz$/etc/rhsm/syspurpose/syspurpose.json)r �read�contents� Exception�dbus�
DBusException�str)r Zsystem_purpose_path�storer'