From d370966ee235d3cebefccf9699bf114f828dbc74 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Fri, 18 May 2018 23:59:44 +0200 Subject: [PATCH 1/3] Add test to take interface down --- tests/tests_ethernet.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/tests_ethernet.yml b/tests/tests_ethernet.yml index 55f2ae2..b4ea31a 100644 --- a/tests/tests_ethernet.yml +++ b/tests/tests_ethernet.yml @@ -30,11 +30,10 @@ - linux-system-roles.network # FIXME: assert profile present # FIXME: assert profile/device up + IP address -# FIXME: state down does not work currently -#- import_playbook: down-profile.yml -# vars: -# profile: "{{ interface }}" -## FIXME: assert profile/device down +- import_playbook: down-profile.yml + vars: + profile: "{{ interface }}" +# FIXME: assert profile/device down - import_playbook: remove-profile.yml vars: profile: "{{ interface }}" From 756be9a8defc4ecabdef2270b17dda74b02dcfc5 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Sat, 19 May 2018 00:03:01 +0200 Subject: [PATCH 2/3] Allow to take down connections if not in config Allow to take down connections regardless of whether they are defined in the configuration. It should be enough that the connection is defined on the system. --- 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 0493f19..b77ad3f 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -1120,7 +1120,7 @@ class ArgValidator_ListConnections(ArgValidatorList): def _validate_post(self, value, name, result): for idx, connection in enumerate(result): - if connection['state'] in ['down', 'up']: + if connection['state'] in ['up']: if connection['state'] == 'up' and 'type' in connection: pass elif not ArgUtil.connection_find_by_name(connection['name'], result, idx): From 459601c8e770f81576e852413e3007ccea640ba0 Mon Sep 17 00:00:00 2001 From: Till Maas Date: Wed, 11 Jul 2018 10:06:45 +0200 Subject: [PATCH 3/3] Fail when trying to down a non-existing NM profile --- library/network_connections.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/network_connections.py b/library/network_connections.py index b77ad3f..02e330d 100644 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -2661,9 +2661,10 @@ class Cmd_nm(Cmd): self.log_error(idx, 'down connection failed while waiting: %s' % (e)) cons = self.nmutil.connection_list(name = connection['name']) - if not changed: - self.log_info(idx, 'down connection %s failed: no connection' % (connection['name'])) + self.log_error(idx, + 'down connection %s failed: connection not found' % + (connection['name'])) ###############################################################################