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

Allow empty values for ee in template #14975

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

kk-at-redhat
Copy link

SUMMARY

Added an ability to specify empty value for execution_environment in ansible.controller.job_template module.

related #14841

ISSUE TYPE

Bug, Docs Fix or other nominal change

COMPONENT NAME

Collection

ADDITIONAL INFORMATION

Suggested testing:

    - ansible.controller.export:
        job_templates: 'all'
      register: aap_templates

    - ansible.controller.job_template:
        name: "{{ aap_templates.assets.job_templates[0].name }}"
      ignore_errors: true

    - ansible.controller.job_template:
        name: "{{ aap_templates.assets.job_templates[0].name }}"
        execution_environment: "Control Plane Execution Environment"
      ignore_errors: true

    - ansible.controller.job_template:
        name: "{{ aap_templates.assets.job_templates[0].name }}"
        execution_environment: ""
      ignore_errors: true

    - ansible.controller.job_template:
        name: "{{ aap_templates.assets.job_templates[0].name }}"
        execution_environment: "Control Plane Execution Environment"
      ignore_errors: true

    - ansible.controller.job_template:
        name: "{{ aap_templates.assets.job_templates[0].name }}"
        execution_environment: {}
      ignore_errors: true

    - ansible.controller.job_template:
        name: "{{ aap_templates.assets.job_templates[0].name }}"
        execution_environment: "Control Plane Execution Environment"
      ignore_errors: true

    - ansible.controller.job_template:
        name: "{{ aap_templates.assets.job_templates[0].name }}"
        execution_environment: None
      ignore_errors: true

@github-actions github-actions bot added component:awx_collection issues related to the collection for controlling AWX community labels Mar 10, 2024
@BrandtWoolf
Copy link

FWIW I hit the describe bug and used this code as a workaround. Worked like a charm for me

@jbradberry jbradberry force-pushed the empty_value_fix_for_ee_in_template branch from a1488b1 to 108a72e Compare May 31, 2024 17:21
@@ -479,8 +479,11 @@ def main():
search_fields['organization'] = new_fields['organization'] = organization_id

ee = module.params.get('execution_environment')
if ee:
if ee is not None:
if ee != '' and ee != 'None' and ee != '{}':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also be written as ee not in ['','None' ,'{}']. Could you explain why {} is needed?

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community component:awx_collection issues related to the collection for controlling AWX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants