diff options
-rw-r--r-- | docs/changelog-next.rst | 2 | ||||
-rw-r--r-- | src/leap/bitmask/cli/vpn.py | 6 | ||||
-rw-r--r-- | src/leap/bitmask/core/dispatcher.py | 3 | ||||
-rw-r--r-- | src/leap/bitmask/vpn/service.py | 9 |
4 files changed, 13 insertions, 7 deletions
diff --git a/docs/changelog-next.rst b/docs/changelog-next.rst index 2f57687a..57aad99c 100644 --- a/docs/changelog-next.rst +++ b/docs/changelog-next.rst @@ -10,6 +10,8 @@ I've added a new category `Misc` so we can track doc/style/packaging stuff. Features ~~~~~~~~ +- `#8835 <https://0xacab.org/leap/bitmask-dev/issues/8835>`_: On bitmaskclt vpn start use the last vpn if no provider is provided + - `#1234 <https://leap.se/code/issues/1234>`_: Description of the new feature corresponding with issue #1234. - New feature without related issue number. diff --git a/src/leap/bitmask/cli/vpn.py b/src/leap/bitmask/cli/vpn.py index 1c7ad3b4..219cac17 100644 --- a/src/leap/bitmask/cli/vpn.py +++ b/src/leap/bitmask/cli/vpn.py @@ -54,7 +54,7 @@ SUBCOMMANDS: help='provider to start the VPN') subargs = parser.parse_args(raw_args) - provider = None + provider = "" if subargs.provider: provider = subargs.provider else: @@ -62,9 +62,7 @@ SUBCOMMANDS: try: _, provider = uid.split('@') except ValueError: - error = ValueError("A provider is needed to start the VPN") - error.expected = True - raise error + pass self.data += ['start', provider] diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py index ccb17db5..ba000d43 100644 --- a/src/leap/bitmask/core/dispatcher.py +++ b/src/leap/bitmask/core/dispatcher.py @@ -202,8 +202,7 @@ class VPNCmd(SubCommand): try: provider = parts[2] except IndexError: - raise DispatchError( - 'wrong number of arguments: expected 1, got none') + provider = None d = vpn.start_vpn(provider) return d diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index 5ab1e97e..6586a4fe 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -72,11 +72,18 @@ class VPNService(HookableService): super(VPNService, self).stopService() @defer.inlineCallbacks - def start_vpn(self, domain): + def start_vpn(self, domain=None): if self._started: exc = Exception('VPN already started') exc.expected = True raise exc + if not domain: + domain = self._read_last() + if not domain: + exc = Exception("VPN can't start, a provider is need") + exc.expected = True + raise exc + yield self._setup(domain) try: |