File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/cimc.cpython-310.pyc
o
�N�g�[ � @ s� d Z ddlZddlZddlZe�e�ZdZdd� Z dTdd�Z
dUd d
�Zdd� Zd
d� Z
dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd1d2� Zd3d4� Z d5d6� Z!d7d8� Z"d9d:� Z#d;d<� Z$ = dVd>d?�Z%d@dA� Z&dWdBdC�Z'dXdDdE�Z(dYdGdH�Z)dZdIdJ�Z*d[dLdM�Z+d\dNdO�Z,dXdPdQ�Z-dXdRdS�Z.dS )]a�
Module to provide Cisco UCS compatibility to Salt
:codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>``
:maturity: new
:depends: none
:platform: unix
Configuration
=============
This module accepts connection configuration details either as
parameters, or as configuration settings in pillar as a Salt proxy.
Options passed into opts will be ignored if options are passed into pillar.
.. seealso::
:py:mod:`Cisco UCS Proxy Module <salt.proxy.cimc>`
About
=====
This execution module was designed to handle connections to a Cisco UCS server.
This module adds support to send connections directly to the device through the
rest API.
� N�cimcc C sD zt jj�� rtd d dkrtW S W dS W dS ty! Y dS w )z/
Will load for the cimc proxy minions.
�proxyZ proxytyper )FzDThe cimc execution module can only be loaded for cimc proxy minions.)�salt�utils�platformZis_proxyZ__opts__�__virtualname__�KeyError� r r �E/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/cimc.py�__virtual__% s ����r Fc C s2 d}d}| du r
d}d� |�}td ||d�}|S )a
Activates the firmware backup image.
CLI Example:
Args:
reset(bool): Reset the CIMC device on activate.
.. code-block:: bash
salt '*' cimc.activate_backup_image
salt '*' cimc.activate_backup_image reset=True
z2sys/rack-unit-1/mgmt/fw-boot-def/bootunit-combined�noTZyesz�<firmwareBootUnit dn='sys/rack-unit-1/mgmt/fw-boot-def/bootunit-combined'
adminState='trigger' image='backup' resetOnActivate='{}' />�cimc.set_config_modifyF��format� __proxy__)�reset�dn�r�inconfig�retr r r
�activate_backup_image2 s ��r c C sn | st j�d��|st j�d��|st j�d��|s t j�d��d| � �}d�| |||�}td ||d�}|S ) a�
Create a CIMC user with username and password.
Args:
uid(int): The user ID slot to create the user account in.
username(str): The name of the user.
password(str): The clear text password of the user.
priv(str): The privilege level of the user.
CLI Example:
.. code-block:: bash
salt '*' cimc.create_user 11 username=admin password=foobar priv=admin
�The user ID must be specified.zThe username must be specified.zThe password must be specified.z&The privilege level must be specified.�sys/user-ext/user-zj<aaaUser id="{0}" accountStatus="active" name="{1}" priv="{2}"
pwd="{3}" dn="sys/user-ext/user-{0}"/>r
F�r �
exceptions�CommandExecutionErrorr r )�uid�username�password�privr r r r r r
�create_userS s$ �
��r c C � t d dd�} | S )z�
Get the default values of BIOS tokens.
CLI Example:
.. code-block:: bash
salt '*' cimc.get_bios_defaults
�cimc.get_config_resolver_classZbiosPlatformDefaultsT�r �r r r r
�get_bios_defaults� � r% c C r! )z�
Get the C240 server BIOS token values.
CLI Example:
.. code-block:: bash
salt '*' cimc.get_bios_settings
r"