Quote vpn names when executing nmcli

This commit is contained in:
Stijn Van Campenhout 2019-11-12 11:04:29 +01:00
parent 0b0cfd4f8b
commit c669f49d9f

View file

@ -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")