diff --git a/source_control/gitea_organization.py b/source_control/gitea_organization.py index 6b0942c..b023b22 100644 --- a/source_control/gitea_organization.py +++ b/source_control/gitea_organization.py @@ -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'