mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Make playbook wait for project sync...
...*before* running the associated job template. Set "wait" default to True so CI doesn't time out Change default back to "False", put in new "if"... ...block, explicitly set "wait" to "False" in test file. Change if block Update README Update 'wait' option description
This commit is contained in:
parent
c7cabfa785
commit
eff46dbc71
@ -18,6 +18,7 @@ The following notes are changes that may require changes to playbooks.
|
||||
|
||||
- Specifying `inputs` or `injectors` as strings in the
|
||||
`tower_credential_type` module is no longer supported. Provide as dictionaries instead.
|
||||
- When a project is created, it will wait for the update/sync to finish by default; this can be turned off with the `wait` parameter, if desired.
|
||||
|
||||
## Running
|
||||
|
||||
|
||||
@ -97,6 +97,15 @@ options:
|
||||
default: "present"
|
||||
choices: ["present", "absent"]
|
||||
type: str
|
||||
wait:
|
||||
description:
|
||||
- Provides option (True by default) to wait for completed project sync
|
||||
before returning
|
||||
- Can assure playbook files are populated so that job templates that rely
|
||||
on the project may be successfully created
|
||||
|
||||
type: bool
|
||||
default: True
|
||||
extends_documentation_fragment: awx.awx.auth
|
||||
'''
|
||||
|
||||
@ -150,6 +159,7 @@ def main():
|
||||
custom_virtualenv=dict(),
|
||||
local_path=dict(),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
wait=dict(type='bool', default=True),
|
||||
)
|
||||
|
||||
module = TowerModule(argument_spec=argument_spec, supports_check_mode=True)
|
||||
@ -171,6 +181,7 @@ def main():
|
||||
job_timeout = module.params.get('job_timeout')
|
||||
custom_virtualenv = module.params.get('custom_virtualenv')
|
||||
state = module.params.get('state')
|
||||
wait = module.params.get('wait')
|
||||
|
||||
json_output = {'project': name, 'state': state}
|
||||
|
||||
@ -212,6 +223,8 @@ def main():
|
||||
custom_virtualenv=custom_virtualenv,
|
||||
create_on_missing=True)
|
||||
json_output['id'] = result['id']
|
||||
if wait:
|
||||
project.wait(pk=None, parent_pk=result['id'])
|
||||
elif state == 'absent':
|
||||
result = project.delete(name=name)
|
||||
except (exc.ConnectionError, exc.BadRequest, exc.AuthError) as excinfo:
|
||||
|
||||
@ -12,7 +12,8 @@ def test_create_project(run_module, admin_user, organization):
|
||||
name='foo',
|
||||
organization=organization.name,
|
||||
scm_type='git',
|
||||
scm_url='https://foo.invalid'
|
||||
scm_url='https://foo.invalid',
|
||||
wait=False
|
||||
), admin_user)
|
||||
assert result.pop('changed', None), result
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user