%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/nxos.pyo

�
���^c@@szdZddlmZmZmZddlZd�Zddeddd�Z	d�Z
d�Zd	�Zed
�Z
dS(u�
State module for Cisco NX OS Switches Proxy minions

.. versionadded: 2016.11.0

For documentation on setting up the nxos proxy minion look in the documentation
for :mod:`salt.proxy.nxos<salt.proxy.nxos>`.
i(tabsolute_importtprint_functiontunicode_literalsNcC@s
dtkS(Nunxos.cmd(t__salt__(((s4/usr/lib/python2.7/site-packages/salt/states/nxos.pyt__virtual__susha256cC@s�i|d6td6id6dd6}t}|d"k	rZtddd|d	|d
|�}nt}|d"k	r�tddd|�}	t|�t|	�k}ntddd|�}
t|||
g�s�t|d<d
|d<|S|tkrt|	�t|�}t|�t|	�}ntdtkr�d"|d<|
s�d|d<|d"k	rct|dd<n|d"k	r�i|d6gd6|dd<n|S|tkr�d|d<t|dd<n|tkr�d|d<it|�d6t|�d6|dd<n|S|tkrmtddd|d	|d
|d|r9|dnd"d|d|�}
i|
d6|
d6|dd<n|tkr�x(|D] }tddd|d|�q�Wx(|D] }tddd|d|�q�Witddd|�d6|	d6|dd<nt}|d"k	r5tddd|d	|d
|�}nt}|d"k	rxtddd|�}	t|�t|	�k}n|s�d|d<n'|s�d |d<nd!|d<t|d<|S(#u�
    Ensure a user is present with the specified groups

    name
        Name of user

    password
        Encrypted or Plain Text password for user

    roles
        List of roles the user should be assigned.  Any roles not in this list will be removed

    encrypted
        Whether the password is encrypted already or not.  Defaults to False

    crypt_salt
        Salt to use when encrypting the password.  Default is None (salt is
        randomly generated for unhashed passwords)

    algorithm
        Algorithm to use for hashing password.  Defaults to sha256.
        Accepts md5, blowfish, sha256, sha512

        .. note: sha512 may make the hash too long to save in NX OS which limits the has to 64 characters

    Examples:

    .. code-block:: yaml

        create:
          nxos.user_present:
            - name: daniel
            - roles:
              - vdc-admin

        set_password:
          nxos.user_present:
            - name: daniel
            - password: admin
            - roles:
              - network-admin

        update:
          nxos.user_present:
            - name: daniel
            - password: AiN9jaoP
            - roles:
              - network-admin
              - vdc-admin

    unameuresultuchangesuucommentunxos.cmducheck_passwordtusernametpasswordt	encryptedu	get_rolesuget_useruUser already existsutestuUser will be createdupassworduadduremoveuroleuUser will be updatedurolesuset_passwordtroleit
crypt_saltt	algorithmunewuolduset_roleu
unset_roleuFailed to set correct rolesuFailed to set correct passworduUser set correctlyN(tFalsetNoneRtsettanytTruet__opts__tlist(tnameRtrolesRR	R
trettchange_passwordtchange_rolest	cur_rolestold_usertremove_rolest	add_rolestnew_userRtcorrect_passwordt
correct_roles((s4/usr/lib/python2.7/site-packages/salt/states/nxos.pytuser_presents�4











	






cC@si|d6td6id6dd6}tddd|�}|sVt|d<d	|d<|Std
tkr�|r�d|d<d|d<||dd<d|dd
<|Stddd|�tddd|�r�d|d<n0t|d<d|d<||dd<d|dd
<|S(u�
    Ensure a user is not present

    name
        username to remove if it exists

    Examples:

    .. code-block:: yaml

        delete:
          nxos.user_absent:
            - name: daniel
    unameuresultuchangesuucommentunxos.cmduget_userRuUser does not existutestuUser will be removeduoldunewuremove_useruFailed to remove useruUser removedN(RRRRR(RRR((s4/usr/lib/python2.7/site-packages/salt/states/nxos.pytuser_absent�s.








cC@s�i|d6td6id6dd6}tdd|�}|rRt|d<d|d<n�td	tkr�d|d<d
|d<||dd<nctdd|�tdd|�}|r�t|d<d
|d<||dd<nt|d<d|d<|S(ut
    Ensure a specific configuration line exists in the running config

    name
        config line to set

    Examples:

    .. code-block:: yaml

        add snmp group:
          nxos.config_present:
            - names:
              - snmp-server community randoSNMPstringHERE group network-operator
              - snmp-server community AnotherRandomSNMPSTring group network-admin

        add snmp acl:
          nxos.config_present:
            - names:
              - snmp-server community randoSNMPstringHERE use-acl snmp-acl-ro
              - snmp-server community AnotherRandomSNMPSTring use-acl snmp-acl-rw
    unameuresultuchangesuucommentunxos.cmdufinduConfig is already setutestuConfig will be addedunewu
add_configuSuccessfully added configuFailed to add configN(RRRRR(RRtmatches((s4/usr/lib/python2.7/site-packages/salt/states/nxos.pytconfig_present�s*









cC@s�i|d6td6id6dd6}tdd|�}|sRt|d<d|d<n�td	tkr�d|d<d
|d<||dd<nctdd|�tdd|�}|s�t|d<d
|d<||dd<nt|d<d|d<|S(u�
    Ensure a specific configuration line does not exist in the running config

    name
        config line to remove

    Examples:

    .. code-block:: yaml

        add snmp group:
          nxos.config_absent:
            - names:
              - snmp-server community randoSNMPstringHERE group network-operator
              - snmp-server community AnotherRandomSNMPSTring group network-admin

    .. note::
        For certain cases extra lines could be removed based on dependencies.
        In this example, included after the example for config_present, the
        ACLs would be removed because they depend on the existence of the
        group.

    unameuresultuchangesuucommentunxos.cmdufinduConfig is already absentutestuConfig will be removedunewu
delete_configuSuccessfully deleted configuFailed to delete configN(RRRRR(RRR ((s4/usr/lib/python2.7/site-packages/salt/states/nxos.pyt
config_absents*









cC@sZi|d6td6id6dd6}|tkr@dj|�}n|}tdd|�}|swt|d<d	|d<|Std
tkr�d|d<d|d<||dd<g|D]}tj|||�^q�|dd
<|Stdd||d|�|d<tdd|�}|r6t|d<dj|�|d<n t|d<dj||�|d<|S(uU
    Replace all instances of a string or full line in the running config

    name
        String to replace

    repl
        The replacement text

    full_match
        Whether `name` will match the full line or only a subset of the line.
        Defaults to False. When False, .* is added around `name` for matching
        in the `show run` config.

    Examples:

    .. code-block:: yaml

        replace snmp string:
          nxos.replace:
            - name: randoSNMPstringHERE
            - repl: NEWrandoSNMPstringHERE

        replace full snmp string:
          nxos.replace:
            - name: ^snmp-server community randoSNMPstringHERE group network-operator$
            - repl: snmp-server community NEWrandoSNMPstringHERE group network-operator
            - full_match: True

    .. note::
        The first example will replace the SNMP string on both the group and
        the ACL, so you will not lose the ACL setting.  Because the second is
        an exact match of the line, when the group is removed, the ACL is
        removed, but not readded, because it was not matched.

    unameuresultuchangesuucommentu	^.*{0}.*$unxos.cmdufinduNothing found to replaceutestuConfigs will be changeduoldunewureplacet
full_matchu(Failed to replace all instances of "{0}"u7Successfully replaced all instances of "{0}" with "{1}"N(RtformatRRRRtretsub(RtreplR#RtsearchR tmatch((s4/usr/lib/python2.7/site-packages/salt/states/nxos.pytreplace<s4%





0 

(t__doc__t
__future__RRRR%RRRRRR!R"R*(((s4/usr/lib/python2.7/site-packages/salt/states/nxos.pyt<module>	s	�	/	5	6

Zerion Mini Shell 1.0