From c669f49d9fb55c655352a6b03fecb9fbb8669a96 Mon Sep 17 00:00:00 2001 From: Stijn Van Campenhout Date: Tue, 12 Nov 2019 11:04:29 +0100 Subject: [PATCH 1/2] Quote vpn names when executing nmcli --- bumblebee/modules/vpn.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/vpn.py b/bumblebee/modules/vpn.py index f02842e..7797614 100644 --- a/bumblebee/modules/vpn.py +++ b/bumblebee/modules/vpn.py @@ -65,7 +65,8 @@ class Module(bumblebee.engine.Module): def _on_vpn_disconnect(self): try: - bumblebee.util.execute("nmcli c down " + self._connected_vpn_profile) + bumblebee.util.execute("nmcli c down \"{vpn}\"" + .format(self._connected_vpn_profile)) self._connected_vpn_profile = None except Exception as e: logging.exception("Couldn't disconnect VPN connection") @@ -74,7 +75,8 @@ class Module(bumblebee.engine.Module): self._selected_vpn_profile = name try: - bumblebee.util.execute("nmcli c up " + self._selected_vpn_profile) + bumblebee.util.execute("nmcli c up \"{vpn}\"" + .format(self._connected_vpn_profile)) self._connected_vpn_profile = name except Exception as e: logging.exception("Couldn't establish VPN connection") From 00bc827f276ee389724b0aec78c7648f60b4317c Mon Sep 17 00:00:00 2001 From: Stijn Van Campenhout Date: Tue, 12 Nov 2019 11:10:59 +0100 Subject: [PATCH 2/2] Use format vpn namespace --- bumblebee/modules/vpn.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/vpn.py b/bumblebee/modules/vpn.py index 7797614..a43e36b 100644 --- a/bumblebee/modules/vpn.py +++ b/bumblebee/modules/vpn.py @@ -66,7 +66,7 @@ class Module(bumblebee.engine.Module): def _on_vpn_disconnect(self): try: bumblebee.util.execute("nmcli c down \"{vpn}\"" - .format(self._connected_vpn_profile)) + .format(vpn=self._connected_vpn_profile)) self._connected_vpn_profile = None except Exception as e: logging.exception("Couldn't disconnect VPN connection") @@ -76,7 +76,7 @@ class Module(bumblebee.engine.Module): try: bumblebee.util.execute("nmcli c up \"{vpn}\"" - .format(self._connected_vpn_profile)) + .format(vpn=self._connected_vpn_profile)) self._connected_vpn_profile = name except Exception as e: logging.exception("Couldn't establish VPN connection")