Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Remove execution_environment selection when empty value is provi… #15603

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions awx_collection/plugins/modules/job_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def update_survey(module, last_request):
if module.params.get('survey_spec') == {}:
response = module.delete_endpoint(spec_endpoint)
if response['status_code'] != 200:
# Not sure how to make this actually return a non 200 to test what to dump in the respinse
# Not sure how to make this actually return a non 200 to test what to dump in the response
module.fail_json(msg="Failed to delete survey: {0}".format(response['json']))
else:
response = module.post_endpoint(spec_endpoint, **{'data': module.params.get('survey_spec')})
Expand All @@ -399,7 +399,7 @@ def main():
credential=dict(),
vault_credential=dict(),
credentials=dict(type='list', elements='str'),
execution_environment=dict(),
execution_environment=dict(type='str'),
custom_virtualenv=dict(),
instance_groups=dict(type="list", elements='str'),
forks=dict(type='int'),
Expand Down Expand Up @@ -479,8 +479,11 @@ def main():
search_fields['organization'] = new_fields['organization'] = organization_id

ee = module.params.get('execution_environment')
if ee:
new_fields['execution_environment'] = module.resolve_name_to_id('execution_environments', ee)
if ee is not None:
if ee == "":
new_fields['execution_environment'] = None
elif ee:
new_fields['execution_environment'] = module.resolve_name_to_id('execution_environments', ee)

# Attempt to look up an existing item based on the provided data
existing_item = module.get_one('job_templates', name_or_id=name, check_exists=(state == 'exists'), **{'data': search_fields})
Expand Down
Loading