diff options
author | Kali Kaneko <kali@leap.se> | 2016-08-15 18:33:44 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2016-08-15 18:33:44 +0200 |
commit | 7deebbcc9be005c6b29131985a218f571b89ab8d (patch) | |
tree | 0052ba1a603f3b2bdb5484cc8a1300db9dc99638 | |
parent | c8520be5c0a6c1c0e804f752d71baaf47367a0b8 (diff) |
[bug] rename mail get-token commands
otherwise the command cannot be dispatched.
return dicts instead of strings too.
-rw-r--r-- | src/leap/bitmask/cli/mail.py | 8 | ||||
-rw-r--r-- | src/leap/bitmask/core/dispatcher.py | 3 | ||||
-rw-r--r-- | src/leap/bitmask/core/mail_services.py | 8 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/leap/bitmask/cli/mail.py b/src/leap/bitmask/cli/mail.py index 9bb5581d..f0fa9722 100644 --- a/src/leap/bitmask/cli/mail.py +++ b/src/leap/bitmask/cli/mail.py @@ -31,10 +31,10 @@ SUBCOMMANDS: enable Start service disable Stop service status Display status about service - get-token Returns token for the mail service - get-smtp-certificate Downloads a new smtp certificate + get_token Returns token for the mail service + get_smtp_certificate Downloads a new smtp certificate '''.format(name=command.appname) - commands = ['enable', 'disable', 'status', 'get-token', - 'get-smtp-certificate'] + commands = ['enable', 'disable', 'status', 'get_token', + 'get_smtp_certificate'] diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py index f57790e2..e81cad62 100644 --- a/src/leap/bitmask/core/dispatcher.py +++ b/src/leap/bitmask/core/dispatcher.py @@ -35,7 +35,7 @@ class SubCommand(object): _method = getattr(self, 'do_' + subcmd.upper(), None) if not _method: raise RuntimeError('No such subcommand') - return _method(service, *parts, **kw) + return defer.maybeDeferred(_method, service, *parts, **kw) class UserCmd(SubCommand): @@ -105,6 +105,7 @@ class MailCmd(SubCommand): @register_method('dict') def do_ENABLE(self, service, *parts, **kw): + # FIXME -- service doesn't have this method d = service.do_enable_service(self.label) return d diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py index 799ff3c6..68cb444a 100644 --- a/src/leap/bitmask/core/mail_services.py +++ b/src/leap/bitmask/core/mail_services.py @@ -459,15 +459,15 @@ class StandardMailService(service.MultiService, HookableService): # commands def do_status(self): - return 'mail: %s' % 'running' if self.running else 'disabled' + status = 'running' if self.running else 'disabled' + return {'mail': status} def get_token(self): active_user = self._active_user if not active_user: - return defer.succeed('NO ACTIVE USER') + return defer.succeed({'user': None}) token = self._service_tokens.get(active_user) - # TODO return just the tuple, no format. - return defer.succeed("MAIL TOKEN (%s): %s" % (active_user, token)) + return defer.succeed({'user': active_user, 'token': token}) def do_get_smtp_cert_path(self, userid): username, provider = userid.split('@') |