Anons79 Mini Shell

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

�
�Udac@`s
ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZmZddl
mZdd
lmZddlmZy&ddlZddlmZeZWnek
r�eZnXd�Zd�Zd�Zedkr	e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys		
---
module: aci_config_rollback
short_description: Provides rollback and rollback preview functionality (config:ImportP)
description:
- Provides rollback and rollback preview functionality for Cisco ACI fabrics.
- Config Rollbacks are done using snapshots C(aci_snapshot) with the configImportP class.
version_added: '2.4'
options:
  compare_export_policy:
    description:
    - The export policy that the C(compare_snapshot) is associated to.
    type: str
  compare_snapshot:
    description:
    - The name of the snapshot to compare with C(snapshot).
    type: str
  description:
    description:
    - The description for the Import Policy.
    type: str
    aliases: [ descr ]
  export_policy:
    description:
    - The export policy that the C(snapshot) is associated to.
    type: str
    required: yes
  fail_on_decrypt:
    description:
    - Determines if the APIC should fail the rollback if unable to decrypt secured data.
    - The APIC defaults to C(yes) when unset.
    type: bool
  import_mode:
    description:
    - Determines how the import should be handled by the APIC.
    - The APIC defaults to C(atomic) when unset.
    type: str
    choices: [ atomic, best-effort ]
  import_policy:
    description:
    - The name of the Import Policy to use for config rollback.
    type: str
  import_type:
    description:
    - Determines how the current and snapshot configuration should be compared for replacement.
    - The APIC defaults to C(replace) when unset.
    type: str
    choices: [ merge, replace ]
  snapshot:
    description:
    - The name of the snapshot to rollback to, or the base snapshot to use for comparison.
    - The C(aci_snapshot) module can be used to query the list of available snapshots.
    type: str
    required: yes
  state:
    description:
    - Use C(preview) for previewing the diff between two snapshots.
    - Use C(rollback) for reverting the configuration to a previous snapshot.
    type: str
    choices: [ preview, rollback ]
    default: rollback
extends_documentation_fragment: aci
seealso:
- module: aci_config_snapshot
- name: APIC Management Information Model reference
  description: More information about the internal APIC class B(config:ImportP).
  link: https://developer.cisco.com/docs/apic-mim-ref/
author:
- Jacob McGill (@jmcgill298)
si
---
- name: Create a Snapshot
  aci_config_snapshot:
    host: apic
    username: admin
    password: SomeSecretPassword
    export_policy: config_backup
    state: present
  delegate_to: localhost

- name: Query Existing Snapshots
  aci_config_snapshot:
    host: apic
    username: admin
    password: SomeSecretPassword
    export_policy: config_backup
    state: query
  delegate_to: localhost

- name: Compare Snapshot Files
  aci_config_rollback:
    host: apic
    username: admin
    password: SomeSecretPassword
    export_policy: config_backup
    snapshot: run-2017-08-28T06-24-01
    compare_export_policy: config_backup
    compare_snapshot: run-2017-08-27T23-43-56
    state: preview
  delegate_to: localhost

- name: Rollback Configuration
  aci_config_rollback:
    host: apic
    username: admin
    password: SomeSecretPassword
    import_policy: rollback_config
    export_policy: config_backup
    snapshot: run-2017-08-28T06-24-01
    state: rollback
  delegate_to: localhost

- name: Rollback Configuration
  aci_config_rollback:
    host: apic
    username: admin
    password: SomeSecretPassword
    import_policy: rollback_config
    export_policy: config_backup
    snapshot: run-2017-08-28T06-24-01
    description: Rollback 8-27 changes
    import_mode: atomic
    import_type: replace
    fail_on_decrypt: yes
    state: rollback
  delegate_to: localhost
s�
preview:
  description: A preview between two snapshots
  returned: when state is preview
  type: str
error:
  description: The error information as returned from the APIC
  returned: failure
  type: dict
  sample:
    {
        "code": "122",
        "text": "unknown managed object class foo"
    }
raw:
  description: The raw output returned by the APIC REST API (xml or json)
  returned: parse error
  type: str
  sample: '<?xml version="1.0" encoding="UTF-8"?><imdata totalCount="1"><error code="122" text="unknown managed object class foo"/></imdata>'
filter_string:
  description: The filter string used for the request
  returned: failure or debug
  type: str
  sample: ?rsp-prop-include=config-only
method:
  description: The HTTP method used for the request to the APIC
  returned: failure or debug
  type: str
  sample: POST
response:
  description: The HTTP response from the APIC
  returned: failure or debug
  type: str
  sample: OK (30 bytes)
status:
  description: The HTTP status from the APIC
  returned: failure or debug
  type: int
  sample: 200
url:
  description: The HTTP url used for the request to the APIC
  returned: failure or debug
  type: str
  sample: https://10.11.12.13/api/mo/uni/tn-production.json
(t	ACIModuletaci_argument_spec(t
AnsibleModule(tto_bytes(t	fetch_urlN(tcobracC`s�t�}|jdtdd�dtdd�dtddddg�dtdd�d	tdd
�dtdddd
dg�dtdd�dtdddddg�dtdddt�dtdddddddg��
td|dtdddddggdddggg�}t|�}|jd}|jd}|j|jd	�}|jd}|jd}|jd}|jd}	|jd}
|
dkr�|	j	d�r�|	j
ddd�}	n|	jd�s�|	d7}	nd j||	�}|j
d!td"d#d$d%j|�d&|d'i|d(6��|j�|jd"d#d)td*d+d|d,|d-|d.|d/|d(|dd0��|jd"d#�|j�n9|
dkr�d1|j|_d2|j|_t|�n|j�dS(3Ntcompare_export_policyttypetstrtcompare_snapshottdescriptiontaliasestdescrt
export_policytfail_on_decrypttbooltimport_modetchoicestatomicsbest-effortt
import_policytimport_typetmergetreplacetsnapshottrequiredtstatetdefaulttrollbackRt
argument_spectsupports_check_modetrequired_ifsrun-tis.tar.gzsce2_{0}-{1}t
root_classt	aci_classt
configImportPtaci_rnsfabric/configimp-{0}t
module_objectt
target_filtertnametclass_configtadminStt	triggeredtfailOnDecryptErrorstfileNamet
importModet
importTypetyess1%(protocol)s://%(host)s/mqapi2/snapshots.diff.xmls�?s1dn=uni/backupst/snapshots-[uni/fabric/configexp-%(export_policy)s]/snapshot-%(snapshot)s&s2dn=uni/backupst/snapshots-[uni/fabric/configexp-%(compare_export_policy)s]/snapshot-%(compare_snapshot)s(R	tupdatetdicttTrueR
tFalseRtparamstbooleant
startswithRtendswithtformatt
construct_urltget_existingtpayloadtget_difftpost_configturlt
filter_stringtget_previewt	exit_json(R$tmoduletaciRRRRRRRR!tfilename((sS/usr/lib/python2.7/site-packages/ansible/modules/network/aci/aci_config_rollback.pytmain�st		"







	
	



cC`s�|j|j}t|j|d|jddd|jjdd|jjd�\}}d|_|d|_|d|_|ddkr�t	||j
��n*|j
�|jd	<|jdd
|j
�dS(s�
    This function is used to generate a preview between two snapshots and add the parsed results to the aci module return data.
    theaderstmethodtGETttimeoutt	use_proxytmsgRi�traws4Request failed: %(code)s %(text)s (see 'raw' output)N(RERFRRIRMR;RNtresponseRtxml_to_jsontreadtresultt	fail_jsonterror(RJturitresptinfo((sS/usr/lib/python2.7/site-packages/ansible/modules/network/aci/aci_config_rollback.pyRG!sG	

cC`sNtr=tjjt|��}tj|�}||jd<n
||jd<dS(sF
    This function is used to convert preview XML data into JSON.
    RN(tXML_TO_JSONtlxmltetreet
fromstringRR
tdataRW(RJt
response_datatxmltxmldata((sS/usr/lib/python2.7/site-packages/ansible/modules/network/aci/aci_config_rollback.pyRU3s
t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt$ansible.module_utils.network.aci.aciRR	tansible.module_utils.basicR
tansible.module_utils._textRtansible.module_utils.urlsRt
lxml.etreeR^txmljsonR
R9R]tImportErrorR:RLRGRUt__name__(((sS/usr/lib/python2.7/site-packages/ansible/modules/network/aci/aci_config_rollback.pyt<module>s,


G;.


	V		

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