Provide better module return info from gitea create repos
Be more correct about changed and failures. Change-Id: I0b37b1bd85efc35233d864ca7801a8862806467f
This commit is contained in:
parent
47bd535d60
commit
1e18651565
@ -39,6 +39,7 @@ class Gitea(object):
|
||||
self.orgs = { f['project'].split('/')[0] for f in self.projects }
|
||||
self._log = []
|
||||
self.session = requests.Session()
|
||||
self.failed = False
|
||||
|
||||
def log(self, *args):
|
||||
now = datetime.datetime.utcnow().isoformat()
|
||||
@ -195,6 +196,7 @@ class Gitea(object):
|
||||
r = f.result()
|
||||
except Exception as e:
|
||||
self.log(str(e))
|
||||
self.failed = True
|
||||
thread_pool.shutdown()
|
||||
|
||||
|
||||
@ -221,7 +223,11 @@ def ansible_main():
|
||||
except Exception as e:
|
||||
module.fail_json(msg=str(e), changed=True)
|
||||
|
||||
module.exit_json(changed=True, log=gitea.get_log())
|
||||
log = gitea.get_log()
|
||||
if gitea.failed:
|
||||
module.fail_json(msg="Failure during repo creation, see log",
|
||||
changed=bool(log), log=log)
|
||||
module.exit_json(changed=bool(log), log=log)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user