From 574e8aba0595f1029394ec16d1b85756b24b0513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Fri, 30 Dec 2022 22:32:04 +0100 Subject: [PATCH 1/3] Resolved warnings in meraki_ms_stack --- .../targets/meraki_ms_stack/tasks/main.yml | 145 ++++++++++-------- 1 file changed, 81 insertions(+), 64 deletions(-) diff --git a/tests/integration/targets/meraki_ms_stack/tasks/main.yml b/tests/integration/targets/meraki_ms_stack/tasks/main.yml index 853cbbe7..c83ee159 100644 --- a/tests/integration/targets/meraki_ms_stack/tasks/main.yml +++ b/tests/integration/targets/meraki_ms_stack/tasks/main.yml @@ -3,27 +3,29 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) --- -- block: +- name: Block of tests + block: - name: Create network with type switch - meraki_network: + cisco.meraki.meraki_network: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' type: switch timezone: America/Chicago delegate_to: localhost register: create_net_switch - - set_fact: - net_id: '{{create_net_switch.data.id}}' + - name: Set fact create_net_switch + ansible.builtin.set_fact: + net_id: '{{ create_net_switch.data.id }}' - name: Claim devices into network - meraki_device: - auth_key: '{{auth_key}}' - org_name: '{{test_org_name}}' - net_id: '{{net_id}}' - serial: '{{item}}' + cisco.meraki.meraki_device: + auth_key: '{{ auth_key }}' + org_name: '{{ test_org_name }}' + net_id: '{{ net_id }}' + serial: '{{ item }}' state: present delegate_to: localhost register: claim_device @@ -36,21 +38,24 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' name: Test stack serials: - "QBSB-BPR6-PRER" - "QBSB-VLNE-E299" register: create - - debug: + - name: Debug create + ansible.builtin.debug: var: create - - set_fact: - stack_id: '{{create.data.id}}' + - name: Set fact create + ansible.builtin.set_fact: + stack_id: '{{ create.data.id }}' - - assert: + - name: Assert create + ansible.builtin.assert: that: - create.data is defined - create is changed @@ -59,14 +64,15 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' + stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" register: add_stack - - assert: + - name: Assert add_stack + ansible.builtin.assert: that: - add_stack.data is defined - add_stack.data.serials | length == 3 @@ -76,14 +82,15 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: present - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' + stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" register: add_stack_idempotent - - assert: + - name: Assert add_stack_idempotent + ansible.builtin.assert: that: - add_stack_idempotent.data is defined - add_stack_idempotent.data.serials | length == 3 @@ -93,17 +100,19 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: absent - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' + stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" register: remove_from_stack - - debug: + - name: Debug remove_from_stack + ansible.builtin.debug: var: remove_from_stack - - assert: + - name: Assert remove_from_stack + ansible.builtin.assert: that: - remove_from_stack.data is defined - remove_from_stack.data.serials | length == 2 @@ -113,17 +122,19 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: absent - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' + stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" register: remove_from_stack_idempotent - - debug: + - name: Debug remove_from_stack_idempotent + ansible.builtin.debug: var: remove_from_stack_idempotent - - assert: + - name: Assert remove_from_stack_idempotent + ansible.builtin.assert: that: - remove_from_stack_idempotent.data is defined - remove_from_stack_idempotent.data.serials | length == 2 @@ -133,14 +144,16 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: query - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' register: query_all - - debug: + - name: Debug query_all + ansible.builtin.debug: var: query_all - - assert: + - name: Assert query_all + ansible.builtin.assert: that: - query_all.data is defined - query_all is not changed @@ -149,15 +162,17 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: query - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' - stack_id: '{{stack_id}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' + stack_id: '{{ stack_id }}' register: query_one - - debug: + - name: Debug query_one + ansible.builtin.debug: var: query_one - - assert: + - name: Assert query_one + ansible.builtin.assert: that: - query_one.data is defined - query_one is not changed @@ -166,33 +181,35 @@ meraki_switch_stack: auth_key: '{{ auth_key }}' state: query - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' name: Test stack register: query_one_name - - debug: + - name: Debug query_one_name + ansible.builtin.debug: var: query_one_name - - assert: + - name: Assert query_one_name + ansible.builtin.assert: that: - query_one_name.data is defined - query_one_name is not changed always: - - name: Delete stack - meraki_switch_stack: - auth_key: '{{ auth_key }}' - state: absent - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' - stack_id: '{{stack_id}}' - register: delete - - - name: Delete network - meraki_network: - auth_key: '{{ auth_key }}' - state: absent - org_name: '{{test_org_name}}' - net_name: '{{test_switch_net_name}}' - delegate_to: localhost + - name: Delete stack + meraki_switch_stack: + auth_key: '{{ auth_key }}' + state: absent + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' + stack_id: '{{ stack_id }}' + register: delete + + - name: Delete network + cisco.meraki.meraki_network: + auth_key: '{{ auth_key }}' + state: absent + org_name: '{{ test_org_name }}' + net_name: ' {{ test_switch_net_name }}' + delegate_to: localhost From 7a9c61098de04b7bc6960ac2fa579662f8e6c2d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Fri, 30 Dec 2022 22:32:05 +0100 Subject: [PATCH 2/3] Added the changelog --- changelogs/fragments/warnings-meraki_ms_stack.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/warnings-meraki_ms_stack.yml diff --git a/changelogs/fragments/warnings-meraki_ms_stack.yml b/changelogs/fragments/warnings-meraki_ms_stack.yml new file mode 100644 index 00000000..5959176e --- /dev/null +++ b/changelogs/fragments/warnings-meraki_ms_stack.yml @@ -0,0 +1,2 @@ +trivial: + - Resolved ansible-lint warnings in tests for module-meraki_ms_stack From ce8aebb2f065c7d8f19d8c462c387e9f84072005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Fri, 30 Dec 2022 22:37:39 +0100 Subject: [PATCH 3/3] Resolved warnings with fqdn. Changed the meraki_switch_stack to cisco.meraki.meraki_ms_stack --- .../targets/meraki_ms_stack/tasks/main.yml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/integration/targets/meraki_ms_stack/tasks/main.yml b/tests/integration/targets/meraki_ms_stack/tasks/main.yml index c83ee159..7362d39c 100644 --- a/tests/integration/targets/meraki_ms_stack/tasks/main.yml +++ b/tests/integration/targets/meraki_ms_stack/tasks/main.yml @@ -10,7 +10,7 @@ auth_key: '{{ auth_key }}' state: present org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' type: switch timezone: America/Chicago delegate_to: localhost @@ -35,11 +35,11 @@ - "QBSB-D75G-PXCG" - name: Create new stack - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: present org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' name: Test stack serials: - "QBSB-BPR6-PRER" @@ -61,11 +61,11 @@ - create is changed - name: Add switch to stack - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: present org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" @@ -79,11 +79,11 @@ - add_stack is changed - name: Add switch to stack idempotent - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: present org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" @@ -97,11 +97,11 @@ - add_stack_idempotent is not changed - name: Remove switch from stack - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: absent org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" @@ -119,11 +119,11 @@ - remove_from_stack is changed - name: Remove switch from stack idempotent - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: absent org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' stack_id: '{{ stack_id }}' serials: - "QBSB-D75G-PXCG" @@ -141,11 +141,11 @@ - remove_from_stack_idempotent is not changed - name: Query all stacks in the network - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: query org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' register: query_all - name: Debug query_all @@ -159,11 +159,11 @@ - query_all is not changed - name: Query one stack - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: query org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' stack_id: '{{ stack_id }}' register: query_one @@ -178,11 +178,11 @@ - query_one is not changed - name: Query one stack using name - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: query org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' name: Test stack register: query_one_name @@ -198,11 +198,11 @@ always: - name: Delete stack - meraki_switch_stack: + cisco.meraki.meraki_ms_stack: auth_key: '{{ auth_key }}' state: absent org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' stack_id: '{{ stack_id }}' register: delete @@ -211,5 +211,5 @@ auth_key: '{{ auth_key }}' state: absent org_name: '{{ test_org_name }}' - net_name: ' {{ test_switch_net_name }}' + net_name: '{{ test_switch_net_name }}' delegate_to: localhost