%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/jenkinsmod.pyc

�
���^c@@skdZddlmZmZmZddlZddlZyddlZe	Z
Wnek
rieZ
nXddl
ZddlmZmZeje�ZdZd�Zd�Zd�Zd	�Zd
�Zd�Zdd�Zdd
�Zddd�Zdddd�Zdddd�Z dd�Z!dd�Z"dd�Z#dd�Z$dd�Z%d�Z&dS(u=
Module for controlling Jenkins

:depends: python-jenkins

.. versionadded:: 2016.3.0

:depends: python-jenkins_ Python module (not to be confused with jenkins_)

.. _python-jenkins: https://pypi.python.org/pypi/python-jenkins
.. _jenkins: https://pypi.python.org/pypi/jenkins

:configuration: This module can be used by either passing an api key and version
    directly or by specifying both in a configuration profile in the salt
    master/minion config.

    For example:

    .. code-block:: yaml

        jenkins:
          api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionErrortSaltInvocationErrorujenkinscC@s0tr&ttd�rtStdfSntdfS(uZ
    Return virtual name of the module.

    :return: The virtual name of the module.
    uJenkinsutThe wrong Python module appears to be installed. Please make sure that 'python-jenkins' is installed, not 'jenkins'.uOThe jenkins execution module cannot be loaded: python-jenkins is not installed.(tHAS_JENKINSthasattrtjenkinst__virtualname__tFalse(((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyt__virtual__3s
cC@s�tdd�p-tdd�p-tdd�}tdd�p]tdd�p]tdd�}tdd�p�tdd�p�tdd�}|s�td	��ntj|d
|d|�S(uw
    Return server object used to interact with Jenkins.

    :return: server object used to interact with Jenkins
    u
config.getujenkins.urlujenkins:urlu
pillar.getujenkins.userujenkins:userujenkins.passwordujenkins:passworduNo Jenkins URL found.tusernametpassword(t__salt__RRtJenkins(tjenkins_urltjenkins_usertjenkins_password((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyt_connectEscC@s5td||�}|s1tdj|���n|S(u�
    Helper to cache the config XML and raise a CommandExecutionError if we fail
    to do so. If we successfully cache the file, return the cached path.
    u
cp.cache_fileuFailed to retrieve {0}(R
Rtformat(t
config_xmltsaltenvtret((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyt_retrieve_config_xml_scC@st�}|j|�S(u�
    .. versionadded:: 2017.7.0

    Execute a script on the jenkins master

    :param script: The script

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.run 'Jenkins.instance.doSafeRestart()'

    (Rt
run_script(tscripttserver((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pytrunls	cC@s#t�}|j�}|r|StS(u�
    Return version of Jenkins

    :return: The version of Jenkins

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.get_version
    (Rtget_versionR	(Rtversion((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR�s

	cC@s#t�}|j�}|r|SiS(u�
    Return the currently configured jobs.

    :return: The currently configured jobs.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.get_jobs
    (Rtget_jobs(Rtjobs((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR�s

	cC@s9|std��nt�}|j|�r1tStSdS(u
    Check whether the job exists in configured Jenkins jobs.

    :param name: The name of the job is check if it exists.
    :return: True if job exists, False if job does not exist.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.job_exists jobname

    u$Required parameter 'name' is missingN(RRt
job_existstTrueR	(tnameR((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR �s	cC@s_|std��nt�}t|�sBtdj|���n|j|�}|r[|StS(u�
    Return information about the Jenkins job.

    :param name: The name of the job is check if it exists.
    :return: Information about the Jenkins job.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.get_job_info jobname

    u$Required parameter 'name' is missinguJob '{0}' does not exist(RRR RRtget_job_infoR	(R"Rtjob_info((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR#�s	cC@s�|std��nt�}t|�sBtdj|���ny|j||�Wn.tjk
r�}tdj||���nXtS(u;
    Initiate a build for the provided job.

    :param name: The name of the job is check if it exists.
    :param parameters: Parameters to send to the job.
    :return: True is successful, otherwise raise an exception.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.build_job jobname

    u$Required parameter 'name' is missinguJob '{0}' does not exist.u)Encountered error building job '{0}': {1}(	RRR RRt	build_jobRtJenkinsExceptionR!(R"t
parametersRterr((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR%�s	ubasecC@s�|std��nt|�r9tdj|���n|sKtj}nHt||�}tjj	j
|��"}tjjj|j
��}WdQXt�}y|j||�Wn.tjk
r�}tdj||���nX|S(u�
    Return the configuration file.

    :param name: The name of the job is check if it exists.
    :param config_xml: The configuration file to use to create the job.
    :param saltenv: The environment to look for the file in.
    :return: The configuration file used for the job.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.create_job jobname

        salt '*' jenkins.create_job jobname config_xml='salt://jenkins/config.xml'

    u$Required parameter 'name' is missinguJob '{0}' already existsNu)Encountered error creating job '{0}': {1}(RR RRRtEMPTY_CONFIG_XMLRtsalttutilstfilestfopentstringutilst
to_unicodetreadRt
create_jobR&(R"RRtconfig_xml_filet_fpRR(((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR1�s !	cC@s�|std��n|s'tj}nHt||�}tjjj|��"}tjjj	|j
��}WdQXt�}y|j||�Wn.tj
k
r�}tdj||���nX|S(u�
    Return the updated configuration file.

    :param name: The name of the job is check if it exists.
    :param config_xml: The configuration file to use to create the job.
    :param saltenv: The environment to look for the file in.
    :return: The configuration file used for the job.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.update_job jobname

        salt '*' jenkins.update_job jobname config_xml='salt://jenkins/config.xml'

    u$Required parameter 'name' is missingNu)Encountered error updating job '{0}': {1}(RRR)RR*R+R,R-R.R/R0Rtreconfig_jobR&RR(R"RRR2R3RR(((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyt
update_job*s!	cC@s�|std��nt�}t|�sBtdj|���ny|j|�Wn.tjk
r�}tdj||���nXtS(u�
    Return true is job is deleted successfully.

    :param name: The name of the job to delete.
    :return: Return true if job is deleted successfully.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.delete_job jobname

    u$Required parameter 'name' is missinguJob '{0}' does not existu)Encountered error deleting job '{0}': {1}(	RRR RRt
delete_jobRR&R!(R"RR(((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR6Ss	cC@s�|std��nt�}t|�sBtdj|���ny|j|�Wn.tjk
r�}tdj||���nXtS(u�
    Return true is job is enabled successfully.

    :param name: The name of the job to enable.
    :return: Return true if job is enabled successfully.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.enable_job jobname

    u$Required parameter 'name' is missinguJob '{0}' does not existu)Encountered error enabling job '{0}': {1}(	RRR RRt
enable_jobRR&R!(R"RR(((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR7rs	cC@s�|std��nt�}t|�sBtdj|���ny|j|�Wn.tjk
r�}tdj||���nXtS(u�
    Return true is job is disabled successfully.

    :param name: The name of the job to disable.
    :return: Return true if job is disabled successfully.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.disable_job jobname

    u$Required parameter 'name' is missinguJob '{0}' does not existu*Encountered error disabling job '{0}': {1}(	RRR RRtdisable_jobRR&R!(R"RR(((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR8�s	cC@sS|std��nt�}t|�sBtdj|���n|jd�dS(u
    Return the current status, enabled or disabled, of the job.

    :param name: The name of the job to return status for
    :return: Return true if enabled or false if disabled.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.job_status jobname

    u$Required parameter 'name' is missinguJob '{0}' does not existuemptyu	buildable(RRR RRR#(R"R((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyt
job_status�s	cC@sU|std��nt�}t|�sBtdj|���n|j|�}|S(u
    Return the current job configuration for the provided job.

    :param name: The name of the job to return the configuration for.
    :return: The configuration for the job specified.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.get_job_config jobname

    u$Required parameter 'name' is missinguJob '{0}' does not exist(RRR RRtget_job_config(R"RR$((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyR:�s	cC@sRt�}|j�}g|j�D]}||kr"|^q"}|rJtStSdS(uV
    .. versionadded:: 2016.11.0

    Return if the plugin is installed for the provided plugin name.

    :param name: The name of the parameter to confirm installation.
    :return: True if plugin exists, False if plugin does not exist.

    CLI Example:

    .. code-block:: bash

        salt '*' jenkins.plugin_installed pluginName

    N(Rtget_pluginstkeysR!R	(R"Rtpluginstplugintexists((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pytplugin_installed�s	+('t__doc__t
__future__RRRtloggingtsalt.utils.stringutilsR*RR!RtImportErrorR	tsalt.utils.filestsalt.exceptionsRRt	getLoggert__name__tlogRR
RRRRRtNoneR R#R%R1R5R6R7R8R9R:R@(((s;/usr/lib/python2.7/site-packages/salt/modules/jenkinsmod.pyt<module>sB


			
			 *' 

Zerion Mini Shell 1.0