Anons79 Mini Shell

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

�
�Udac@`s2ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZmZddlmZmZmZmZddlmZmZmZeZd�Zd�Zd�Zdd�Z!d�Z"e#dkr.e"�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatustnetworktsupported_byse
---
module: junos_logging
version_added: "2.4"
author: "Ganesh Nalawade (@ganeshrn)"
short_description: Manage logging on network devices
description:
  - This module provides declarative management of logging
    on Juniper JUNOS devices.
options:
  dest:
    description:
      - Destination of the logs.
    choices: ['console', 'host', 'file', 'user']
  name:
    description:
      - If value of C(dest) is I(file) it indicates file-name,
        for I(user) it indicates username and for I(host) indicates
        the host name to be notified.
  facility:
    description:
      - Set logging facility.
  level:
    description:
      - Set logging severity levels.
  aggregate:
    description: List of logging definitions.
  state:
    description:
      - State of the logging configuration.
    default: present
    choices: ['present', 'absent']
  active:
    description:
      - Specifies whether or not the configuration is active or deactivated
    default: True
    type: bool
  rotate_frequency:
    description:
      - Rotate log frequency in minutes, this is applicable if value
        of I(dest) is C(file). The acceptable value is in range of 1 to 59.
        This controls the frequency after which log file is rotated.
    required: false
  size:
    description:
      - Size of the file in archive, this is applicable if value
        of I(dest) is C(file). The acceptable value is in range from 65536 to
        1073741824 bytes.
    required: false
  files:
    description:
      - Number of files to be archived, this is applicable if value
        of I(dest) is C(file). The acceptable value is in range from 1 to 1000.
    required: false
requirements:
  - ncclient (>=v0.5.2)
notes:
  - This module requires the netconf system service be enabled on
    the remote device being managed.
  - Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4.
  - Recommended connection is C(netconf). See L(the Junos OS Platform Options,../network/user_guide/platform_junos.html).
  - This module also works with C(local) connections for legacy playbooks.
extends_documentation_fragment: junos
s�
- name: configure console logging
  junos_logging:
    dest: console
    facility: any
    level: critical

- name: remove console logging configuration
  junos_logging:
    dest: console
    state: absent

- name: configure file logging
  junos_logging:
    dest: file
    name: test
    facility: pfe
    level: error

- name: configure logging parameter
  junos_logging:
    files: 30
    size: 65536
    rotate_frequency: 10

- name: Configure file logging using aggregate
  junos_logging:
    dest: file
    aggregate:
    - name: test-1
      facility: pfe
      level: critical
    - name: test-2
      facility: kernel
      level: emergency
    active: True

- name: Delete file logging using aggregate
  junos_logging:
    aggregate:
    - { dest: file, name: test-1,  facility: pfe, level: critical }
    - { dest: file, name: test-2,  facility: kernel, level: emergency }
    state: absent
sy
diff.prepared:
  description: Configuration difference before and after applying change.
  returned: when configuration is changed and diff option is enabled.
  type: str
  sample: >
          [edit system syslog]
          +    [edit system syslog]
               file interactive-commands { ... }
          +    file test {
          +        pfe critical;
          +    }
N(tdeepcopy(t
AnsibleModule(tremove_default_spec(tjunos_argument_specttostring(tload_configtmap_params_to_objtmap_obj_to_elet
to_param_list(tcommit_configurationtdiscard_changest
locked_configcC`s:|r6d|kodknr6|jdd�ndS(Nii�tmsgs files must be between 1 and 1000(t	fail_json(tvaluetmodule((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_logging.pytvalidate_files�s#cC`s:|r6d|kodknr6|jdd�ndS(Nii@Rs)size must be between 65536 and 1073741824(R(RR((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_logging.pyt
validate_size�s#cC`s:|r6d|kodknr6|jdd�ndS(Nii;Rs)rotate_frequency must be between 1 and 59(R(RR((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_logging.pytvalidate_rotate_frequency�s#cC`sb|s|j}nxI|D]A}t�jd|�}t|�r||j|�|�qqWdS(Nsvalidate_%s(tparamstglobalstgettcallable(Rtobjtparamtkeyt	validator((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_logging.pytvalidate_param_values�s
cC`s~tdtdddddg�dt�dt�d	t�d
tdd�d
tdd�dtdd�dt�dtdddddg�dtdtdd��
}t|�}t|�tdtddddd|��}|j|�|jt�ddddd	gfddddd	gfddddd	gfdddd	gfg}td|d|dt�}t�}itd6}|r�||d<nt	|�}t�}x"|D]}	x7|	D]/}
|	j
|
�d0kr�|j|
|	|
<q�q�W|j
||	�|	j�}|j
d�}|dkrM|j
d�rM|jd d!d1�nd"}
t}d0}|r�|dkr�|}t}q�|d#}t}ntj�}|jdidd$6td%6|d&6fdidd$6|d%6|d&6fd
id
d$6td'6td%6d(d&6fdidd$6td'6td%6d(d&6fd
id)d$6td'6fg�|j
d	�r�i|j
d	�d$6td*6|d&6|d	<nt||d+|�t||d+|�}|jt|||
d+|��q�Wd0}t|���x,|D]$}t|t|�|d,d-�}q�W|j}|rg|r3t|�n
t|�t|d<|jrgi|d.6|d/<qgnWd0QX|j|�d0S(2s+ main entry point for module execution
    tdesttchoicestconsolethosttfiletusertnametfacilitytleveltrotate_frequencyttypetinttsizetfilestsrc_addrtstatetdefaulttpresenttabsenttactivetboolt	aggregatetlisttelementstdicttoptionst
argument_spectrequired_iftsupports_check_modetchangedtwarningsRs %s and %s are mutually exclusives
system/syslogs	/contentstxpathtis_keyttopt	leaf_onlytarchiveslog-rotate-frequencyttag_onlyR tactiontmergetpreparedtdiffN(R&R*(R<tTrueRR
tupdateRR	R:tFalseRRtNoneRt_check_required_iftcopyRtcollectionstOrderedDictR#RtappendRRR
Rt
check_modeRRt_difft	exit_json(telement_spectaggregate_specR>R?RRBtresultRtrequestsR R!titemR$REtis_facility_keyt	field_toptparam_to_xpath_maptwantRLtreqtcommit((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_logging.pytmain�s�				


		

	

	
	%%+#

"



	t__main__($t
__future__RRRR.t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRSRRRtansible.module_utils.basicR	t)ansible.module_utils.network.common.utilsR
t(ansible.module_utils.network.junos.junosRRR
RRRRRRRMtUSE_PERSISTENT_CONNECTIONRRRRPR#Rdt__name__(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/junos/junos_logging.pyt<module>s,


B-"			
	j

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