From 0a2091a36648ca6020c96df13c14628e0d2b0dfa Mon Sep 17 00:00:00 2001 From: Fioddor Superconcentrado Date: Sat, 21 Aug 2021 20:08:16 +0200 Subject: [PATCH] container: Don't fail if there's no fbx network Display debugging info if the reason for failure is different. Signed-off-by: Fioddor Superconcentrado [sunil: Indentation, fix pylint message] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- container | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/container b/container index c02e6b7b2..8b5298d3b 100755 --- a/container +++ b/container @@ -812,8 +812,16 @@ def _destroy(distribution): connection_name = f'fbx-{distribution}-shared' logger.info('Removing Network Manager connection %s', connection_name) - subprocess.run(['sudo', 'nmcli', 'connection', 'delete', connection_name], - stdout=subprocess.DEVNULL) + result = subprocess.run( + ['sudo', 'nmcli', 'connection', 'delete', connection_name], + capture_output=True) + if result.returncode not in (0, 10): + # nmcli failed and not due to 'Connection, device, or access point does + # not exist.' See + # https://developer-old.gnome.org/NetworkManager/stable/nmcli.html + logger.error('nmcli returned code %d', result.returncode) + logger.error('Error message:\n%s', result.stderr.decode()) + logger.error('Output:\n%s', result.stdout.decode()) logger.info('Keeping downloaded image: %s', _get_compressed_image_path(distribution))