�
�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
Z
d d l m Z d d
l
m Z d d l j j Z d d l m Z e j � Z d e f d � � YZ d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust 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 NetAppModulet NetAppONTAPJobc B` s_ e Z d Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z
d � Z RS(
s$ Class with job schedule cron methodsc C` sK t j � | _ | j j t d t d t d d d g d d � d t d t d d � d
t d t d d � d t d t d d � d
t d t d d � d t d t d d � d t d t d d � � � t d | j d t � | _ t � | _
| j
j | j j � | _
| j � t t k r/| j j d d � n t j d | j � | _ d S( Nt statet requiredt choicest presentt absentt defaultt namet typet strt job_minutest listt
job_monthst job_hourst job_days_of_montht job_days_of_weekt
argument_spect supports_check_modet msgs( the python NetApp-Lib module is requiredt module( t netapp_utilst na_ontap_host_argument_specR t updatet dictt Falset TrueR R R
t na_helpert set_parameterst paramst
parameterst set_playbook_zapi_key_mapt HAS_NETAPP_LIBt fail_jsont setup_na_ontap_zapit server( t self( ( sX /usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pyt __init__v s(
c C` sF i d d 6| j _ i d d 6d d 6d d 6d d 6d d 6| j _ d S( Ns job-schedule-nameR s job-schedule-cron-minutes cron-minuteR s job-schedule-cron-months
cron-monthR s job-schedule-cron-hours cron-hourR s job-schedule-cron-days cron-day-of-monthR s job-schedule-cron-day-of-weeks cron-day-of-weekR ( s job-schedule-cron-minutes cron-minute( s job-schedule-cron-months
cron-month( s job-schedule-cron-hours cron-hour( s job-schedule-cron-days cron-day-of-month( s job-schedule-cron-day-of-weeks cron-day-of-week( R% t zapi_string_keyst zapi_list_keys( R. ( ( sX /usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_job_schedule.pyR) � s c C` s; t j j d � } | j i i i | j d d 6d 6d 6� | j j | t � } d } | j d � r7t
| d � d k r7| d d } t � } x. | j j
j � D] \ } } | | | | <q� Wxq | j j j � D]Z \ } } | \ } } | j j d t d
| j | � � | | <| | s� d g | | <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
s job-schedule-cron-get-iterR s job-schedule-names job-schedule-cron-infot querys num-recordsi s attributes-listt from_zapit zapi_parents -1N( R t zapit NaElementt translate_structR( R- t invoke_successfullyR$ t Nonet get_child_by_namet intR"