Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/sros/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pyo

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
mZdd
lmZmZmZmZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkr
e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys>
---
module: sros_rollback
version_added: "2.2"
author: "Peter Sprygada (@privateip)"
short_description: Configure Nokia SR OS rollback
description:
  - Configure the rollback feature on remote Nokia devices running
    the SR OS operating system.  this module provides a stateful
    implementation for managing the configuration of the rollback
    feature
extends_documentation_fragment: sros
options:
  rollback_location:
    description:
      - The I(rollback_location) specifies the location and filename
        of the rollback checkpoint files.   This argument supports any
        valid local or remote URL as specified in SR OS
  remote_max_checkpoints:
    description:
      - The I(remote_max_checkpoints) argument configures the maximum
        number of rollback files that can be transferred and saved to
        a remote location.  Valid values for this argument are in the
        range of 1 to 50
  local_max_checkpoints:
    description:
      - The I(local_max_checkpoints) argument configures the maximum
        number of rollback files that can be saved on the devices local
        compact flash.  Valid values for this argument are in the range
        of 1 to 50
  rescue_location:
    description:
      - The I(rescue_location) specifies the location of the
        rescue file.  This argument supports any valid local
        or remote URL as specified in SR OS
  state:
    description:
      - The I(state) argument specifies the state of the configuration
        entries in the devices active configuration.  When the state
        value is set to C(true) the configuration is present in the
        devices active configuration.  When the state value is set to
        C(false) the configuration values are removed from the devices
        active configuration.
    default: present
    choices: ['present', 'absent']
s�
# Note: examples below use the following provider dict to handle
#       transport and authentication to the node.
---
vars:
  cli:
    host: "{{ inventory_hostname }}"
    username: admin
    password: admin
    transport: cli

---
- name: configure rollback location
  sros_rollback:
    rollback_location: "cb3:/ansible"
    provider: "{{ cli }}"

- name: remove all rollback configuration
  sros_rollback:
    state: absent
    provider: "{{ cli }}"
s�
updates:
  description: The set of commands that will be pushed to the remote device
  returned: always
  type: list
  sample: ['...', '...']
(t
AnsibleModule(t
NetworkConfigtdumps(tload_configt
get_configtsros_argument_spect
check_argscO`s)t�j|�}|r%|||�SdS(N(tglobalstget(tnametargstkwargstfunc((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytinvokeascC`sbt�}xR|D]J}x4t|�D]&\}}|j|�r#||=Pq#q#W|j|�qW|S(N(tlistt	enumeratet
startswithtappend(tlinestcommandstlinetindextentry((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytsanitize_configgs	
cC`s�t�}xx|jj�D]g\}}|j|dk	r|jd�pNd|}||krm|j|�nt|||�qqWdS(Ntsettersset_%s(tsett
argument_spectitemstparamstNoneRtaddR(tmoduleRtsetterstkeytvalueR ((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytpresentrs	cC`s�t|�}d|kr(|jd�nd|krD|jd�nd|kr`|jd�nd|kr||jd�ndS(Nsrollback-locations.configure system rollback no rollback-locationsrescue-locations,configure system rollback no rescue-locationsremote-max-checkpointss3configure system rollback no remote-max-checkpointsslocal-max-checkpoints(RR(R'Rtconfig((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytabsent|scC`s"|jd}|jd|�dS(Ntrollback_locations0configure system rollback rollback-location "%s"(R$R(R'RR*((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytset_rollback_location�s
cC`sQ|jd}d|ko$dkns<|jdd�n|jd|�dS(Ntlocal_max_checkpointsii2tmsgs.local_max_checkpoints must be between 1 and 50s2configure system rollback local-max-checkpoints %s(R$t	fail_jsonR(R'RR*((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytset_local_max_checkpoints�s
cC`sQ|jd}d|ko$dkns<|jdd�n|jd|�dS(Ntremote_max_checkpointsii2R1s/remote_max_checkpoints must be between 1 and 50s3configure system rollback remote-max-checkpoints %s(R$R2R(R'RR*((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytset_remote_max_checkpoints�s
cC`s"|jd}|jd|�dS(Ntrescue_locations.configure system rollback rescue-location "%s"(R$R(R'RR*((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytset_rescue_location�s
cC`st|�}tddd|�S(Ntindentitcontents(RR	(R'R9((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytget_device_config�scC`sYtdt�dtdd�dtdd�dt�dtdd	d
d	dg��}|jt�td|d
t�}|jd}tdt�}t�}t|||�t	ddddj
|��}t|�}|j|�}|rHt
|d�}t|jd��}||d<||d<|js;t||�nt|d<n|j|�dS(s+ main entry point for module execution
    R.R0ttypetintR4R6tstatetdefaultR+tchoicesR-R"tsupports_check_modetchangedR8iR9s
RtupdatesN(tdicttupdateR
RtTrueR$tFalseRRR	tjoinR:t
differenceR
Rtsplitt
check_modeRt	exit_json(R"R'R=tresultRt	candidateR,t
configobjs((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pytmain�s2		
	
	

	
t__main__N(t
__future__RRRR;t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt*ansible.module_utils.network.common.configR	R
t&ansible.module_utils.network.sros.srosRRR
RRRR+R-R/R3R5R7R:ROt__name__(((sN/usr/lib/python2.7/site-packages/ansible/modules/network/sros/sros_rollback.pyt<module>s,


0"			
							0

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]