
    Vh!                     l    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZ d Zd Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona  
module: nxos_rollback
extends_documentation_fragment:
- cisco.nxos.nxos
short_description: Set a checkpoint or rollback to a checkpoint.
description:
- This module offers the ability to set a configuration checkpoint file or rollback
  to a configuration checkpoint file on Cisco NXOS switches.
version_added: 1.0.0
author:
- Jason Edelman (@jedelman8)
- Gabriele Gerbino (@GGabriele)
notes:
- Tested against NXOSv 7.3.(0)D1(1) on VIRL
- Unsupported for Cisco MDS
- Sometimes C(transport=nxapi) may cause a timeout error.
options:
  checkpoint_file:
    description:
    - Name of checkpoint file to create. Mutually exclusive with rollback_to.
    type: str
  rollback_to:
    description:
    - Name of checkpoint file to rollback to. Mutually exclusive with checkpoint_file.
    type:  str
a%  
- cisco.nxos.nxos_rollback:
    checkpoint_file: backup.cfg
    username: '{{ un }}'
    password: '{{ pwd }}'
    host: '{{ inventory_hostname }}'
- cisco.nxos.nxos_rollback:
    rollback_to: backup.cfg
    username: '{{ un }}'
    password: '{{ pwd }}'
    host: '{{ inventory_hostname }}'
a  
filename:
    description: The filename of the checkpoint/rollback file.
    returned: success
    type: str
    sample: 'backup.cfg'
status:
    description: Which operation took place and whether it was successful.
    returned: success
    type: str
    sample: 'rollback executed'
)AnsibleModulerun_commandsc                 6    dddd| z  ddg}t        ||       y )Nzterminal dont-asktextcommandoutputzcheckpoint file %sr   filenamemodulecommandss      l/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/cisco/nxos/plugins/modules/nxos_rollback.py
checkpointr   S   s*    '6:(83vFH "    c                 .    d| z  ddg}t        ||       y )Nzrollback running-config file %sr
   r   r   r   s      r   rollbackr   [   s'     98C	
H "r   c                  *   t        t        d      t        d            } t        | ddggd      }|j                  d   }|j                  d   }d }d }d}|rt        ||       d}n|rt	        ||       d}d	}|xs |}|j                  |||
       y )NF)required)checkpoint_filerollback_tor   r   )argument_specmutually_exclusivesupports_check_modezcheckpoint file createdzrollback executedT)changedstatusr   )dictr   paramsr   r   	exit_json)r   r   r   r   r   r   r   s          r   mainr#   e   s    u)=4Y^K_`M#.>?!F mm$56O--.KFHG?F+*	f%$G-oH
WVhGr   __main__N)
__future__r   r   r   type__metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   Eansible_collections.cisco.nxos.plugins.module_utils.network.nxos.nxosr   r   r   r#   __name__ r   r   <module>r/      sV   $ A @ 6
 5 ^##H8 zF r   