From 66c58449782d94cb5acb01b8d1ef8a207307a496 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Wed, 6 Apr 2022 15:32:13 -0500 Subject: [PATCH] ansible-test - Don't fail if network cannot be disconnected (#77472) * Don't fail if network cannot be disconnected * add clog frag --- .../77472-ansible-test-network-disconnect-warning.yml | 3 +++ test/lib/ansible_test/_internal/delegation.py | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/77472-ansible-test-network-disconnect-warning.yml diff --git a/changelogs/fragments/77472-ansible-test-network-disconnect-warning.yml b/changelogs/fragments/77472-ansible-test-network-disconnect-warning.yml new file mode 100644 index 00000000000..a13026acadf --- /dev/null +++ b/changelogs/fragments/77472-ansible-test-network-disconnect-warning.yml @@ -0,0 +1,3 @@ +bugfixes: +- ansible-test - Don't fail if network cannot be disconnected + (https://github.com/ansible/ansible/pull/77472) diff --git a/test/lib/ansible_test/_internal/delegation.py b/test/lib/ansible_test/_internal/delegation.py index a41e24c5c4f..6298bf24058 100644 --- a/test/lib/ansible_test/_internal/delegation.py +++ b/test/lib/ansible_test/_internal/delegation.py @@ -172,7 +172,14 @@ def delegate_command(args, host_state, exclude, require): # type: (EnvironmentC if networks is not None: for network in networks: - con.disconnect_network(network) + try: + con.disconnect_network(network) + except SubprocessError: + display.warning( + 'Unable to disconnect network "%s" (this is normal under podman). ' + 'Tests will not be isolated from the network. Network-related tests may ' + 'misbehave.' % (network,) + ) else: display.warning('Network disconnection is not supported (this is normal under podman). ' 'Tests will not be isolated from the network. Network-related tests may misbehave.')