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_group.pyc

�
�Udac@`s4ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZdZ
yddlZeZWn#ek
r�ej�Z
eZnXddlmZdd
lmZmZddlmZddlmZdefd��YZd�Zd�Z e!dkr0e �ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: gitlab_group
short_description: Creates/updates/deletes GitLab Groups
description:
  - When the group does not exist in GitLab, it will be created.
  - When the group does exist and state=absent, the group will be deleted.
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
  name:
    description:
      - Name of the group you want to create.
    required: true
    type: str
  path:
    description:
      - The path of the group you want to create, this will be server_url/group_path
      - If not supplied, the group_name will be used.
    type: str
  description:
    description:
      - A description for the group.
    version_added: "2.7"
    type: str
  state:
    description:
      - create or delete group.
      - Possible values are present and absent.
    default: present
    type: str
    choices: ["present", "absent"]
  parent:
    description:
      - Allow to create subgroups
      - Id or Full path of parent group in the form of group/name
    version_added: "2.8"
    type: str
  visibility:
    description:
      - Default visibility of the group
    version_added: "2.8"
    choices: ["private", "internal", "public"]
    default: private
    type: str
s>
- name: "Delete GitLab Group"
  gitlab_group:
    server_url: https://gitlab.example.com/
    api_token: "{{ access_token }}"
    validate_certs: False
    name: my_first_group
    state: absent

- name: "Create GitLab Group"
  gitlab_group:
    server_url: https://gitlab.example.com/
    validate_certs: True
    api_username: dj-wasabi
    api_password: "MySecretPassword"
    name: my_first_group
    path: my_first_group
    state: present

# The group will by created at https://gitlab.dj-wasabi.local/super_parent/parent/my_first_group
- name: "Create GitLab SubGroup"
  gitlab_group:
    server_url: https://gitlab.example.com/
    validate_certs: True
    api_username: dj-wasabi
    api_password: "MySecretPassword"
    name: my_first_group
    path: my_first_group
    state: present
    parent: "super_parent/parent"
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"

group:
  description: API object
  returned: always
  type: dict
N(tbasic_auth_argument_spec(t
AnsibleModuletmissing_required_lib(t	to_native(t	findGrouptGitLabGroupcB`sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC`s||_||_d|_dS(N(t_modulet_gitlabtNonetgroupObject(tselftmoduletgitlab_instance((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pyt__init__�s		cC`s|dk	r|jSdS(N(Rtid(Rtgroup((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pyt
getGroupId�scC`st}|jdkr`|j|�}|ji|d6|dd6|d6|dd6�}t}n8|j|ji|d6|dd6|dd6�\}}||_|r|jjr�|jj	dtdd|�ny|j
�Wn*tk
r
}|jjdd	|�nXtStSdS(
Ntnametpatht	parent_idt
visibilitytdescriptiontchangedtmsgs,Successfully created or updated the group %ssFailed to update group: %s (
tFalseRRRtcreateGrouptTruetupdateGroupRt
check_modet	exit_jsontsavet	Exceptiont	fail_json(RRtparenttoptionsRRRte((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pytcreateOrUpdateGroup�s.			 cC`sf|jjrtSy|jjj|�}Wn6tjjk
ra}|jj	ddt
|��nX|S(NRsFailed to create group: %s (RR$R"Rtgroupstcreatetgitlabt
exceptionstGitlabCreateErrorR(R(Rt	argumentsRR+((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pyR!�s!cC`svt}xc|j�D]U\}}||dk	rt||�||krht||||�t}qhqqW||fS(N(R titemsRtgetattrtsetattrR"(RRR2Rtarg_keyt	arg_value((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pyR#�scC`s�|j}t|jj��dkr:|jjdd�nQ|jjrJtSy|j�Wn0t	k
r�}|jjddt
|��nXdS(NiRslThere are still projects in this group. These needs to be moved or deleted before this group can be removed.sFailed to delete group: %s (RtlentprojectstlistRR(R$R"tdeleteR'R(RRR+((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pytdeleteGroup�s	
cC`s)t|j|�}|r%||_tStS(N(RRRR"R (Rtproject_identifierR((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pytexistsGroups
	(	t__name__t
__module__RRR,R!R#R<R>(((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pyR
�s		
	#			cC`sLdg}x<|D]4}||jkr|jdjd|�d�qqWdS(Ntlogin_tokensAlias '{aliase}' is deprecatedtaliases2.10(tparamst	deprecatetformat(Rtdeprecated_aliasesRB((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pytdeprecation_warning
s	
cC`s�t�}|jtdtdddd�dtdddtdd�dtdddtdd�d	tdddtd
dg�dtddd
t�dtdd�dtdd�dtdddddddg�dtdd�dtddddddddg��
�td|dddgddgddgdd	gdd	gddgddggdddgddggd dd	ddgddggd!t�}t|�|jd}|jd}|jd}|jd}|jd"}|jd}|jd}|dkr|n|}	|dkr(|n|}
|dkr@|n|}|jd	}|jd}
|jd}|jd}|jd}|jd}|jd}ts�|j	d#t
d$�d%t�ny>tj
d&|	d'|d(|
d)|d*|d+d,�}|j�Wnqtjjtjjfk
rE}|j	d#d-t|��n3tjjk
rw}|j	d#d.t|��nX|dkr�|
jd/d0�}nt||�}d}|r�t||�}|s�|j	d#d1�n|j|jd2|�}n|j|�}|dkrZ|rA|j�|jd3td#d4|
�qZ|jd3td#d5�n|dkr�|j|
|i|d6|d6|d6�r�|jd3td#d6|
d7|jj�q�|jd3td#d8|
d7|jj�ndS(9Nt
server_urlttypetstrtremoved_in_versions2.10t
login_usertno_logtlogin_passwordt	api_tokentaliasesRARtrequiredRRtstatetdefaulttpresenttchoicestabsentR)Rtprivatetinternaltpublict
argument_spectmutually_exclusivetapi_urltapi_usernametapi_passwordtrequired_togethertrequired_one_oftsupports_check_modetvalidate_certsRs
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.2t t_s7Failed create GitLab group: Parent group doesn't existst/RsSuccessfully deleted group %ss Group deleted or does not existss,Successfully created or updated the group %sRsNo need to update the group %s(RtupdatetdictR"R	RGRCRtHAS_GITLAB_PACKAGER(R
tGITLAB_IMP_ERRR/tGitlabtauthR0tGitlabAuthenticationErrortGitlabGetErrorRtGitlabHttpErrortreplaceR
RR>t	full_pathR<R%R R,Rt_attrs(RZRRHRLRNR\Rbtapi_userR^t
gitlab_urltgitlab_usertgitlab_passwordtgitlab_tokent
group_namet
group_pathRRRtparent_identifiertgroup_visibilityRR+tgitlab_grouptparent_grouptgroup_exists((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pytmains�	!(								














!!	

)t__main__("t
__future__RRRRIt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtost	tracebackRRpR/R"RoR't
format_excR tansible.module_utils.apiRtansible.module_utils.basicR	R
tansible.module_utils._textRtansible.module_utils.gitlabRtobjectR
RGR�R?(((sO/usr/lib/python2.7/site-packages/ansible/modules/source_control/gitlab_group.pyt<module>s2


H 


l		j

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