diff --git a/awx_collection/tools/templates/tower_module.j2 b/awx_collection/tools/templates/tower_module.j2 index a09ba56481..9f61e1b8fe 100644 --- a/awx_collection/tools/templates/tower_module.j2 +++ b/awx_collection/tools/templates/tower_module.j2 @@ -169,7 +169,7 @@ def main(): {% endif %} {% for association in associations[item_type] | default([]) %} {{ association['related_item'] }}_ids = None - if {{ association['related_item'] }} != None: + if {{ association['related_item'] }} is not None: {{ association['related_item'] }}_ids = [] for item in {{ association['related_item'] }}: {{ association['related_item'] }}_ids.append( module.resolve_name_to_id('{{ association['related_item'] }}', item) ) @@ -194,7 +194,7 @@ def main(): {% if option == name_option %} new_fields['{{ name_option }}'] = new_{{ name_option }} if new_{{ name_option }} else {{ name_option }} {% else %} - if {{ option }} != None: + if {{ option }} is not None: {% if item['json']['actions']['POST'][option]['type'] == 'id' %} new_fields['{{ option }}'] = {{ option }}_id {% else %} @@ -203,10 +203,10 @@ def main(): {% endif %} {% endfor %} - if state == 'absent': + if state is '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) - elif state == 'present': + elif state is 'present': # If the state was present and we can let the module build or update the existing item, this will return on its own module.create_or_update_if_needed( existing_item, new_fields, diff --git a/awx_collection/tools/vars/associations.yml b/awx_collection/tools/vars/associations.yml index 467d83ec27..6f710db3b9 100644 --- a/awx_collection/tools/vars/associations.yml +++ b/awx_collection/tools/vars/associations.yml @@ -4,13 +4,13 @@ associations: - related_item: credentials endpoint: credentials description: "The credentials used by this job template" - required: False + required: false groups: - related_item: hosts endpoint: hosts description: "The hosts associated with this group" - required: False + required: false - related_item: groups endpoint: children description: "The hosts associated with this group" - required: False + required: false