File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/nxos_upgrade.cpython-310.pyc
Back
o ;j�: � @ sv d Z ddlZddlZddlZddlZddlmZmZ dZdZ e� e�Zdd� Z dd d �Zddd�Zd d� Zdd� ZdS )a� Execution module to upgrade Cisco NX-OS Switches. .. versionadded:: 3001 This module supports execution using a Proxy Minion or Native Minion: 1) Proxy Minion: Connect over SSH or NX-API HTTP(S). See :mod:`salt.proxy.nxos <salt.proxy.nxos>` for proxy minion setup details. 2) Native Minion: Connect over NX-API Unix Domain Socket (UDS). Install the minion inside the GuestShell running on the NX-OS device. :maturity: new :platform: nxos :codeauthor: Michael G Wiebe .. note:: To use this module over remote NX-API the feature must be enabled on the NX-OS device by executing ``feature nxapi`` in configuration mode. This is not required for NX-API over UDS. Configuration example: .. code-block:: bash switch# conf t switch(config)# feature nxapi To check that NX-API is properly enabled, execute ``show nxapi``. Output example: .. code-block:: bash switch# show nxapi nxapi enabled HTTPS Listen on port 443 � N)�CommandExecutionError� NxosErrorZnxos)Znxos_upgradec C s t S )N)�__virtualname__� r r �M/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/nxos_upgrade.py�__virtual__C s r Tc K s� t |t�sdS | }|}d}d}|dur|d�|||� }n |d|� d|� � }|r1|du r1|d }t�d |� |�d |�d d�i� dd g}|�d|i� ztd |fi |��} W t| �S tyw } zt � | j�} W Y d} ~ t| �S d} ~ ww )a� Display upgrade impact information without actually upgrading the device. system_image (Mandatory Option) Path on bootflash: to system image upgrade file. kickstart_image Path on bootflash: to kickstart image upgrade file. (Not required if using combined system/kickstart image file) Default: None issu In Service Software Upgrade (non-disruptive). When True, the upgrade will abort if issu is not possible. When False: Force (disruptive) Upgrade/Downgrade. Default: True timeout Timeout in seconds for long running 'install all' impact command. Default: 900 error_pattern Use the option to pass in a regular expression to search for in the output of the 'install all impact' command that indicates an error has occurred. This option is only used when proxy minion connection type is ssh and otherwise ignored. .. code-block:: bash salt 'n9k' nxos.check_upgrade_impact system_image=nxos.9.2.1.bin salt 'n7k' nxos.check_upgrade_impact system_image=n7000-s2-dk9.8.1.1.bin \ kickstart_image=n7000-s2-kickstart.8.1.1.bin issu=False �>Input Error: The [issu] parameter must be either True or False� bootflashz+terminal dont-ask ; show install all impactN�! kickstart {0}:{1} system {0}:{2}� nxos �:� non-disruptivez(Check upgrade impact using command: '%s'�timeout� �,Another install procedure may be in progresszPre-upgrade check failed� error_pattern� nxos.sendline) � isinstance�bool�format�log�info�update�get�__salt__r �ast�literal_eval�message�_parse_upgrade_data)�system_image�kickstart_image�issu�kwargs�si�ki�dev�cmd�error_pattern_listZimpact_check�er r r �check_upgrade_impactG s2 #����r) c K sn t |t�sdS d}d}d}td|�D ]�}|du ryt�d� t| ||fi |��}|d r6t�d� t�d� q|d r=d }qt�d|� |d rK| S |r[|d s[|d |d<