%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/cimc.pyc

�
���^c@@s�dZddlmZmZmZddlZeje�Zd�Z	d�Z
dd�Zddd�Z
d�Zdddd	�Zddd
�Zdddddd
�ZdS(u�
A state module to manage Cisco UCS chassis devices.

:codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>``
:maturity:   new
:depends:    none
:platform:   unix


About
=====
This state module was designed to handle connections to a Cisco Unified Computing System (UCS) chassis. This module
relies on the CIMC proxy module to interface with the device.

.. seealso::
    :py:mod:`CIMC Proxy Module <salt.proxy.cimc>`

i(tabsolute_importtprint_functiontunicode_literalsNcC@s
dtkS(Nucimc.get_system_info(t__salt__(((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pyt__virtual__scC@s&i|d6id6td6dd6}|S(u+
    Set the default response values.

    unameuchangesuresultuucomment(tFalse(tnametret((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pyt_default_ret s
cC@s�t|�}td�}t}y�||kr7t}n|r�td|�}|skt|d<d|d<|S||dd<||dd<d	|d<n
d
|d<Wn5tk
r�}t|d<d|d<tj|�|SXt|d<|S(uA
    Ensures that the hostname is set to the specified value.

    .. versionadded:: 2019.2.0

    name: The name of the module function to execute.

    hostname(str): The hostname of the server.

    SLS Example:

    .. code-block:: yaml

        set_name:
          cimc.hostname:
            - hostname: foobar

    ucimc.get_hostnameucimc.set_hostnameuresultuError setting hostname.ucommentuchangesubeforeuafteruHostname modified.u1Hostname already configured. No changes required.u Error occurred setting hostname.(RRRtTruet	Exceptiontlogterror(RthostnameRtcurrent_namet
req_changetupdateterr((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pyR
.s.
	






c	C@s@t|�}td�}t}y�|ddd}|rS|d|krSt}n|rr|d|krrt}n|r�td||�}|dddd	d
kr�t|d<d|d
<|S||dd<td�|dd<d|d
<n
d|d
<Wn5tk
r1}t|d<d|d
<tj|�|SXt|d<|S(u1
    Ensures that the logging levels are set on the device. The logging levels
    must match the following options: emergency, alert, critical, error, warning,
    notice, informational, debug.

    .. versionadded:: 2019.2.0

    name: The name of the module function to execute.

    remote(str): The logging level for SYSLOG logs.

    local(str): The logging level for the local device.

    SLS Example:

    .. code-block:: yaml

        logging_levels:
          cimc.logging_levels:
            - remote: informational
            - local: notice

    ucimc.get_syslog_settingsu
outConfigsu
commSyslogiuremoteSeverityu
localSeverityucimc.set_logging_levelsu	outConfigustatusumodifieduresultuError setting logging levels.ucommentuchangesubeforeuafteru Logging level settings modified.u6Logging level already configured. No changes required.u.Error occurred setting logging level settings.(RRRR	R
RR(	RtremotetlocalRtsyslog_confRtsyslog_dictRR((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pytlogging_levelsgs4
		






c

C@s@t|�}ddddg}t|t�r[d}x/|D]}|||<|d7}q:Wn
||d<td�}t}y�|dddddks|d|dddd	ks|d|dddd
ks|d|ddddks|d
|ddddkr t}nWn5tk
rX}t|d<d|d<tj|�|SX|r(yatd|d|d|d|d
�}	|	dddddkr�t|d<d|d<|SWn5t	k
r�}t|d<d|d<tj|�|SX||dd<td�|dd<d|d<n
d|d<t|d<|S(uI
    Ensures that the NTP servers are configured. Servers are provided as an individual string or list format. Only four
    NTP servers will be reviewed. Any entries past four will be ignored.

    name: The name of the module function to execute.

    servers(str, list): The IP address or FQDN of the NTP servers.

    SLS Example:

    .. code-block:: yaml

        ntp_configuration_list:
          cimc.ntp:
            - servers:
              - foo.bar.com
              - 10.10.10.10

        ntp_configuration_str:
          cimc.ntp:
            - servers: foo.bar.com

    uiiucimc.get_ntpu
outConfigsucommNtpProvideru	ntpEnableuyesu
ntpServer1u
ntpServer2iu
ntpServer3iu
ntpServer4uresultu'Unable to confirm current NTP settings.ucommentucimc.set_ntp_serveru	outConfigustatusumodifiedu Error setting NTP configuration.uchangesubeforeuafteruNTP settings modified.u,NTP already configured. No changes required.(
Rt
isinstancetlistRRR	tKeyErrorRRR
(
RtserversRtntp_serverstitxtconfRRR((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pytntp�sV



    












c
C@s�t|�}td�}t}y7|ddd}|rS|d|krSt}nx|dkr�|d|krxt}q�|ddkr�t|d	�t|�kr�t}q�q�nt|d
<d|d<|S|rKtd
|||�}|dddddkrt|d
<d|d<|S||dd<td�|dd<d|d<n
d|d<Wn5tk
r�}	t|d
<d|d<tj|	�|SXt|d
<|S(u
    Ensures that the power configuration is configured on the system. This is
    only available on some C-Series servers.

    .. versionadded:: 2019.2.0

    name: The name of the module function to execute.

    policy(str): The action to be taken when chassis power is restored after
    an unexpected power loss. This can be one of the following:

        reset: The server is allowed to boot up normally when power is
        restored. The server can restart immediately or, optionally, after a
        fixed or random delay.

        stay-off: The server remains off until it is manually restarted.

        last-state: The server restarts and the system attempts to restore
        any processes that were running before power was lost.

    delayType(str): If the selected policy is reset, the restart can be
    delayed with this option. This can be one of the following:

        fixed: The server restarts after a fixed delay.

        random: The server restarts after a random delay.

    delayValue(int): If a fixed delay is selected, once chassis power is
    restored and the Cisco IMC has finished rebooting, the system waits for
    the specified number of seconds before restarting the server. Enter an
    integer between 0 and 240.


    SLS Example:

    .. code-block:: yaml

        reset_power:
          cimc.power_configuration:
            - policy: reset
            - delayType: fixed
            - delayValue: 0

        power_off:
          cimc.power_configuration:
            - policy: stay-off


    ucimc.get_power_configurationu
outConfigsubiosVfResumeOnACPowerLossiuvpResumeOnACPowerLossuresetu	delayTypeufixedudelayuresultu#The power policy must be specified.ucommentucimc.set_power_configurationu	outConfigustatusumodifiedu"Error setting power configuration.uchangesubeforeuafteruPower settings modified.u7Power settings already configured. No changes required.u&Error occurred setting power settings.(RRRR	tstrR
RR(
Rtpolicyt	delayTypet
delayValueRt
power_confRt
power_dictRR((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pytpower_configuration�sF3
		


	






cC@s�t|�}td�}t}|r:t}d|kr�d|dkr�xX|ddD]E}|ddkrrqVn|ddkrV|d|krVt}qVqVWn|r:yTtd	|d�}|d
dddd
kr�t}nt|d<d|d<|SWq7tk
r3}	t|d<d|d<tj|	�|SXq:n|rUt}
d
|kr�d|d
kr�xX|d
dD]E}|ddkr�qqn|ddkrq|d|krqt}
qqqqWn|
rUyTtd	|d�}|d
dddd
kr�t}nt|d<d|d<|SWqRtk
rN}	t|d<d|d<tj|	�|SXqUn|r�||dd<td�|dd<d|d<n
d|d<t|d<|S(u�
    Ensures that the syslog servers are set to the specified values. A value of None will be ignored.

    name: The name of the module function to execute.

    primary(str): The IP address or FQDN of the primary syslog server.

    secondary(str): The IP address or FQDN of the secondary syslog server.

    SLS Example:

    .. code-block:: yaml

        syslog_configuration:
          cimc.syslog:
            - primary: 10.10.10.10
            - secondary: foo.bar.com

    ucimc.get_syslogu
outConfigsucommSyslogClientunameuprimaryu
adminStateuenableduhostnameucimc.set_syslog_serveru	outConfigiustatusumodifieduresultu$Error setting primary SYSLOG server.ucommentu	secondaryu&Error setting secondary SYSLOG server.uchangesubeforeuafteruSYSLOG settings modified.u/SYSLOG already configured. No changes required.(RRRR	R
RR(Rtprimaryt	secondaryRRRtprim_changetentryRRt
sec_change((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pytsyslog_sh
 	




 	







uuactivecC@s0t|�}td�}y�x5|ddD]%}|dt|�kr+|}	q+q+W|	srt|d<d|d<|Stdt|�||||�}
d	|
kr�|	|d
d<|
d	d|d
d<d
|d<nt|d<d|d<|SWn5tk
r!}t|d<d|d<tj|�|SXt|d<|S(u�
    Ensures that a user is configured on the device. Due to being unable to
    verify the user password. This is a forced operation.

    .. versionadded:: 2019.2.0

    name: The name of the module function to execute.

    id(int): The user ID slot on the device.

    user(str): The username of the user.

    priv(str): The privilege level of the user.

    password(str): The password of the user.

    status(str): The status of the user. Can be either active or inactive.

    SLS Example:

    .. code-block:: yaml

        user_configuration:
          cimc.user:
            - id: 11
            - user: foo
            - priv: admin
            - password: mypassword
            - status: active

    ucimc.get_usersu
outConfigsuaaaUseruiduresultuFUnable to find requested user id on device. Please verify id is valid.ucommentu
cimc.set_useru	outConfiguchangesubeforeuafteruUser settings modified.u!Error setting user configuration.(RRR RR
RRR	(RtidtusertprivtpasswordtstatusRt	user_confR*RtupdatesR((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pyR.�s2!



"






(t__doc__t
__future__RRRtloggingt	getLoggert__name__RRRtNoneR
RRR&R,R.(((s4/usr/lib/python2.7/site-packages/salt/states/cimc.pyt<module>s		9A	ReV

Zerion Mini Shell 1.0