File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/ilo.cpython-310.pyc
o
�N�g�? � @ s� d Z ddlZddlZddlZddlm mZ ddlZ e�
e�Zdd� Z
dd� Zdd� Zd3d
d�Zd4d
d�Zdd� Zdd� Zd5dd�Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Z d.d/� Z!d6d1d2�Z"dS )7zO
Manage HP ILO
:depends: hponcfg (SmartStart Scripting Toolkit Linux Edition)
� Nc C s t jj�d�r dS dS )z.
Make sure hponcfg tool is accessible
ZhponcfgT)FzGilo execution module not loaded: the hponcfg binary is not in the path.)�salt�utils�path�which� r r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/ilo.py�__virtual__ s r c C s� | � dd�i i}d}tj�td d�}tj�|�st�|� tj|| t t�
� � dddd ��}|j}|�|� W d
� n1 sAw Y t
d d|� ��}t
d
|� |d dkrv|d �� D ]}|�d�rsd|�d�d i S qadS zLt�d�|d �� dd� ��D ]8}|| � dd� �|jd�r�|| � dd� �|jd t |� |ji� |d7 }q�|| � dd� �|j|ji� q�W |S ty� Y dS w )z
Execute ilom commands
�_� r Zcachedir�tmpz.xml�wF)�dir�prefix�suffix�mode�deleteNzcmd.run_allzhponcfg -f zfile.remove�retcode�stderrz
MESSAGE=ZFailed�=���� �stdout� � T)�replace�osr �joinZ__opts__�isdir�mkdir�tempfileZNamedTemporaryFile�str�getpid�name�writeZ__salt__�
splitlines�
startswith�split�ETZ
fromstring�get�tag�updateZattrib�SyntaxError) r"