Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/web_infrastructure/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/web_infrastructure/jenkins_script.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZddlmZd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
author: James Hogarth (@hogarthj)
module: jenkins_script
short_description: Executes a groovy script in the jenkins instance
version_added: '2.3'
description:
    - The C(jenkins_script) module takes a script plus a dict of values
      to use within the script and returns the result of the script being run.

options:
  script:
    description:
      - The groovy script to be executed.
        This gets passed as a string Template if args is defined.
    required: true
  url:
    description:
      - The jenkins server to execute the script against. The default is a local
        jenkins instance that is not being proxied through a webserver.
    default: http://localhost:8080
  validate_certs:
    description:
      - If set to C(no), the SSL certificates will not be validated.
        This should only set to C(no) used on personally controlled sites
        using self-signed certificates as it avoids verifying the source site.
    type: bool
    default: 'yes'
  user:
    description:
      - The username to connect to the jenkins server with.
  password:
    description:
      - The password to connect to the jenkins server with.
  timeout:
    description:
      - The request timeout in seconds
    default: 10
    version_added: "2.4"
  args:
    description:
      - A dict of key-value pairs used in formatting the script using string.Template (see https://docs.python.org/2/library/string.html#template-strings).

notes:
    - Since the script can do anything this does not report on changes.
      Knowing the script is being run it's important to set changed_when
      for the ansible output to be clear on any alterations made.

s�
- name: Obtaining a list of plugins
  jenkins_script:
    script: 'println(Jenkins.instance.pluginManager.plugins)'
    user: admin
    password: admin

- name: Setting master using a variable to hold a more complicate script
  set_fact:
    setmaster_mode: |
        import jenkins.model.*
        instance = Jenkins.getInstance()
        instance.setMode(${jenkins_mode})
        instance.save()

- name: use the variable as the script
  jenkins_script:
    script: "{{ setmaster_mode }}"
    args:
      jenkins_mode: Node.Mode.EXCLUSIVE

- name: interacting with an untrusted HTTPS connection
  jenkins_script:
    script: "println(Jenkins.instance.pluginManager.plugins)"
    user: admin
    password: admin
    url: https://localhost
    validate_certs: no
sj
output:
    description: Result of script
    returned: success
    type: str
    sample: 'Result: true'
N(t
AnsibleModule(thttp_cookiejar(t	urlencode(t	fetch_url(t	to_nativecC`s�t||jdddd�\}}|ddkri|jddt|d�d	|dd
d�nt|j��}tj|�jdt	�S(
Nturls	/api/jsontmethodtGETRi�tmsgsHTTP error t toutputtt	useCrumbs(
Rtparamst	fail_jsontstrRtreadtjsontloadstgettFalse(tmoduletresptinfotcontent((sU/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/jenkins_script.pytis_csrf_protection_enabledrs3cC`s�t||jddddd|�\}}|ddkro|jdd	t|d�d
|ddd�nt|j��}tj|�S(
NR
s/crumbIssuer/api/jsonRRtcookiesRi�RsHTTP error RRR(RRRRRRRR(RR"RRR ((sU/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/jenkins_script.pyt	get_crumb}s3c
C`stdtdtdtdd�dtdtdddd�d	tdtdd
dt�dtdtdddd�dtdtd
tdddd�dtdtdddd�dtdtdddd���}|jddk	rF|jddkr|jdddd�n|jd|jd<|jd|jd<t|jd<n|jddk	r�ddlm}y'||jd�j	|jd�}Wq�t
k
r�}|jdd|dd�q�Xn
|jd}i}d}t|�rtj
�}t||�}i|d|d6}nt||jddd ti|d6�d!|d"d#d|jdd$|�\}}|d%d&kr�|jdd't|d%�d(|ddd�nt|j��}	d)|	kr�d*|	kr�|jdd+|	dd�n|jd|	�dS(,Nt
argument_spectscripttrequiredttypeRR
tdefaultshttp://localhost:8080tvalidate_certstbooltusertpasswordtno_logttimeouttinti
targstdictRs$password required when user providedRRturl_usernameturl_passwordtforce_basic_authi(tTemplates"Error with templating variable: %stcrumbtcrumbRequestFields/scriptTexttdatatheadersRtPOSTR"Ri�sHTTP error Rs
Exception:sat java.lang.Threads script failed with stacktrace:
 (RR1tTrueRtNoneRRtstringR5t
substitutetKeyErrorR!t	cookiejartLWPCookieJarR#RR
RRRt	exit_json(
RR5tscript_contentsterrR9R"R6RRtresult((sU/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/jenkins_script.pytmain�sT!!'!

3	t__main__(t
__future__RRRR't
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRtansible.module_utils.basicRtansible.module_utils.six.movesR	R@t+ansible.module_utils.six.moves.urllib.parseR
tansible.module_utils.urlsRtansible.module_utils._textRR!R#RFt__name__(((sU/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/jenkins_script.pyt<module>s$


3			:

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