Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddljjZddlmZej�Zdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
module: na_ontap_job_schedule
short_description: NetApp ONTAP Job Schedule
extends_documentation_fragment:
    - netapp.na_ontap
version_added: '2.6'
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
- Create/Delete/Modify job-schedules on ONTAP
options:
  state:
    description:
    - Whether the specified job schedule should exist or not.
    choices: ['present', 'absent']
    default: present
  name:
    description:
    - The name of the job-schedule to manage.
    required: true
  job_minutes:
    description:
    - The minute(s) of each hour when the job should be run.
      Job Manager cron scheduling minute.
      -1 represents all minutes and is
      only supported for cron schedule create and modify.
      Range is [-1..59]
    type: list
  job_hours:
    version_added: '2.8'
    description:
    - The hour(s) of the day when the job should be run.
      Job Manager cron scheduling hour.
      -1 represents all hours and is
      only supported for cron schedule create and modify.
      Range is [-1..23]
    type: list
  job_months:
    version_added: '2.8'
    description:
    - The month(s) when the job should be run.
      Job Manager cron scheduling month.
      -1 represents all months and is
      only supported for cron schedule create and modify.
      Range is [-1..11]
    type: list
  job_days_of_month:
    version_added: '2.8'
    description:
    - The day(s) of the month when the job should be run.
      Job Manager cron scheduling day of month.
      -1 represents all days of a month from 1 to 31, and is
      only supported for cron schedule create and modify.
      Range is [-1..31]
    type: list
  job_days_of_week:
    version_added: '2.8'
    description:
    - The day(s) in the week when the job should be run.
      Job Manager cron scheduling day of week.
      Zero represents Sunday. -1 represents all days of a week and is
      only supported for cron schedule create and modify.
      Range is [-1..6]
    type: list
sD
    - name: Create Job for 11.30PM at 10th of every month
      na_ontap_job_schedule:
        state: present
        name: jobName
        job_minutes: 30
        job_hours: 23
        job_days_of_month: 10
        job_months: -1
        hostname: "{{ netapp_hostname }}"
        username: "{{ netapp_username }}"
        password: "{{ netapp_password }}"
    - name: Delete Job
      na_ontap_job_schedule:
        state: absent
        name: jobName
        hostname: "{{ netapp_hostname }}"
        username: "{{ netapp_username }}"
        password: "{{ netapp_password }}"
s

N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppONTAPJobcB`s_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s$Class with job schedule cron methodscC`sKtj�|_|jjtdtdtdddgdd�dtdtdd	�d
tdtdd�dtdtdd�d
tdtdd�dtdtdd�dtdtdd���td|jdt�|_t	�|_
|j
j|jj�|_
|j�ttkr/|jjdd�ntjd|j�|_dS(Ntstatetrequiredtchoicestpresenttabsenttdefaulttnamettypetstrtjob_minutestlistt
job_monthst	job_hourstjob_days_of_monthtjob_days_of_weekt
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specRtupdatetdicttFalsetTrueRRR
t	na_helpertset_parameterstparamst
parameterstset_playbook_zapi_key_maptHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tself((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pyt__init__vs(	

cC`sFidd6|j_idd6dd6dd6dd6dd6|j_dS(Nsjob-schedule-nameRsjob-schedule-cron-minutescron-minuteRsjob-schedule-cron-months
cron-monthRsjob-schedule-cron-hours	cron-hourRsjob-schedule-cron-dayscron-day-of-monthRsjob-schedule-cron-day-of-weekscron-day-of-weekR(sjob-schedule-cron-minutescron-minute(sjob-schedule-cron-months
cron-month(sjob-schedule-cron-hours	cron-hour(sjob-schedule-cron-dayscron-day-of-month(sjob-schedule-cron-day-of-weekscron-day-of-week(R%tzapi_string_keystzapi_list_keys(R.((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pyR)�sc	C`s;tjjd�}|jiii|jdd6d6d6�|jj|t�}d}|j	d�r7t
|d�dkr7|dd}t�}x.|jj
j�D]\}}||||<q�Wxq|jjj�D]Z\}}|\}}|jjd	td
|j	|��||<||s�dg||<q�q�Wn|S(
s�
        Return details about the job
        :param:
            name : Job name
        :return: Details about the Job. None if not found.
        :rtype: dict
        sjob-schedule-cron-get-iterRsjob-schedule-namesjob-schedule-cron-infotquerysnum-recordsisattributes-listt	from_zapitzapi_parents-1N(Rtzapit	NaElementttranslate_structR(R-tinvoke_successfullyR$tNonetget_child_by_nametintR"R%R0titemsR1tget_value_for_list(	R.tjob_get_itertresulttjob_detailstjob_infotitem_keytzapi_keytparenttdummy((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytget_job_schedule�s&	%	
cC`s�x�|D]�}||jjkrE|jjj|�}||||<q||jjkr|jjj|�\}}|j|jjdtd|d|d|j|���qqWdS(s�
        Add children node for create or modify NaElement object
        :param na_element_object: modify or create NaElement object
        :param values: dictionary of cron values to be added
        :return: None
        R3R4t
zapi_childtdataN(R%R0tgetR1tadd_child_elemR=R#(R.tna_element_objecttvaluesRBRCt
parent_keyt	child_key((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytadd_job_details�s
cC`s�|jjd�d	kr.|jjdd�ntjjd�}|j||j�y|j	j
|dt�WnOtjjk
r�}|jjdd|jdt
|�fdtj��nXd	S(
s(
        Creates a job schedule
        RRs8Error: missing required parameter job_minutes for createsjob-schedule-cron-createtenable_tunnelings"Error creating job schedule %s: %sRt	exceptionN(R(RIR9RR+RR5R6ROR-R8R$t
NaApiErrorR	t	tracebackt
format_exc(R.tjob_schedule_createterror((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytcreate_job_schedule�scC`s�tjjd�}|j||j�y|jj|dt�WnOtjjk
r�}|j	j
dd|jdt|�fdtj
��nXdS(s'
        Delete a job schedule
        sjob-schedule-cron-destroyRPRs"Error deleting job schedule %s: %sRRQN(RR5R6ROR(R-R8R$RRRR+R	RSRT(R.tjob_schedule_deleteRV((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytdelete_job_schedule�scC`s�tjjjdi|jdd6�}|j||�y|jj|dt�WnOtjj	k
r�}|j
jdd|jdt|�fdt
j��nXdS(	s'
        modify a job schedule
        sjob-schedule-cron-modifyRsjob-schedule-nameRPRs#Error modifying job schedule %s: %sRQN(RR5R6tcreate_node_with_childrenR(ROR-R8R$RRRR+R	RSRT(R.R'tjob_schedule_modifyRV((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytmodify_job_schedule�scC`sAtj|j�}tjd|jd|�}tjd|�dS(sH
        Autosupport log for job_schedule
        :return: None
        Rtvservertna_ontap_job_scheduleN(Rtget_cserverR-R,Rt
ems_log_event(R.tresultstcserver((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytautosupport_logscC`s�|j�|j�}|jj||j�}|dkrh|jddkrh|jj||j�}n|jjr�|jj	r�q�|dkr�|j
�q�|dkr�|j�q�|r�|j|�q�n|jj
d|jj�dS(s.
        Apply action to job-schedule
        RRtcreatetdeletetchangedN(RcRFR%t
get_cd_actionR(R9tget_modified_attributesRfRt
check_modeRWRYR\t	exit_json(R.tcurrenttactiontmodify((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytapplys


(t__name__t
__module__t__doc__R/R)RFRORWRYR\RcRn(((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pyRss			#						cC`st�}|j�dS(sExecute actionN(RRn(tjob_obj((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pytmain"s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRStansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappRt"ansible.module_utils.netapp_moduleR
thas_netapp_libR*tobjectRRsRo(((sX/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pyt<module>s"


B�	

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