From a00fe15943fdb8aaecbe21b0e0f9657a6c7577f1 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Tue, 4 Jun 2019 22:03:57 +0200 Subject: [PATCH 1/3] library: Make ignore_errors a real bool This removes warnings like: [WARNING]: The value False (type bool) in a string field was converted to u'False' (type string). If this does not look like what you expect, quote the entire value to ensure it does not change. --- library/network_connections.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/network_connections.py b/library/network_connections.py index 0d7ac94..6b20dad 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -1349,7 +1349,7 @@ class RunEnvironment: class RunEnvironmentAnsible(RunEnvironment): ARGS = { - "ignore_errors": {"required": False, "default": False, "type": "str"}, + "ignore_errors": {"required": False, "default": False, "type": "bool"}, "force_state_change": {"required": False, "default": False, "type": "bool"}, "provider": {"required": True, "default": None, "type": "str"}, "connections": {"required": False, "default": None, "type": "list"}, From 5d2eec94789444c2383b2e2f7a204d4d251d6f62 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Tue, 4 Jun 2019 22:22:27 +0200 Subject: [PATCH 2/3] tests_vlan_mtu: Use debug task to show TEST/CLEANUP The name for import_roles is not logged, therefore use an extra debug task to indicate the test steps. --- tests/playbooks/tests_vlan_mtu.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/playbooks/tests_vlan_mtu.yml b/tests/playbooks/tests_vlan_mtu.yml index d0cc75c..ae0322e 100644 --- a/tests/playbooks/tests_vlan_mtu.yml +++ b/tests/playbooks/tests_vlan_mtu.yml @@ -12,7 +12,9 @@ state: present - include_tasks: tasks/assert-device_present.yml - name: "TEST: I can configure the MTU for a vlan interface without autoconnect." - import_role: + debug: + msg: "##################################################" + - import_role: name: linux-system-roles.network vars: network_connections: @@ -45,8 +47,10 @@ - "{{ interface }}" - "{{ vlan_interface }}" - - name: "CLEANUP: remove profiles" - import_role: + - name: "TEARDOWN: remove profiles." + debug: + msg: "##################################################" + - import_role: name: linux-system-roles.network vars: network_connections: From 4215ef93cb10c790eafaa824e7b84112a2305cb2 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Tue, 4 Jun 2019 22:23:25 +0200 Subject: [PATCH 3/3] tests_vlan_mtu: Properly set the network provider Set the network_provider as fact to ensure that it is also set in the imported playbook. --- tests/tests_vlan_mtu_initscripts.yml | 9 +++++---- tests/tests_vlan_mtu_nm.yml | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/tests_vlan_mtu_initscripts.yml b/tests/tests_vlan_mtu_initscripts.yml index e6cac29..a57db4b 100644 --- a/tests/tests_vlan_mtu_initscripts.yml +++ b/tests/tests_vlan_mtu_initscripts.yml @@ -1,12 +1,13 @@ --- -# empty playbook to gather facts for import_playbook when clause +# set network provider and gather facts - hosts: all - vars: - network_provider: initscripts + tasks: + - name: Set network provider to 'initscripts' + set_fact: + network_provider: initscripts # workaround for: https://github.com/ansible/ansible/issues/27973 # There is no way in Ansible to abort a playbook hosts with specific OS # releases Therefore we include the playbook with the tests only if the hosts # would support it. -# The test requires NetworkManager, therefore it cannot run on RHEL 6 or CentOS 6. - import_playbook: playbooks/tests_vlan_mtu.yml diff --git a/tests/tests_vlan_mtu_nm.yml b/tests/tests_vlan_mtu_nm.yml index 22fdc32..d830817 100644 --- a/tests/tests_vlan_mtu_nm.yml +++ b/tests/tests_vlan_mtu_nm.yml @@ -1,8 +1,10 @@ --- -# empty playbook to gather facts for import_playbook when clause +# set network provider and gather facts - hosts: all - vars: - network_provider: nm + tasks: + - name: Set network provider to 'nm' + set_fact: + network_provider: nm # workaround for: https://github.com/ansible/ansible/issues/27973 # There is no way in Ansible to abort a playbook hosts with specific OS