�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
m Z d d
l m Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: pn_log_audit_exception
author: "Pluribus Networks (@rajaspachipulusu17)"
version_added: "2.9"
short_description: CLI command to create/delete an audit exception
description:
- This module can be used to create an audit exception and delete an audit exception.
options:
pn_cliswitch:
description:
- Target switch to run the CLI on.
required: false
type: str
pn_audit_type:
description:
- Specify the type of audit exception.
required: false
type: str
choices: ['cli', 'shell', 'vtysh']
state:
description:
- State the action to perform. Use 'present' to create audit-exception and
'absent' to delete audit-exception.
required: false
type: str
choices: ['present', 'absent']
default: 'present'
pn_pattern:
description:
- Specify a regular expression to match exceptions.
required: false
type: str
pn_scope:
description:
- scope - local or fabric.
required: false
type: str
choices: ['local', 'fabric']
pn_access:
description:
- Specify the access type to match exceptions.
required: true
type: str
choices: ['any', 'read-only', 'read-write']
sK
- name: create a log-audit-exception
pn_log_audit_exception:
pn_audit_type: "cli"
pn_pattern: "test"
state: "present"
pn_access: "any"
pn_scope: "local"
- name: delete a log-audit-exception
pn_log_audit_exception:
pn_audit_type: "shell"
pn_pattern: "test"
state: "absent"
pn_access: "any"
s�
command:
description: the CLI command run on the target node.
returned: always
type: str
stdout:
description: set of responses from the pn_log_audit_exceptions command.
returned: always
type: list
stderr:
description: set of error responses from the log_audit_exceptions command.
returned: on error
type: list
changed:
description: indicates whether the CLI caused changes on the target.
returned: always
type: bool
( t
AnsibleModule( t pn_clit run_cli( t run_commandsc C` sr | j d } | j d } | j d } | j d } | j d } | d 7} | d 7} | d 7} t | | � d } | rn| j � j d
� } x� | D]� } | j d � }
d } |
d | k r� | d 7} n |
d | k r� | d 7} n |
d
| k r| d 7} n | d k r/|
d | k r/| d 7} n | d k rK| d k rKt S| d k r� | d k r� t Sq� Wn t S( s
This method checks for idempotency using the log-audit-exception command.
If a list with given name exists, return exists as True else False.
:param module: The Ansible module to fetch input parameters.
:return Booleans: True or False.
t statet
pn_audit_typet
pn_patternt pn_accesst pn_scopes log-audit-exception-shows no-show-headers format s/ type,pattern,access,scope parsable-delim DELIMi s
t DELIMi i t presenti t absenti ( t paramsR t stript splitt Truet False( t modulet cliR t
audit_typet patternt accesst scopet stdoutt linelistt linet wordlistt count( ( s[ /usr/lib/python2.7/site-packages/ansible/modules/network/netvisor/pn_log_audit_exception.pyt check_clif s6
c C` s& t d d d d � } t d t d t d d � d t d t d d � d
t d t d d d | j � d d � d
t d t d d d d d d g � d t d t d d d d d d g � d t d t d d d d d g � � } t d | d d
d d g g f � } | j d } | j d
} | j d
} | j d } | j d } | j d } | | } t | | � }
t | |
� } |
d | | | | f 7}
| d k r�| t k r�| j d t d d � n t | |
| � nR | d k r"| t k r| j d t d d � n |
d | 7}
t | |
| � n d S(! s'