From 09362a2d98d3528622697342775f812ac3ae2b78 Mon Sep 17 00:00:00 2001 From: Ashwini Mhatre Date: Wed, 28 Dec 2022 12:37:35 +0530 Subject: [PATCH] Fix ansible lint issues (#235) * Fix ansible-lint issues --- changelogs/fragments/fix_ansible_lint.yaml | 3 ++ .../utils_cli_parse/tasks/argspec.yaml | 16 ++++----- .../utils_cli_parse/tasks/centos_textfsm.yaml | 4 +-- .../utils_cli_parse/tasks/centos_ttp.yaml | 4 +-- .../utils_cli_parse/tasks/fedora_textfsm.yaml | 4 +-- .../utils_cli_parse/tasks/fedora_ttp.yaml | 4 +-- .../targets/utils_cli_parse/tasks/main.yaml | 33 ++++++++++++------- .../utils_cli_parse/tasks/nxos_json.yaml | 7 ++-- .../utils_cli_parse/tasks/nxos_textfsm.yaml | 7 ++-- .../utils_cli_parse/tasks/nxos_ttp.yaml | 15 +++++---- .../utils_cli_parse/tasks/nxos_xml.yaml | 7 ++-- .../utils_cli_parse/tasks/ubuntu_textfsm.yaml | 4 +-- .../utils_cli_parse/tasks/ubuntu_ttp.yaml | 4 +-- .../targets/utils_consolidate/tasks/main.yaml | 3 +- .../utils_consolidate/tasks/simple.yaml | 4 +-- .../utils_fact_diff/tasks/argspec.yaml | 20 ++++++----- .../utils_fact_diff/tasks/examples.yaml | 5 +-- .../targets/utils_fact_diff/tasks/main.yaml | 3 +- .../targets/utils_fact_diff/tasks/simple.yaml | 3 +- .../targets/utils_from_xml/tasks/main.yaml | 3 +- .../targets/utils_from_xml/tasks/simple.yaml | 6 ++-- .../targets/utils_get_path/tasks/argspec.yaml | 9 +++-- .../utils_get_path/tasks/examples_filter.yaml | 5 +-- .../utils_get_path/tasks/examples_lookup.yaml | 5 +-- .../targets/utils_get_path/tasks/main.yaml | 3 +- .../targets/utils_get_path/tasks/simple.yaml | 10 +++--- .../targets/utils_index_of/tasks/argspec.yaml | 15 ++++++--- .../utils_index_of/tasks/examples_filter.yaml | 18 ++++++---- .../utils_index_of/tasks/examples_lookup.yaml | 20 ++++++----- .../targets/utils_index_of/tasks/main.yaml | 3 +- .../targets/utils_index_of/tasks/simple.yaml | 26 ++++++++------- .../utils_ipaddr_filter/tasks/ipaddr.yaml | 5 +-- .../utils_ipaddr_filter/tasks/ipv4.yaml | 2 +- .../utils_ipaddr_filter/tasks/ipv6.yaml | 2 +- .../utils_ipaddr_filter/tasks/ipwrap.yaml | 2 +- .../utils_ipaddr_filter/tasks/main.yaml | 3 +- .../tasks/network_in_network.yaml | 4 +-- .../tasks/network_in_usable.yaml | 4 +-- .../utils_ipaddr_filter/vars/main.yaml | 2 +- .../targets/utils_keep_keys/tasks/main.yaml | 3 +- .../targets/utils_keep_keys/tasks/simple.yaml | 6 ++-- .../utils_netaddr_test/tasks/main.yaml | 3 +- .../utils_netaddr_test/tasks/resolvable.yml | 6 ++-- .../utils_param_list_compare/tasks/main.yaml | 3 +- .../tasks/simple.yaml | 7 ++-- .../targets/utils_remove_keys/tasks/main.yaml | 3 +- .../utils_remove_keys/tasks/simple.yaml | 3 +- .../utils_replace_keys/tasks/main.yaml | 3 +- .../utils_replace_keys/tasks/simple.yaml | 3 +- .../targets/utils_to_paths/tasks/argspec.yaml | 17 +++++++--- .../utils_to_paths/tasks/empty_members.yaml | 3 +- .../utils_to_paths/tasks/examples_filter.yaml | 6 ++-- .../utils_to_paths/tasks/examples_lookup.yaml | 6 ++-- .../targets/utils_to_paths/tasks/main.yaml | 3 +- .../targets/utils_to_paths/tasks/simple.yaml | 14 ++++---- .../targets/utils_to_xml/tasks/main.yaml | 3 +- .../targets/utils_to_xml/tasks/simple.yaml | 9 ++--- .../targets/utils_to_xml/vars/main.yaml | 2 ++ .../targets/utils_update_fact/tasks/main.yaml | 9 +++-- .../utils_usable_range/tasks/argspec.yml | 21 ++++++++---- .../targets/utils_usable_range/tasks/main.yml | 3 +- .../targets/utils_validate/tasks/main.yaml | 3 +- 62 files changed, 267 insertions(+), 169 deletions(-) create mode 100644 changelogs/fragments/fix_ansible_lint.yaml create mode 100644 tests/integration/targets/utils_to_xml/vars/main.yaml diff --git a/changelogs/fragments/fix_ansible_lint.yaml b/changelogs/fragments/fix_ansible_lint.yaml new file mode 100644 index 0000000..c0dc1b7 --- /dev/null +++ b/changelogs/fragments/fix_ansible_lint.yaml @@ -0,0 +1,3 @@ +--- +trivial: + - Fix ansible-lint errors diff --git a/tests/integration/targets/utils_cli_parse/tasks/argspec.yaml b/tests/integration/targets/utils_cli_parse/tasks/argspec.yaml index 09d750f..b85e51a 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/argspec.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/argspec.yaml @@ -1,5 +1,5 @@ --- -- name: "{{ parser }} validate argspec" +- name: "validate argspec {{ parser }}" ansible.utils.cli_parse: text: "" parser: @@ -9,13 +9,13 @@ register: argfail ignore_errors: true -- name: "{{ parser }} Check argspec fail" +- name: "Check argspec fail {{ parser }}" ansible.builtin.assert: that: "{{ msg in argfail.errors }}" vars: msg: "parameters are mutually exclusive: command|template_path found in parser" -- name: "{{ parser }} validate argspec" +- name: "validate argspec {{ parser }}" ansible.utils.cli_parse: text: "" command: ls @@ -25,13 +25,13 @@ register: argfail ignore_errors: true -- name: "{{ parser }} Check argspec fail" +- name: "Check argspec fail {{ parser }}" ansible.builtin.assert: that: "{{ msg in argfail.errors }}" vars: msg: "parameters are mutually exclusive: command|text" -- name: "{{ parser }} validate argspec" +- name: "validate argspec {{ parser }}" ansible.utils.cli_parse: parser: name: ansible.netcommon.json @@ -39,13 +39,13 @@ register: argfail ignore_errors: true -- name: "{{ parser }} Check argspec fail" +- name: "Check argspec fail {{ parser }}" ansible.builtin.assert: that: "{{ msg in argfail.errors }}" vars: msg: "one of the following is required: command, text" -- name: "{{ parser }} validate argspec" +- name: "validate argspec {{ parser }}" ansible.utils.cli_parse: text: "" parser: @@ -54,7 +54,7 @@ register: argfail ignore_errors: true -- name: "{{ parser }} Check arspec fail" +- name: "Check arspec fail {{ parser }}" ansible.builtin.assert: that: "{{ msg in argfail.msg }}" vars: diff --git a/tests/integration/targets/utils_cli_parse/tasks/centos_textfsm.yaml b/tests/integration/targets/utils_cli_parse/tasks/centos_textfsm.yaml index b4b8db8..626acca 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/centos_textfsm.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/centos_textfsm.yaml @@ -1,5 +1,5 @@ --- -- name: "{{ parser }} Run command and parse with textfsm" +- name: "Run command and parse with textfsm {{ parser }}" ansible.utils.cli_parse: command: "ifconfig" parser: @@ -7,7 +7,7 @@ ansible.builtin.set_fact: myfact register: ifconfig_out -- name: "{{ parser }} Check parser output" +- name: "Check parser output {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/centos_ttp.yaml b/tests/integration/targets/utils_cli_parse/tasks/centos_ttp.yaml index 15e49d9..6868d4f 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/centos_ttp.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/centos_ttp.yaml @@ -1,5 +1,5 @@ --- -- name: "{{ parser }} Run command and parse with ttp" +- name: "Run command and parse with ttp {{ parser }}" ansible.utils.cli_parse: command: "df -h" parser: @@ -7,7 +7,7 @@ ansible.builtin.set_fact: myfact register: df_h_out -- name: "{{ parser }} Check parser output" +- name: "Check parser output {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/fedora_textfsm.yaml b/tests/integration/targets/utils_cli_parse/tasks/fedora_textfsm.yaml index b4b8db8..626acca 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/fedora_textfsm.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/fedora_textfsm.yaml @@ -1,5 +1,5 @@ --- -- name: "{{ parser }} Run command and parse with textfsm" +- name: "Run command and parse with textfsm {{ parser }}" ansible.utils.cli_parse: command: "ifconfig" parser: @@ -7,7 +7,7 @@ ansible.builtin.set_fact: myfact register: ifconfig_out -- name: "{{ parser }} Check parser output" +- name: "Check parser output {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/fedora_ttp.yaml b/tests/integration/targets/utils_cli_parse/tasks/fedora_ttp.yaml index 15e49d9..6868d4f 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/fedora_ttp.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/fedora_ttp.yaml @@ -1,5 +1,5 @@ --- -- name: "{{ parser }} Run command and parse with ttp" +- name: "Run command and parse with ttp {{ parser }}" ansible.utils.cli_parse: command: "df -h" parser: @@ -7,7 +7,7 @@ ansible.builtin.set_fact: myfact register: df_h_out -- name: "{{ parser }} Check parser output" +- name: "Check parser output {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/main.yaml b/tests/integration/targets/utils_cli_parse/tasks/main.yaml index 7b73a8b..31843f4 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/main.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/main.yaml @@ -3,29 +3,34 @@ ansible.builtin.set_fact: os: "{{ ansible_distribution|d }}" -- ansible.builtin.include_tasks: argspec.yaml +- name: Include argspec.yaml + ansible.builtin.include_tasks: argspec.yaml vars: parser: "({{ inventory_hostname }}/argspec)" -- ansible.builtin.include_tasks: "nxos_json.yaml" +- name: Include nxos_json.yaml + ansible.builtin.include_tasks: "nxos_json.yaml" vars: parser: "(nxos/json)" tags: - json -- ansible.builtin.include_tasks: "nxos_textfsm.yaml" +- name: Include nxos_textfsm.yaml + ansible.builtin.include_tasks: "nxos_textfsm.yaml" vars: parser: "(nxos/textfsm)" tags: - textfsm -- ansible.builtin.include_tasks: "nxos_ttp.yaml" +- name: Include nxos_ttp.yaml + ansible.builtin.include_tasks: "nxos_ttp.yaml" vars: parser: "(nxos/ttp)" tags: - ttp -- ansible.builtin.include_tasks: "nxos_xml.yaml" +- name: Include nxos_xml.yaml + ansible.builtin.include_tasks: "nxos_xml.yaml" vars: parser: "(nxos/xml)" tags: @@ -35,42 +40,48 @@ ansible.builtin.debug: msg: "{{ os }}" -- ansible.builtin.include_tasks: "centos_textfsm.yaml" +- name: Include centos_textfsm.yaml + ansible.builtin.include_tasks: "centos_textfsm.yaml" vars: parser: "(centos/textfsm)" when: os == 'centos' tags: - textfsm -- ansible.builtin.include_tasks: "centos_ttp.yaml" +- name: Include centos_ttp.yaml + ansible.builtin.include_tasks: "centos_ttp.yaml" vars: parser: "(centos/ttp)" when: os == 'centos' tags: - ttp -- ansible.builtin.include_tasks: "fedora_textfsm.yaml" +- name: Include fedora_textfsm.yaml + ansible.builtin.include_tasks: "fedora_textfsm.yaml" vars: parser: "(fedora/textfsm)" when: os == 'fedora' tags: - textfsm -- ansible.builtin.include_tasks: "fedora_ttp.yaml" +- name: Include fedora_ttp.yaml + ansible.builtin.include_tasks: "fedora_ttp.yaml" vars: parser: "(fedora/ttp)" when: os == 'fedora' tags: - ttp -- ansible.builtin.include_tasks: "ubuntu_textfsm.yaml" +- name: Include ubuntu_textfsm.yaml + ansible.builtin.include_tasks: "ubuntu_textfsm.yaml" vars: parser: "(ubuntu/textfsm)" when: os == 'ubuntu' tags: - textfsm -- ansible.builtin.include_tasks: "ubuntu_ttp.yaml" +- name: Include ubuntu_ttp.yaml + ansible.builtin.include_tasks: "ubuntu_ttp.yaml" vars: parser: "(ubuntu/ttp)" when: os == 'ubuntu' diff --git a/tests/integration/targets/utils_cli_parse/tasks/nxos_json.yaml b/tests/integration/targets/utils_cli_parse/tasks/nxos_json.yaml index fe3ee58..32e1233 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/nxos_json.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/nxos_json.yaml @@ -1,15 +1,16 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: nxos_json_text_parsed: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_interface_json_text.txt') }}" -- name: "{{ parser }} Run command and parse with json" +- name: "Run command and parse with json {{ parser }}" ansible.utils.cli_parse: text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_interface_json_text.txt') }}" parser: name: ansible.utils.json register: nxos_json_text -- name: "{{ parser }} Confirm response" +- name: "Confirm response {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/nxos_textfsm.yaml b/tests/integration/targets/utils_cli_parse/tasks/nxos_textfsm.yaml index 9d315e3..06b0588 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/nxos_textfsm.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/nxos_textfsm.yaml @@ -1,8 +1,9 @@ --- -- ansible.builtin.set_fact: +- name: set fact + ansible.builtin.set_fact: nxos_textfsm_text_parsed: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_version_textfsm_parsed.json') | from_json }}" -- name: "{{ parser }} Pass text and command" +- name: "Pass text and command {{ parser }}" ansible.utils.cli_parse: text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_version.txt') }}" parser: @@ -10,7 +11,7 @@ template_path: "{{ role_path }}/templates/nxos_show_version.textfsm" register: nxos_textfsm_text -- name: "{{ parser }} Confirm response" +- name: "Confirm response {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/nxos_ttp.yaml b/tests/integration/targets/utils_cli_parse/tasks/nxos_ttp.yaml index b56f124..0da344d 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/nxos_ttp.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/nxos_ttp.yaml @@ -1,8 +1,9 @@ --- -- ansible.builtin.set_fact: +- name: set fact + ansible.builtin.set_fact: nxos_ttp_text_parsed: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_interface_ttp_parsed.json') | from_json }}" -- name: "{{ parser }} Pass text and template_path" +- name: "Pass text and template_path {{ parser }}" ansible.utils.cli_parse: text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_interface.txt') }}" parser: @@ -11,14 +12,14 @@ set_fact: POpqMQoJWTiDpEW register: nxos_ttp_text -- name: "{{ parser }} Confirm response" +- name: "Confirm response {{ parser }}" ansible.builtin.assert: that: - "{{ POpqMQoJWTiDpEW is defined }}" - "{{ nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length }}" - "{{ nxos_ttp_text['parsed'] == nxos_ttp_text_parsed }}" -- name: "{{ parser }} Pass text and custom variable" +- name: "Pass text and custom variable {{ parser }}" ansible.utils.cli_parse: text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_interface.txt') }}" parser: @@ -29,13 +30,13 @@ extra_var: some_text register: nxos_ttp_vars -- name: "{{ parser }} Confirm modified results" +- name: "Confirm modified results {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: - "{{ nxos_ttp_vars['parsed'][0][0][0]['var'] == 'some_text' }}" -- name: "{{ parser }} Pass text and ttp_results modified" +- name: "Pass text and ttp_results modified {{ parser }}" ansible.utils.cli_parse: text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_interface.txt') }}" parser: @@ -46,7 +47,7 @@ format: yaml register: nxos_ttp_results -- name: "{{ parser }} Confirm modified results" +- name: "Confirm modified results {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/nxos_xml.yaml b/tests/integration/targets/utils_cli_parse/tasks/nxos_xml.yaml index 4dc7555..d3141d3 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/nxos_xml.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/nxos_xml.yaml @@ -1,8 +1,9 @@ --- -- ansible.builtin.set_fact: +- name: set fact + ansible.builtin.set_fact: nxos_xml_text_parsed: "{{ lookup('ansible.builtin.file', '{{ role_path }}/output/nxos_show_interface_xml_parsed.json') | from_json }}" -- name: "{{ parser }} Pass text and parse with xml" +- name: "Pass text and parse with xml {{ parser }}" ansible.utils.cli_parse: text: "{{ lookup('ansible.builtin.file', '{{ role_path }}/files/nxos_show_interface.xml') }}" parser: @@ -10,7 +11,7 @@ os: nxos register: nxos_xml_text -- name: "{{ parser }} Confirm response" +- name: "Confirm response {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/ubuntu_textfsm.yaml b/tests/integration/targets/utils_cli_parse/tasks/ubuntu_textfsm.yaml index b4b8db8..626acca 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/ubuntu_textfsm.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/ubuntu_textfsm.yaml @@ -1,5 +1,5 @@ --- -- name: "{{ parser }} Run command and parse with textfsm" +- name: "Run command and parse with textfsm {{ parser }}" ansible.utils.cli_parse: command: "ifconfig" parser: @@ -7,7 +7,7 @@ ansible.builtin.set_fact: myfact register: ifconfig_out -- name: "{{ parser }} Check parser output" +- name: "Check parser output {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_cli_parse/tasks/ubuntu_ttp.yaml b/tests/integration/targets/utils_cli_parse/tasks/ubuntu_ttp.yaml index 15e49d9..6868d4f 100644 --- a/tests/integration/targets/utils_cli_parse/tasks/ubuntu_ttp.yaml +++ b/tests/integration/targets/utils_cli_parse/tasks/ubuntu_ttp.yaml @@ -1,5 +1,5 @@ --- -- name: "{{ parser }} Run command and parse with ttp" +- name: "Run command and parse with ttp {{ parser }}" ansible.utils.cli_parse: command: "df -h" parser: @@ -7,7 +7,7 @@ ansible.builtin.set_fact: myfact register: df_h_out -- name: "{{ parser }} Check parser output" +- name: "Check parser output {{ parser }}" ansible.builtin.assert: that: "{{ item }}" with_items: diff --git a/tests/integration/targets/utils_consolidate/tasks/main.yaml b/tests/integration/targets/utils_consolidate/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_consolidate/tasks/main.yaml +++ b/tests/integration/targets/utils_consolidate/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_consolidate/tasks/simple.yaml b/tests/integration/targets/utils_consolidate/tasks/simple.yaml index be42dae..365dec5 100644 --- a/tests/integration/targets/utils_consolidate/tasks/simple.yaml +++ b/tests/integration/targets/utils_consolidate/tasks/simple.yaml @@ -10,12 +10,12 @@ [ { "description": "This is a user template", - "enabled": True, + "enabled": true, "name": "GigabitEthernet0/1", }, { "description": "This is a user template", - "enabled": True, + "enabled": true, "name": "GigabitEthernet0/2", }, ] diff --git a/tests/integration/targets/utils_fact_diff/tasks/argspec.yaml b/tests/integration/targets/utils_fact_diff/tasks/argspec.yaml index 1ef3356..0f5a212 100644 --- a/tests/integration/targets/utils_fact_diff/tasks/argspec.yaml +++ b/tests/integration/targets/utils_fact_diff/tasks/argspec.yaml @@ -4,7 +4,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ string in result.msg }}" loop: - "missing required arguments:" @@ -12,13 +13,14 @@ - after loop_control: loop_var: string - when: "{{result.msg|type_debug != 'list'}}" + when: "result.msg | type_debug != 'list'" -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "missing required arguments: after, before" - when: "{{result.msg|type_debug == 'list'}}" + when: "result.msg | type_debug == 'list'" - name: Check argspec validation, skip_lines must be a dict ansible.utils.fact_diff: @@ -31,10 +33,12 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ 'unable to convert to list' in result.msg }}" - when: "{{result.msg|type_debug != 'list'}}" + when: "result.msg | type_debug != 'list'" -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ 'unable to convert to list' in result.msg[0] }}" - when: "{{result.msg|type_debug == 'list'}}" + when: "result.msg | type_debug == 'list'" diff --git a/tests/integration/targets/utils_fact_diff/tasks/examples.yaml b/tests/integration/targets/utils_fact_diff/tasks/examples.yaml index 2397d04..b68d711 100644 --- a/tests/integration/targets/utils_fact_diff/tasks/examples.yaml +++ b/tests/integration/targets/utils_fact_diff/tasks/examples.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: before: a: b: @@ -75,7 +76,7 @@ #### Show the difference between complex object using restconf # ansible_connection: ansible.netcommon.httpapi -# ansible_httpapi_use_ssl: True +# ansible_httpapi_use_ssl: true # ansible_httpapi_validate_certs: False # ansible_network_os: ansible.netcommon.restconf diff --git a/tests/integration/targets/utils_fact_diff/tasks/main.yaml b/tests/integration/targets/utils_fact_diff/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_fact_diff/tasks/main.yaml +++ b/tests/integration/targets/utils_fact_diff/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_fact_diff/tasks/simple.yaml b/tests/integration/targets/utils_fact_diff/tasks/simple.yaml index ce9d523..4a2ed72 100644 --- a/tests/integration/targets/utils_fact_diff/tasks/simple.yaml +++ b/tests/integration/targets/utils_fact_diff/tasks/simple.yaml @@ -10,7 +10,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "The regex '+', is not valid" diff --git a/tests/integration/targets/utils_from_xml/tasks/main.yaml b/tests/integration/targets/utils_from_xml/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_from_xml/tasks/main.yaml +++ b/tests/integration/targets/utils_from_xml/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_from_xml/tasks/simple.yaml b/tests/integration/targets/utils_from_xml/tasks/simple.yaml index 282af08..013c8a0 100644 --- a/tests/integration/targets/utils_from_xml/tasks/simple.yaml +++ b/tests/integration/targets/utils_from_xml/tasks/simple.yaml @@ -13,7 +13,8 @@ }, } -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "{{ data|ansible.utils.from_xml() }}" - name: Integration tests with and without default engine as xmltodict and @@ -33,7 +34,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "Error when using plugin 'from_xml': Input Xml is not valid" diff --git a/tests/integration/targets/utils_get_path/tasks/argspec.yaml b/tests/integration/targets/utils_get_path/tasks/argspec.yaml index c6145f1..c13fa6c 100644 --- a/tests/integration/targets/utils_get_path/tasks/argspec.yaml +++ b/tests/integration/targets/utils_get_path/tasks/argspec.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -13,7 +14,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "missing required arguments: path" @@ -24,7 +26,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ item in result.msg }}" loop: - "missing required arguments:" diff --git a/tests/integration/targets/utils_get_path/tasks/examples_filter.yaml b/tests/integration/targets/utils_get_path/tasks/examples_filter.yaml index 25ce94e..4dc7154 100644 --- a/tests/integration/targets/utils_get_path/tasks/examples_filter.yaml +++ b/tests/integration/targets/utils_get_path/tasks/examples_filter.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -66,7 +67,7 @@ # ok: [nxos101] => (item=a.b.c.d[1]) => # msg: The value of path a.b.c.d[1] in vars is 1 # ok: [nxos101] => (item=a.b.c.e[0]) => -# msg: The value of path a.b.c.e[0] in vars is True +# msg: The value of path a.b.c.e[0] in vars is true # ok: [nxos101] => (item=a.b.c.e[1]) => # msg: The value of path a.b.c.e[1] in vars is False diff --git a/tests/integration/targets/utils_get_path/tasks/examples_lookup.yaml b/tests/integration/targets/utils_get_path/tasks/examples_lookup.yaml index 115d9bc..1121ac0 100644 --- a/tests/integration/targets/utils_get_path/tasks/examples_lookup.yaml +++ b/tests/integration/targets/utils_get_path/tasks/examples_lookup.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -66,7 +67,7 @@ # ok: [nxos101] => (item=a.b.c.d[1]) => # msg: The value of path a.b.c.d[1] in vars is 1 # ok: [nxos101] => (item=a.b.c.e[0]) => -# msg: The value of path a.b.c.e[0] in vars is True +# msg: The value of path a.b.c.e[0] in vars is true # ok: [nxos101] => (item=a.b.c.e[1]) => # msg: The value of path a.b.c.e[1] in vars is False diff --git a/tests/integration/targets/utils_get_path/tasks/main.yaml b/tests/integration/targets/utils_get_path/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_get_path/tasks/main.yaml +++ b/tests/integration/targets/utils_get_path/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_get_path/tasks/simple.yaml b/tests/integration/targets/utils_get_path/tasks/simple.yaml index ea0e468..d31a874 100644 --- a/tests/integration/targets/utils_get_path/tasks/simple.yaml +++ b/tests/integration/targets/utils_get_path/tasks/simple.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -40,7 +41,8 @@ - result: '{{ lookup(''ansible.utils.get_path'', a, ''b["c"]'') }}' expected: "{{ a.b.c }}" -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -51,9 +53,9 @@ ansible.builtin.assert: that: "{{ item.result == item.expected }}" loop: - - result: "{{ vars|ansible.utils.get_path('a.b.c.d[0]', wantlist=True) }}" + - result: "{{ vars|ansible.utils.get_path('a.b.c.d[0]', wantlist=true) }}" expected: - "{{ a.b.c.d[0] }}" - - result: "{{ lookup('ansible.utils.get_path', vars, 'a.b.c.d[0]', wantlist=True) }}" + - result: "{{ lookup('ansible.utils.get_path', vars, 'a.b.c.d[0]', wantlist=true) }}" expected: - "{{ a.b.c.d[0] }}" diff --git a/tests/integration/targets/utils_index_of/tasks/argspec.yaml b/tests/integration/targets/utils_index_of/tasks/argspec.yaml index bfc8e41..890b3c6 100644 --- a/tests/integration/targets/utils_index_of/tasks/argspec.yaml +++ b/tests/integration/targets/utils_index_of/tasks/argspec.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: complex: a: b: @@ -17,7 +18,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "cannot be converted to a list" @@ -28,7 +30,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "missing required arguments: test" @@ -39,7 +42,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "cannot be converted to a list" @@ -50,7 +54,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ item in result.msg }}" loop: - "missing required arguments:" diff --git a/tests/integration/targets/utils_index_of/tasks/examples_filter.yaml b/tests/integration/targets/utils_index_of/tasks/examples_filter.yaml index c3a2778..d2d8800 100644 --- a/tests/integration/targets/utils_index_of/tasks/examples_filter.yaml +++ b/tests/integration/targets/utils_index_of/tasks/examples_filter.yaml @@ -1,6 +1,7 @@ --- #### Simple examples -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: data: - 1 - 2 @@ -17,7 +18,7 @@ - name: Find the index of 2, ensure list is returned ansible.builtin.set_fact: - indices: "{{ data|ansible.utils.index_of('eq', 2, wantlist=True) }}" + indices: "{{ data|ansible.utils.index_of('eq', 2, wantlist=true) }}" # TASK [Find the index of 2, ensure list is returned] ************************ # ok: [nxos101] => changed=false @@ -27,7 +28,7 @@ - name: Find the index of 3 using the long format ansible.builtin.set_fact: - indices: "{{ data|ansible.utils.index_of(test='eq', value=value, wantlist=True) }}" + indices: "{{ data|ansible.utils.index_of(test='eq', value=value, wantlist=true) }}" vars: value: 3 @@ -53,7 +54,8 @@ #### Working with lists of dictionaries -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: data: - name: sw01.example.lan type: switch @@ -93,7 +95,8 @@ msg: "The device named {{ data[item].name }} is a {{ data[item].type }}" loop: "{{ data|ansible.utils.index_of('regex', expression, 'name') }}" vars: - expression: '\.corp$' # ends with .corp + expression: '\.corp$' +# ends with .corp # TASK [Find the index of all devices with a .corp name] ********************* # ok: [nxos101] => (item=2) => @@ -126,7 +129,7 @@ # vars: # found: [] # ip: '192.168.101.' -# address: "{{ item.1.ipv4|d([])|ansible.utils.index_of('search', ip, 'address', wantlist=True) }}" +# address: "{{ item.1.ipv4|d([])|ansible.utils.index_of('search', ip, 'address', wantlist=true) }}" # entry: # - interface_idx: "{{ item.0 }}" # address_idxs: "{{ address }}" @@ -153,7 +156,8 @@ #### Working with deeply nested data -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: data: interfaces: interface: diff --git a/tests/integration/targets/utils_index_of/tasks/examples_lookup.yaml b/tests/integration/targets/utils_index_of/tasks/examples_lookup.yaml index 586baf8..83df8b5 100644 --- a/tests/integration/targets/utils_index_of/tasks/examples_lookup.yaml +++ b/tests/integration/targets/utils_index_of/tasks/examples_lookup.yaml @@ -1,6 +1,7 @@ --- #### Simple examples -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: data: - 1 - 2 @@ -17,7 +18,7 @@ - name: Find the index of 2, ensure list is returned ansible.builtin.set_fact: - indices: "{{ lookup('ansible.utils.index_of', data, 'eq', 2, wantlist=True) }}" + indices: "{{ lookup('ansible.utils.index_of', data, 'eq', 2, wantlist=true) }}" # TASK [Find the index of 2, ensure list is returned] ************************ # ok: [nxos101] => changed=false @@ -27,7 +28,7 @@ - name: Find the index of 3 using the long format ansible.builtin.set_fact: - indices: "{{ lookup('ansible.utils.index_of', data=data, test='eq', value=value, wantlist=True) }}" + indices: "{{ lookup('ansible.utils.index_of', data=data, test='eq', value=value, wantlist=true) }}" vars: value: 3 @@ -37,7 +38,7 @@ # indices: # - 2 -#- name: Find numbers greater than 1, using loop +# - name: Find numbers greater than 1, using loop # ansible.builtin.debug: # msg: "{{ data[item] }} is {{ test }} than {{ value }}" # loop: "{{ lookup('ansible.utils.index_of', data, test, value) }}" @@ -69,7 +70,8 @@ #### Working with lists of dictionaries -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: data: - name: sw01.example.lan type: switch @@ -109,7 +111,8 @@ msg: "The device named {{ data[item].name }} is a {{ data[item].type }}" loop: "{{ lookup('ansible.utils.index_of', data, 'regex', expression, 'name') }}" vars: - expression: '\.corp$' # ends with .corp + expression: '\.corp$' +# ends with .corp # TASK [Find the index of all devices with a .corp name] ********************* # ok: [nxos101] => (item=2) => @@ -142,7 +145,7 @@ # vars: # found: [] # ip: '192.168.101.' -# address: "{{ lookup('ansible.utils.index_of', item.1.ipv4|d([]), 'search', ip, 'address', wantlist=True) }}" +# address: "{{ lookup('ansible.utils.index_of', item.1.ipv4|d([]), 'search', ip, 'address', wantlist=true) }}" # entry: # - interface_idx: "{{ item.0 }}" # address_idxs: "{{ address }}" @@ -169,7 +172,8 @@ #### Working with deeply nested data -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: data: interfaces: interface: diff --git a/tests/integration/targets/utils_index_of/tasks/main.yaml b/tests/integration/targets/utils_index_of/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_index_of/tasks/main.yaml +++ b/tests/integration/targets/utils_index_of/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_index_of/tasks/simple.yaml b/tests/integration/targets/utils_index_of/tasks/simple.yaml index 9a3b36d..792dd09 100644 --- a/tests/integration/targets/utils_index_of/tasks/simple.yaml +++ b/tests/integration/targets/utils_index_of/tasks/simple.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: complex: a: - true @@ -27,13 +28,13 @@ ansible.builtin.assert: that: "{{ item.test == item.result }}" loop: - - test: "{{ complex.a|ansible.utils.index_of('eq', True) }}" + - test: "{{ complex.a|ansible.utils.index_of('eq', true) }}" result: [0, 1] - - test: "{{ lookup('ansible.utils.index_of', complex.a, 'eq', True) }}" + - test: "{{ lookup('ansible.utils.index_of', complex.a, 'eq', true) }}" result: [0, 1] - - test: "{{ complex.a|ansible.utils.index_of('in', [True, False]) }}" + - test: "{{ complex.a|ansible.utils.index_of('in', [true, False]) }}" result: [0, 1, 2] - - test: "{{ lookup('ansible.utils.index_of', complex.a, 'in', [True, False]) }}" + - test: "{{ lookup('ansible.utils.index_of', complex.a, 'in', [true, False]) }}" result: [0, 1, 2] # These are commented out due to jinja < 2.11 w/ 2.9, 'integer' not avaialable # can be enabled at a later date @@ -57,7 +58,8 @@ - test: "{{ lookup('ansible.utils.index_of', complex.d, 'match', '.*d$') }}" result: [0, 1] -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: complex: a: b: @@ -77,27 +79,27 @@ result: "0" - test: "{{ lookup('ansible.utils.index_of', complex.a.b.c.d, 'eq', 'ansible', 'e1') }}" result: "0" - - test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', 'ansible', 'e1', wantlist=True) }}" + - test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', 'ansible', 'e1', wantlist=true) }}" result: [0] - - test: "{{ lookup('ansible.utils.index_of', complex.a.b.c.d, 'eq', 'ansible', 'e1', wantlist=True) }}" + - test: "{{ lookup('ansible.utils.index_of', complex.a.b.c.d, 'eq', 'ansible', 'e1', wantlist=true) }}" result: [0] - name: Test a missing key in the list of dictionaries ansible.builtin.assert: that: "{{ item.test == item.result }}" loop: - - test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', True, 'e2') }}" + - test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', true, 'e2') }}" result: "0" - - test: "{{ lookup('ansible.utils.index_of', complex.a.b.c.d, 'eq', True, 'e2') }}" + - test: "{{ lookup('ansible.utils.index_of', complex.a.b.c.d, 'eq', true, 'e2') }}" result: "0" - name: Test a missing key in the list of dictionaries, fail on missing ansible.builtin.assert: that: "{{ item.test == item.result }}" loop: - - test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', True, 'e2', fail_on_missing=True) }}" + - test: "{{ complex.a.b.c.d|ansible.utils.index_of('eq', true, 'e2', fail_on_missing=true) }}" result: "0" - - test: "{{ lookup('ansible.utils.index_of', complex.a.b.c.d, 'eq', True, 'e2', fail_on_missing=True) }}" + - test: "{{ lookup('ansible.utils.index_of', complex.a.b.c.d, 'eq', true, 'e2', fail_on_missing=true) }}" result: "0" ignore_errors: true register: result diff --git a/tests/integration/targets/utils_ipaddr_filter/tasks/ipaddr.yaml b/tests/integration/targets/utils_ipaddr_filter/tasks/ipaddr.yaml index c00d8ba..8f69f0a 100644 --- a/tests/integration/targets/utils_ipaddr_filter/tasks/ipaddr.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/tasks/ipaddr.yaml @@ -8,7 +8,7 @@ - 192.168.32.0/24 - fe80::100/10 - "42540766412265424405338506004571095040/64" - - True + - true - name: ipaddr filter with empty string query ansible.builtin.set_fact: @@ -58,7 +58,8 @@ ansible.builtin.assert: that: "{{ result6 == '192.168.255.123' }}" -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "Test int input for ipaddr filter" - name: set fact 1 diff --git a/tests/integration/targets/utils_ipaddr_filter/tasks/ipv4.yaml b/tests/integration/targets/utils_ipaddr_filter/tasks/ipv4.yaml index 0805dd3..68b17f5 100644 --- a/tests/integration/targets/utils_ipaddr_filter/tasks/ipv4.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/tasks/ipv4.yaml @@ -8,7 +8,7 @@ - 192.168.32.0/24 - fe80::100/10 - "42540766412265424405338506004571095040/64" - - True + - true - name: ipv4 filter ansible.builtin.set_fact: diff --git a/tests/integration/targets/utils_ipaddr_filter/tasks/ipv6.yaml b/tests/integration/targets/utils_ipaddr_filter/tasks/ipv6.yaml index 397a651..83d7ffd 100644 --- a/tests/integration/targets/utils_ipaddr_filter/tasks/ipv6.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/tasks/ipv6.yaml @@ -8,7 +8,7 @@ - ::ffff:192.24.2.1/128 - 192.168.32.0/24 - fe80::100/10 - - True + - true - name: ipv6 filter ansible.builtin.set_fact: diff --git a/tests/integration/targets/utils_ipaddr_filter/tasks/ipwrap.yaml b/tests/integration/targets/utils_ipaddr_filter/tasks/ipwrap.yaml index e51226d..5920319 100644 --- a/tests/integration/targets/utils_ipaddr_filter/tasks/ipwrap.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/tasks/ipwrap.yaml @@ -8,7 +8,7 @@ - 192.168.32.0/24 - fe80::100/10 - "42540766412265424405338506004571095040/64" - - True + - true - name: ipwrap filter ansible.builtin.set_fact: diff --git a/tests/integration/targets/utils_ipaddr_filter/tasks/main.yaml b/tests/integration/targets/utils_ipaddr_filter/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_ipaddr_filter/tasks/main.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_network.yaml b/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_network.yaml index ffc36fe..2b6dfe4 100644 --- a/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_network.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_network.yaml @@ -5,7 +5,7 @@ - name: Assert result for network_in_network. ansible.builtin.assert: - that: "{{ result1 == True }}" + that: "{{ result1 == true }}" - name: network_in_network filter test2 ansible.builtin.set_fact: @@ -21,4 +21,4 @@ - name: Assert result for network_in_network ansible.builtin.assert: - that: "{{ result1 == True }}" + that: "{{ result1 == true }}" diff --git a/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_usable.yaml b/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_usable.yaml index de55363..cdb96ef 100644 --- a/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_usable.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/tasks/network_in_usable.yaml @@ -5,7 +5,7 @@ - name: Assert result for network_in_usable. ansible.builtin.assert: - that: "{{ result1 == True }}" + that: "{{ result1 == true }}" - name: network_in_usable filter test2 ansible.builtin.set_fact: @@ -21,4 +21,4 @@ - name: Assert result for network_in_usable ansible.builtin.assert: - that: "{{ result1 == True }}" + that: "{{ result1 == true }}" diff --git a/tests/integration/targets/utils_ipaddr_filter/vars/main.yaml b/tests/integration/targets/utils_ipaddr_filter/vars/main.yaml index f3cb6aa..6c28bde 100644 --- a/tests/integration/targets/utils_ipaddr_filter/vars/main.yaml +++ b/tests/integration/targets/utils_ipaddr_filter/vars/main.yaml @@ -39,7 +39,7 @@ ipwrap_result1: - "192.168.32.0/24" - "[fe80::100]/10" - "[2001:db8:32c:faad::]/64" - - True + - true ipv6_result1: - "::ffff:192.168.32.0/120" diff --git a/tests/integration/targets/utils_keep_keys/tasks/main.yaml b/tests/integration/targets/utils_keep_keys/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_keep_keys/tasks/main.yaml +++ b/tests/integration/targets/utils_keep_keys/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_keep_keys/tasks/simple.yaml b/tests/integration/targets/utils_keep_keys/tasks/simple.yaml index 4681686..420ac1f 100644 --- a/tests/integration/targets/utils_keep_keys/tasks/simple.yaml +++ b/tests/integration/targets/utils_keep_keys/tasks/simple.yaml @@ -25,7 +25,8 @@ mtu: 600 is_enabled: false -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "{{ data|ansible.utils.keep_keys(target=['desc', 'interface_'], matching_parameter= 'starts_with') }}" register: result @@ -60,7 +61,8 @@ mtu: 600 is_enabled: false -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "{{ data|ansible.utils.keep_keys(target=['interface_name', 'is_enabled', 'vlan_id']) }}" register: result diff --git a/tests/integration/targets/utils_netaddr_test/tasks/main.yaml b/tests/integration/targets/utils_netaddr_test/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_netaddr_test/tasks/main.yaml +++ b/tests/integration/targets/utils_netaddr_test/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_netaddr_test/tasks/resolvable.yml b/tests/integration/targets/utils_netaddr_test/tasks/resolvable.yml index 33c3174..0e3b11d 100644 --- a/tests/integration/targets/utils_netaddr_test/tasks/resolvable.yml +++ b/tests/integration/targets/utils_netaddr_test/tasks/resolvable.yml @@ -1,13 +1,13 @@ --- -- name: "resolvable: Check if {{ good_name }} is resolvable or not" +- name: "resolvable: Check if good_name is resolvable or not" ansible.builtin.assert: that: "{{ good_name is ansible.utils.resolvable }}" -- name: "resolvable: Check if {{ ipv4_localhost }} is resolvable or not" +- name: "resolvable: Check if ipv4_localhost is resolvable or not" ansible.builtin.assert: that: "{{ ipv4_localhost is ansible.utils.resolvable }}" -- name: "resolvable: Check if {{ ipv6_localhost }} is resolvable or not" +- name: "resolvable: Check if ipv6_localhost is resolvable or not" ansible.builtin.assert: that: "{{ ipv6_localhost is ansible.utils.resolvable }}" diff --git a/tests/integration/targets/utils_param_list_compare/tasks/main.yaml b/tests/integration/targets/utils_param_list_compare/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_param_list_compare/tasks/main.yaml +++ b/tests/integration/targets/utils_param_list_compare/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_param_list_compare/tasks/simple.yaml b/tests/integration/targets/utils_param_list_compare/tasks/simple.yaml index 563ec8a..b79e0b3 100644 --- a/tests/integration/targets/utils_param_list_compare/tasks/simple.yaml +++ b/tests/integration/targets/utils_param_list_compare/tasks/simple.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "START param_list_compare integration tests on connection={{ ansible_connection }}" - name: Setup supported resource module list json @@ -52,5 +53,7 @@ that: - "{{ expected_network_resources | symmetric_difference(final_network_resources['actionable']) |length\ \ == 0 }}" -- ansible.builtin.debug: + +- name: Debug + ansible.builtin.debug: msg: "END param_list_compare integration tests on connection={{ ansible_connection }}" diff --git a/tests/integration/targets/utils_remove_keys/tasks/main.yaml b/tests/integration/targets/utils_remove_keys/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_remove_keys/tasks/main.yaml +++ b/tests/integration/targets/utils_remove_keys/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_remove_keys/tasks/simple.yaml b/tests/integration/targets/utils_remove_keys/tasks/simple.yaml index 889f8cf..edecf24 100644 --- a/tests/integration/targets/utils_remove_keys/tasks/simple.yaml +++ b/tests/integration/targets/utils_remove_keys/tasks/simple.yaml @@ -29,7 +29,8 @@ mtu: 600 enabled: false -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "{{ data|ansible.utils.remove_keys(target=['notes', 'comment']) }}" register: result diff --git a/tests/integration/targets/utils_replace_keys/tasks/main.yaml b/tests/integration/targets/utils_replace_keys/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_replace_keys/tasks/main.yaml +++ b/tests/integration/targets/utils_replace_keys/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_replace_keys/tasks/simple.yaml b/tests/integration/targets/utils_replace_keys/tasks/simple.yaml index 1799ae2..78b4515 100644 --- a/tests/integration/targets/utils_replace_keys/tasks/simple.yaml +++ b/tests/integration/targets/utils_replace_keys/tasks/simple.yaml @@ -25,7 +25,8 @@ mtu: 600 enabled: false -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "{{ data|ansible.utils.replace_keys(target=[{'before':'interface_name', 'after':'name'}]) }}" register: result diff --git a/tests/integration/targets/utils_to_paths/tasks/argspec.yaml b/tests/integration/targets/utils_to_paths/tasks/argspec.yaml index 4202131..56b0a4e 100644 --- a/tests/integration/targets/utils_to_paths/tasks/argspec.yaml +++ b/tests/integration/targets/utils_to_paths/tasks/argspec.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -12,9 +13,12 @@ ignore_errors: true register: result -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: var: result -- ansible.builtin.assert: + +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "'5' is not a valid boolean" @@ -25,9 +29,12 @@ ignore_errors: true register: result -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: var: result -- ansible.builtin.assert: + +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "missing required arguments: var" diff --git a/tests/integration/targets/utils_to_paths/tasks/empty_members.yaml b/tests/integration/targets/utils_to_paths/tasks/empty_members.yaml index b1bb48e..f6313d5 100644 --- a/tests/integration/targets/utils_to_paths/tasks/empty_members.yaml +++ b/tests/integration/targets/utils_to_paths/tasks/empty_members.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: [] c: {} diff --git a/tests/integration/targets/utils_to_paths/tasks/examples_filter.yaml b/tests/integration/targets/utils_to_paths/tasks/examples_filter.yaml index 337f5ed..c9dc8e2 100644 --- a/tests/integration/targets/utils_to_paths/tasks/examples_filter.yaml +++ b/tests/integration/targets/utils_to_paths/tasks/examples_filter.yaml @@ -1,6 +1,7 @@ --- #### Simple examples -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -11,7 +12,8 @@ - true - false -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: paths: "{{ a|ansible.utils.to_paths }}" # TASK [ansible.builtin.set_fact] ******************************************** diff --git a/tests/integration/targets/utils_to_paths/tasks/examples_lookup.yaml b/tests/integration/targets/utils_to_paths/tasks/examples_lookup.yaml index f76d21e..3104719 100644 --- a/tests/integration/targets/utils_to_paths/tasks/examples_lookup.yaml +++ b/tests/integration/targets/utils_to_paths/tasks/examples_lookup.yaml @@ -1,6 +1,7 @@ --- #### Simple examples -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -11,7 +12,8 @@ - true - false -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: paths: "{{ lookup('ansible.utils.to_paths', a) }}" # TASK [ansible.builtin.set_fact] ******************************************** diff --git a/tests/integration/targets/utils_to_paths/tasks/main.yaml b/tests/integration/targets/utils_to_paths/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_to_paths/tasks/main.yaml +++ b/tests/integration/targets/utils_to_paths/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_to_paths/tasks/simple.yaml b/tests/integration/targets/utils_to_paths/tasks/simple.yaml index 2ae3d3d..f352e0d 100644 --- a/tests/integration/targets/utils_to_paths/tasks/simple.yaml +++ b/tests/integration/targets/utils_to_paths/tasks/simple.yaml @@ -1,5 +1,6 @@ --- -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -28,7 +29,8 @@ a.b.c.d[0]: 0 a.b.c.d[1]: 1 -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: a: b: c: @@ -39,15 +41,15 @@ ansible.builtin.assert: that: "{{ item.result == item.expected }}" loop: - - result: "{{ a|ansible.utils.to_paths(wantlist=True) }}" + - result: "{{ a|ansible.utils.to_paths(wantlist=true) }}" expected: - b.c.d[0]: 0 - - result: "{{ lookup('ansible.utils.to_paths', a, wantlist=True) }}" + - result: "{{ lookup('ansible.utils.to_paths', a, wantlist=true) }}" expected: - b.c.d[0]: 0 - - result: "{{ a|ansible.utils.to_paths(wantlist=True, prepend='a') }}" + - result: "{{ a|ansible.utils.to_paths(wantlist=true, prepend='a') }}" expected: - a.b.c.d[0]: 0 - - result: "{{ lookup('ansible.utils.to_paths', a, wantlist=True, prepend='a') }}" + - result: "{{ lookup('ansible.utils.to_paths', a, wantlist=true, prepend='a') }}" expected: - a.b.c.d[0]: 0 diff --git a/tests/integration/targets/utils_to_xml/tasks/main.yaml b/tests/integration/targets/utils_to_xml/tasks/main.yaml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_to_xml/tasks/main.yaml +++ b/tests/integration/targets/utils_to_xml/tasks/main.yaml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_to_xml/tasks/simple.yaml b/tests/integration/targets/utils_to_xml/tasks/simple.yaml index 295012e..44cd57d 100644 --- a/tests/integration/targets/utils_to_xml/tasks/simple.yaml +++ b/tests/integration/targets/utils_to_xml/tasks/simple.yaml @@ -1,13 +1,13 @@ --- -- name: Setup xml and expected json +- name: Setup xml ansible.builtin.set_fact: data: "interface-configurations": "@xmlns": "http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg" "interface-configuration": - output: "\n\n\t\n" -- ansible.builtin.debug: +- name: Debug + ansible.builtin.debug: msg: "{{ data|ansible.utils.to_xml() }}" - name: Integration tests with and without default engine as xmltodict and @@ -29,7 +29,8 @@ ignore_errors: true register: result -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result.msg }}" vars: msg: "Error when using plugin 'to_xml': engine: dicttoxml is not supported" diff --git a/tests/integration/targets/utils_to_xml/vars/main.yaml b/tests/integration/targets/utils_to_xml/vars/main.yaml new file mode 100644 index 0000000..bf6f123 --- /dev/null +++ b/tests/integration/targets/utils_to_xml/vars/main.yaml @@ -0,0 +1,2 @@ +--- +output: "\n\n\t\n" diff --git a/tests/integration/targets/utils_update_fact/tasks/main.yaml b/tests/integration/targets/utils_update_fact/tasks/main.yaml index e3f721b..292c99e 100644 --- a/tests/integration/targets/utils_update_fact/tasks/main.yaml +++ b/tests/integration/targets/utils_update_fact/tasks/main.yaml @@ -16,7 +16,8 @@ value: 20 register: updated -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ updated.a == expected.a }}" vars: expected: @@ -38,7 +39,8 @@ - true register: updated -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ updated.a == expected.a }}" vars: expected: @@ -58,7 +60,8 @@ index: "{{ a.b.c|ansible.utils.index_of('eq', 2) }}" register: updated -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ updated.a == expected.a }}" vars: expected: diff --git a/tests/integration/targets/utils_usable_range/tasks/argspec.yml b/tests/integration/targets/utils_usable_range/tasks/argspec.yml index 5047aeb..ccc8a2b 100644 --- a/tests/integration/targets/utils_usable_range/tasks/argspec.yml +++ b/tests/integration/targets/utils_usable_range/tasks/argspec.yml @@ -5,7 +5,8 @@ ignore_errors: true register: result1 -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result1.msg }}" vars: msg: "does not appear to be an IPv4 or IPv6 network" @@ -16,7 +17,8 @@ ignore_errors: true register: result2 -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result2.msg }}" vars: msg: "does not appear to be an IPv4 or IPv6 network" @@ -27,7 +29,8 @@ ignore_errors: true register: result3 -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result3.msg }}" vars: msg: "has host bits set" @@ -38,7 +41,8 @@ ignore_errors: true register: result4 -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result4.msg }}" vars: msg: "does not appear to be an IPv4 or IPv6 network" @@ -49,7 +53,8 @@ ignore_errors: true register: result5 -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result5.msg }}" vars: msg: "does not appear to be an IPv4 or IPv6 network" @@ -60,7 +65,8 @@ ignore_errors: true register: result6 -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result6.msg }}" vars: msg: "does not appear to be an IPv4 or IPv6 network" @@ -71,7 +77,8 @@ ignore_errors: true register: result7 -- ansible.builtin.assert: +- name: Assert + ansible.builtin.assert: that: "{{ msg in result7.msg }}" vars: msg: "does not appear to be an IPv4 or IPv6 network" diff --git a/tests/integration/targets/utils_usable_range/tasks/main.yml b/tests/integration/targets/utils_usable_range/tasks/main.yml index cfc8705..333bee8 100644 --- a/tests/integration/targets/utils_usable_range/tasks/main.yml +++ b/tests/integration/targets/utils_usable_range/tasks/main.yml @@ -10,5 +10,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}" diff --git a/tests/integration/targets/utils_validate/tasks/main.yaml b/tests/integration/targets/utils_validate/tasks/main.yaml index bb10177..d973af9 100644 --- a/tests/integration/targets/utils_validate/tasks/main.yaml +++ b/tests/integration/targets/utils_validate/tasks/main.yaml @@ -7,5 +7,6 @@ delegate_to: localhost register: found -- ansible.builtin.include_tasks: "{{ item.path }}" +- name: Include tasks + ansible.builtin.include_tasks: "{{ item.path }}" loop: "{{ found.files }}"