File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/inspectlib/__pycache__/kiwiproc.cpython-310.pyc
Back
o ;jS � @ s� d dl Z d dlZd dlZd dlmZ d dlZd dlmZ z d dl Z d dl Z W n ey/ Y nw zd dlm Z W n eyJ d dlm mZ Y nw G dd� d�ZdS )� N)�minidom)�InspectorKiwiProcessorException)�etreec @ sh e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� ZdS )�KiwiExporterz; Exports system description as Kiwi configuration. c C s$ || _ || _tddi �| _d | _d S )N�data� )� __grains__�format�type�_data�name)�selfZgrainsr r r �T/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/inspectlib/kiwiproc.py�__init__* s zKiwiExporter.__init__c K s$ |� � D ]\}}t| j||� q| S )zK Load data by keys. :param data: :return: )�items�setattrr )r �descr�objr r r r �load0 s zKiwiExporter.loadc C sr || _ | �� }| �|� | �|� | �|� | �|� | �|� d�dd� t� t j|dd��jdd�� d�D ��S )zJ Export to the Kiwi config.xml as text. :return: � c S s g | ]}|� � r|�qS r )�strip)�.0�liner r r � <listcomp>L s ��z'KiwiExporter.export.<locals>.<listcomp>zUTF-8)�encodingz )�indent)r �_create_doc�_set_description�_set_preferences�_set_repositories� _set_users� _set_packages�joinr ZparseStringr ZtostringZtoprettyxml�split)r r �rootr r r �export<