Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/modules/source_control/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyo

�
�Udac@`s:ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZdZ
yddlZeZWn#ek
r�ej�Z
eZnXddlmZdd
lmZmZddlmZddlmZmZdefd��YZd�Z d�Z!e"dkr6e!�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�

---
module: gitlab_project
short_description: Creates/updates/deletes GitLab Projects
description:
  - When the project does not exist in GitLab, it will be created.
  - When the project does exists and state=absent, the project will be deleted.
  - When changes are made to the project, the project will be updated.
version_added: "2.1"
author:
  - Werner Dijkerman (@dj-wasabi)
  - Guillaume Martinez (@Lunik)
requirements:
  - python >= 2.7
  - python-gitlab python module <= 1.12.1
extends_documentation_fragment:
    - auth_basic
options:
  server_url:
    description:
      - The URL of the GitLab server, with protocol (i.e. http or https).
    type: str
  login_user:
    description:
      - GitLab user name.
    type: str
  login_password:
    description:
      - GitLab password for login_user
    type: str
  api_token:
    description:
      - GitLab token for logging in.
    type: str
    aliases:
      - login_token
  group:
    description:
      - Id or The full path of the group of which this projects belongs to.
    type: str
  name:
    description:
      - The name of the project
    required: true
    type: str
  path:
    description:
      - The path of the project you want to create, this will be server_url/<group>/path
      - If not supplied, name will be used.
    type: str
  description:
    description:
      - An description for the project.
    type: str
  issues_enabled:
    description:
      - Whether you want to create issues or not.
      - Possible values are true and false.
    type: bool
    default: yes
  merge_requests_enabled:
    description:
      - If merge requests can be made or not.
      - Possible values are true and false.
    type: bool
    default: yes
  wiki_enabled:
    description:
      - If an wiki for this project should be available or not.
      - Possible values are true and false.
    type: bool
    default: yes
  snippets_enabled:
    description:
      - If creating snippets should be available or not.
      - Possible values are true and false.
    type: bool
    default: yes
  visibility:
    description:
      - Private. Project access must be granted explicitly for each user.
      - Internal. The project can be cloned by any logged in user.
      - Public. The project can be cloned without any authentication.
    default: private
    type: str
    choices: ["private", "internal", "public"]
    aliases:
      - visibility_level
  import_url:
    description:
      - Git repository which will be imported into gitlab.
      - GitLab server needs read access to this git repository.
    required: false
    type: str
  state:
    description:
      - create or delete project.
      - Possible values are present and absent.
    default: present
    type: str
    choices: ["present", "absent"]
s�
- name: Delete GitLab Project
  gitlab_project:
    api_url: https://gitlab.example.com/
    api_token: "{{ access_token }}"
    validate_certs: False
    name: my_first_project
    state: absent
  delegate_to: localhost

- name: Create GitLab Project in group Ansible
  gitlab_project:
    api_url: https://gitlab.example.com/
    validate_certs: True
    api_username: dj-wasabi
    api_password: "MySecretPassword"
    name: my_first_project
    group: ansible
    issues_enabled: False
    wiki_enabled: True
    snippets_enabled: True
    import_url: http://git.example.com/example/lab.git
    state: present
  delegate_to: localhost
s�
msg:
  description: Success or failure message
  returned: always
  type: str
  sample: "Success"

result:
  description: json parsed response from the server
  returned: always
  type: dict

error:
  description: the error message returned by the GitLab API
  returned: failed
  type: str
  sample: "400: path is already in use"

project:
  description: API object
  returned: always
  type: dict
N(tbasic_auth_argument_spec(t
AnsibleModuletmissing_required_lib(t	to_native(t	findGrouptfindProjectt
GitLabProjectcB`s>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cC`s||_||_d|_dS(N(t_modulet_gitlabtNonet
projectObject(tselftmoduletgitlab_instance((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyt__init__�s		cC`sut}|jdkr�|j|i	|d6|dd6|dd6|dd6|dd6|dd6|dd6|dd6|d	d	6�}t}nd|j|ji|d6|dd6|dd6|dd6|dd6|dd6|dd6�\}}||_|rm|jjr.|jjd
tdd|�ny|j	�Wn*t
k
rh}|jjdd
|�nXtStSdS(Ntnametpathtdescriptiontissues_enabledtmerge_requests_enabledtwiki_enabledtsnippets_enabledt
visibilityt
import_urltchangedtmsgs.Successfully created or updated the project %ssFailed update project: %s (tFalseRRt
createProjecttTruet
updateProjectRt
check_modet	exit_jsontsavet	Exceptiont	fail_json(Rtproject_namet	namespacetoptionsR tprojectte((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pytcreateOrUpdateProject�s>		 cC`ss|jjrtS|j|d<y|jjj|�}Wn6tjj	k
rn}|jj
ddt|��nX|S(Ntnamespace_idR!sFailed to create project: %s (RR&R$tidRtprojectstcreatetgitlabt
exceptionstGitlabCreateErrorR*R(RR,t	argumentsR.R/((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyR#�s
!cC`svt}xc|j�D]U\}}||dk	rt||�||krht||||�t}qhqqW||fS(N(R"titemsRtgetattrtsetattrR$(RR.R8R targ_keyt	arg_value((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyR%scC`s#|jjrtS|j}|j�S(N(RR&R$Rtdelete(RR.((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyt
deleteProjects	cC`s4t|j|jd|�}|r0||_tStS(Nt/(R
Rt	full_pathRR$R"(RR,RR.((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyt
existsProjects
	(t__name__t
__module__RR0R#R%R?RB(((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyR�s	
	+			cC`sLdg}x<|D]4}||jkr|jdjd|�d�qqWdS(Ntlogin_tokensAlias '{aliase}' is deprecatedtaliases2.10(tparamst	deprecatetformat(Rtdeprecated_aliasesRF((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pytdeprecation_warning s	
c'C`s�t�}|jtdtdddd�dtdddtdd�dtdddtdd�d	tdddtd
dg�dtdd�d
tdddt�dtdd�dtdd�dtdddt�dtdddt�dtdddt�dtdtdd�dtddddddddgd
dg�dtdd�dtdddddd dg���td!|d"d#dgd$dgd%dgd$d	gd%d	gddgddggd&d$d%gddggd'd$d	ddgdd#ggd(t�}t|�|jd}|jd}|jd}|jd#}|jd)}|jd$}|jd%}|dkr||n|}	|dkr�|n|}
|dkr�|n|}|jd	}|jd}
|jd
}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd}|jd}tss|j	d*t
d+�d,t�ny>tj
d-|	d.|d/|
d0|d1|d2d3�}|j�Wnqtjjtjjfk
r�}|j	d*d4t|��n3tjjk
r$}|j	d*d5t|��nX|dkrF|jd6d7�}nt||�}|
r�t||
�}|dkr�|j	d*d8|
�n|jj|j�}|j||�}nF|jjd9|jj�d:}|jj|j�}|j||�}|d krO|r6|j�|j d;td*d<|�qO|j d;t!d*d=�n|dkr�|j"||i|d6|d6|d6|d6|d6|d6|d6|d6�r�|j d;td*d>|d?|j#j$�q�|j d;t!d*d@|d?|j#j$�ndS(ANt
server_urlttypetstrtremoved_in_versions2.10t
login_usertno_logtlogin_passwordt	api_tokentaliasesREtgroupRtrequiredRRRtbooltdefaultRRRRtprivatetchoicestinternaltpublictvisibility_levelRtstatetpresenttabsentt
argument_spectmutually_exclusivetapi_urltapi_usernametapi_passwordtrequired_togethertrequired_one_oftsupports_check_modetvalidate_certsR!s
python-gitlabt	exceptionturlt
ssl_verifytemailtpasswordt
private_tokentapi_versionis&Failed to connect to GitLab server: %ss�Failed to connect to GitLab server: %s.             GitLab remove Session API now that private tokens are removed from user API endpoints since version 10.2.t t_s1Failed to create project: group %s doesn't existstusernameiR sSuccessfully deleted project %ss"Project deleted or does not existss.Successfully created or updated the project %sR.s No need to update the project %s(%RtupdatetdictR$R	RKRGRtHAS_GITLAB_PACKAGER*R
tGITLAB_IMP_ERRR5tGitlabtauthR6tGitlabAuthenticationErrortGitlabGetErrorRtGitlabHttpErrortreplaceRRt
namespacestgetR2RBtuserstlisttuserRsR?R'R"R0Rt_attrs(RaRRLRPRRRcRitapi_userRet
gitlab_urltgitlab_usertgitlab_passwordtgitlab_tokentgroup_identifierR+tproject_pathtproject_descriptionRRRRRRR^RR/tgitlab_projectRUR,tproject_existsR�((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pytmain(s�	-%								



















!!	

)t__main__(#t
__future__RRRRMt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtost	tracebackRRwR5R$RvR)t
format_excR"tansible.module_utils.apiRtansible.module_utils.basicR	R
tansible.module_utils._textRtansible.module_utils.gitlabRR
tobjectRRKR�RC(((sQ/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_project.pyt<module>s2


g


f		|

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