Merge pull request #10 from ansible/devel

Rebase from devel
This commit is contained in:
Sean Sullivan
2020-09-09 07:49:37 -05:00
committed by GitHub
105 changed files with 2859 additions and 1233 deletions

View File

@@ -409,7 +409,7 @@ def main():
credentials.append(credential)
new_fields = {}
search_fields = {'name': name}
search_fields = {}
# Attempt to look up the related items the user specified (these will fail the module if not found)
organization_id = None
@@ -419,14 +419,14 @@ def main():
search_fields['organization'] = new_fields['organization'] = organization_id
# Attempt to look up an existing item based on the provided data
existing_item = module.get_one('job_templates', **{'data': search_fields})
existing_item = module.get_one('job_templates', name_or_id=name, **{'data': search_fields})
if state == 'absent':
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
module.delete_if_needed(existing_item)
# Create the data that gets sent for create and update
new_fields['name'] = new_name if new_name else name
new_fields['name'] = new_name if new_name else (module.get_item_name(existing_item) if existing_item else name)
for field_name in (
'description', 'job_type', 'playbook', 'scm_branch', 'forks', 'limit', 'verbosity',
'job_tags', 'force_handlers', 'skip_tags', 'start_at_task', 'timeout', 'use_fact_cache',
@@ -453,9 +453,8 @@ def main():
new_fields['inventory'] = module.resolve_name_to_id('inventories', inventory)
if project is not None:
if organization_id is not None:
project_data = module.get_one('projects', **{
project_data = module.get_one('projects', name_or_id=project, **{
'data': {
'name': project,
'organization': organization_id,
}
})