fix documentation

This commit is contained in:
sean-m-sullivan
2020-08-11 09:38:18 -05:00
parent 262b2bf8ff
commit 813e38636a

View File

@@ -21,20 +21,20 @@ description:
options: options:
name: name:
description: description:
- The name of the workflow template to run. - The name of the project to update.
required: True required: True
type: str type: str
aliases: aliases:
- project - project
organization: organization:
description: description:
- Organization the workflow job template exists in. - Organization the project exists in.
- Used to help lookup the object, cannot be modified using this module. - Used to help lookup the object, cannot be modified using this module.
- If not provided, will lookup by name only, which does not work with duplicates. - If not provided, will lookup by name only, which does not work with duplicates.
type: str type: str
wait: wait:
description: description:
- Wait for the workflow to complete. - Wait for the project to update.
default: True default: True
type: bool type: bool
interval: interval:
@@ -45,14 +45,14 @@ options:
type: float type: float
timeout: timeout:
description: description:
- If waiting for the workflow to complete this will abort after this - If waiting for the project to update this will abort after this
amount of seconds amount of seconds
type: int type: int
extends_documentation_fragment: awx.awx.auth extends_documentation_fragment: awx.awx.auth
''' '''
RETURN = ''' RETURN = '''
job_info: project_info:
description: dictionary containing information about the project updated description: dictionary containing information about the project updated
returned: If project synced returned: If project synced
type: dict type: dict
@@ -60,12 +60,12 @@ job_info:
EXAMPLES = ''' EXAMPLES = '''
- name: Launch a workflow with a timeout of 10 seconds - name: Launch a project with a timeout of 10 seconds
tower_project_update: tower_project_update:
project: "Networking Project" project: "Networking Project"
timeout: 10 timeout: 10
- name: Launch a Workflow with extra_vars without waiting - name: Launch a Project with extra_vars without waiting
tower_project_update: tower_project_update:
project: "Networking Project" project: "Networking Project"
wait: False wait: False
@@ -103,9 +103,9 @@ def main():
project = module.get_one('projects', data=lookup_data) project = module.get_one('projects', data=lookup_data)
if project is None: if project is None:
module.fail_json(msg="Unable to find workflow job template") module.fail_json(msg="Unable to find project")
# Launch the job # Update the project
result = module.post_endpoint(project['related']['update']) result = module.post_endpoint(project['related']['update'])
if result['status_code'] != 202: if result['status_code'] != 202:
@@ -121,7 +121,7 @@ def main():
# Grab our start time to compare against for the timeout # Grab our start time to compare against for the timeout
start = time.time() start = time.time()
job_url = result['json']['url'] project_url = result['json']['url']
while not result['json']['finished']: while not result['json']['finished']:
# If we are past our time out fail with a message # If we are past our time out fail with a message
if timeout and timeout < time.time() - start: if timeout and timeout < time.time() - start:
@@ -131,7 +131,7 @@ def main():
# Put the process to sleep for our interval # Put the process to sleep for our interval
time.sleep(interval) time.sleep(interval)
result = module.get_endpoint(job_url) result = module.get_endpoint(project_url)
module.json_output['status'] = result['json']['status'] module.json_output['status'] = result['json']['status']
# If the update has failed, we want to raise a task failure for that so we get a non-zero response. # If the update has failed, we want to raise a task failure for that so we get a non-zero response.