%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/servicenow.pyc

�
���^c@@s�dZddlmZmZmZddlZddlmZeZ	yddl
mZeZ	Wne
k
rqnXeje�ZdZdZd�Zd�Zd	d
�Zd�Zdd�Zd
�ZdS(u�
Module for execution of ServiceNow CI (configuration items)

.. versionadded:: 2016.11.0

:depends: servicenow_rest python module

:configuration: Configure this module by specifying the name of a configuration
    profile in the minion config, minion pillar, or master config. The module
    will use the 'servicenow' key by default, if defined.

    For example:

    .. code-block:: yaml

        servicenow:
          instance_name: ''
          username: ''
          password: ''
i(tabsolute_importtunicode_literalstprint_functionN(tsix(tClientu
servicenowcC@str
tStdfS(uJ
    Only load this module if servicenow is installed on this minion.
    uhThe servicenow execution module failed to load: requires servicenow_rest python library to be installed.(tHAS_LIBSt__virtualname__tFalse(((s;/usr/lib/python2.7/site-packages/salt/modules/servicenow.pyt__virtual__+scC@s>tdt�}|d}|d}|d}t|||�S(Nu
config.optionu
instance_nameuusernameupassword(t__salt__tSERVICE_NAMER(tconfigt
instance_nametusernametpassword((s;/usr/lib/python2.7/site-packages/salt/modules/servicenow.pyt_get_client5s



uapprovedcC@s�t�}d|_|ji|d6�}|dksFt|�dkrWtjd�tS|dd}|ji|d6|�}|S(u�
    Set the approval state of a change request/record

    :param change_id: The ID of the change request, e.g. CHG123545
    :type  change_id: ``str``

    :param state: The target state, e.g. approved
    :type  state: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion servicenow.set_change_request_state CHG000123 declined
        salt myminion servicenow.set_change_request_state CHG000123 approved
    uchange_requestunumberiu7Failed to fetch change record, maybe it does not exist?usys_iduapprovalN(	RttabletgettNonetlentlogterrorRtupdate(t	change_idtstatetclienttrecordtsys_idtresponse((s;/usr/lib/python2.7/site-packages/salt/modules/servicenow.pytset_change_request_state=s		
cC@s%t�}||_|j|�}|S(u*
    Delete an existing record

    :param table: The table name, e.g. sys_user
    :type  table: ``str``

    :param sys_id: The unique ID of the record
    :type  sys_id: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion servicenow.delete_record sys_computer 2134566
    (RRtdelete(RRRR((s;/usr/lib/python2.7/site-packages/salt/modules/servicenow.pyt
delete_record[s		cK@s�t�}||_|dkrlg}x3|j�D]%\}}|jdj||��q1Wdj|�}ntj|�}|j	|�}|S(u]
    Run a non-structed (not a dict) query on a servicenow table.
    See http://wiki.servicenow.com/index.php?title=Encoded_Query_Strings#gsc.tab=0
    for help on constructing a non-structured query string.

    :param table: The table name, e.g. sys_user
    :type  table: ``str``

    :param query: The query to run (or use keyword arguments to filter data)
    :type  query: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion servicenow.non_structured_query sys_computer 'role=web'
        salt myminion servicenow.non_structured_query sys_computer role=web type=computer
    u{0}={1}u^N(
RRRtitemstappendtformattjoinRt	text_typeR(RtquerytkwargsRtquery_partstkeytvalueR((s;/usr/lib/python2.7/site-packages/salt/modules/servicenow.pytnon_structured_queryqs		cC@s/t�}||_|ji||6|�}|S(u�
    Update the value of a record's field in a servicenow table

    :param table: The table name, e.g. sys_user
    :type  table: ``str``

    :param sys_id: The unique ID of the record
    :type  sys_id: ``str``

    :param field: The new value
    :type  field: ``str``

    :param value: The new value
    :type  value: ``str``

    CLI Example:

    .. code-block:: bash

        salt myminion servicenow.update_record_field sys_user 2348234 first_name jimmy
    (RRR(RRtfieldR)RR((s;/usr/lib/python2.7/site-packages/salt/modules/servicenow.pytupdate_record_field�s		(t__doc__t
__future__RRRtloggingtsalt.extRRRtservicenow_rest.apiRtTruetImportErrort	getLoggert__name__RRR
RRRRRR*R,(((s;/usr/lib/python2.7/site-packages/salt/modules/servicenow.pyt<module>s$

	
		#

Zerion Mini Shell 1.0