basic org creation
This commit is contained in:
parent
9f45999fde
commit
e51e465709
|
@ -83,9 +83,7 @@ def run_module():
|
|||
gitea_url=dict(type='str', required=True),
|
||||
|
||||
username=dict(type='str', required=True),
|
||||
# TODO support "username": "string",
|
||||
name=dict(type='bool', required=False, default=False)
|
||||
# TODO support "full_name": "string", <- name
|
||||
|
||||
# TODO support "description": "string",
|
||||
# TODO support "location": "string",
|
||||
|
@ -124,7 +122,21 @@ def run_module():
|
|||
result['gitea_response'] = req_org.json()
|
||||
result['state'] = 'present'
|
||||
if req_org.status_code == 404:
|
||||
##TODO create
|
||||
data = {
|
||||
#TODO "description": "string",
|
||||
"full_name": module.params['name'],
|
||||
#TODO "location": "string",
|
||||
#TODO "repo_admin_change_team_access": true,
|
||||
"username": module.params['username'],
|
||||
#TODO "visibility": "public",
|
||||
#TODO "website": "string"
|
||||
}
|
||||
create_req = requests.post(gitea_url+'/api/v1/orgs'+'?access_token='+gitea_token, headers=headers, data=json.dumps(data))
|
||||
if create_req.status_code != 201:
|
||||
result['gitea_response'] = create_req.json()
|
||||
module.fail_json(msg="Creation failed", **result)
|
||||
else:
|
||||
result['gitea_response'] = create_req.json()
|
||||
result['changed'] = True
|
||||
result['state'] = 'present'
|
||||
|
||||
|
|
Loading…
Reference in New Issue