mirror of
https://github.com/ansible/awx.git
synced 2026-04-10 04:29:21 -02:30
fix pep8 issues
This commit is contained in:
@@ -607,11 +607,14 @@ class TowerAPIModule(TowerModule):
|
|||||||
last_data = response['json']
|
last_data = response['json']
|
||||||
return last_data
|
return last_data
|
||||||
|
|
||||||
def create_or_update_if_needed(self, existing_item, new_item, endpoint=None, item_type='unknown', on_create=None, on_update=None, auto_exit=True, associations=None):
|
def create_or_update_if_needed(
|
||||||
|
self, existing_item, new_item, endpoint=None, item_type='unknown', on_create=None, on_update=None, auto_exit=True, associations=None
|
||||||
|
):
|
||||||
if existing_item:
|
if existing_item:
|
||||||
return self.update_if_needed(existing_item, new_item, on_update=on_update, auto_exit=auto_exit, associations=associations)
|
return self.update_if_needed(existing_item, new_item, on_update=on_update, auto_exit=auto_exit, associations=associations)
|
||||||
else:
|
else:
|
||||||
return self.create_if_needed(existing_item, new_item, endpoint, on_create=on_create, item_type=item_type, auto_exit=auto_exit, associations=associations)
|
return self.create_if_needed(
|
||||||
|
existing_item, new_item, endpoint, on_create=on_create, item_type=item_type, auto_exit=auto_exit, associations=associations)
|
||||||
|
|
||||||
def logout(self):
|
def logout(self):
|
||||||
if self.authenticated and self.oauth_token_id:
|
if self.authenticated and self.oauth_token_id:
|
||||||
|
|||||||
@@ -319,11 +319,14 @@ def main():
|
|||||||
# Due to not able to lookup workflow_approval_templates, find the existing item in another place
|
# Due to not able to lookup workflow_approval_templates, find the existing item in another place
|
||||||
if workflow_job_template_node['related'].get('unified_job_template') is not None:
|
if workflow_job_template_node['related'].get('unified_job_template') is not None:
|
||||||
existing_item = module.get_endpoint(workflow_job_template_node['related']['unified_job_template'])['json']
|
existing_item = module.get_endpoint(workflow_job_template_node['related']['unified_job_template'])['json']
|
||||||
|
approval_endpoint = 'workflow_job_template_nodes/' + str(workflow_job_template_node_id) + '/create_approval_template/'
|
||||||
module.create_or_update_if_needed(
|
module.create_or_update_if_needed(
|
||||||
existing_item, new_fields,
|
existing_item, new_fields,
|
||||||
endpoint='workflow_job_template_nodes/' + str(workflow_job_template_node_id) + '/create_approval_template/', item_type='workflow_job_template_approval_node',
|
endpoint=approval_endpoint, item_type='workflow_job_template_approval_node',
|
||||||
associations=association_fields
|
associations=association_fields
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
module.exit_json(**module.json_output)
|
module.exit_json(**module.json_output)
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user