From 1d69d683323733eae3b0230938cf948741e1dba9 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Tue, 2 May 2017 11:25:50 +0200 Subject: [bug] set a non-None value for configuration defaults None is recognized as not-default and gives an error if the searched config value is not present in the config file. This was provoking an error with manhole not being configured. --- src/leap/bitmask/core/service.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py index 314c889..8595fce 100644 --- a/src/leap/bitmask/core/service.py +++ b/src/leap/bitmask/core/service.py @@ -85,9 +85,9 @@ class BitmaskBackend(configurable.ConfigurableService): return self.get_config('services', service, False, boolean=True) def with_manhole(): - user = self.get_config('manhole', 'user', None) - passwd = self.get_config('manhole', 'passwd', None) - port = self.get_config('manhole', 'port', None) + user = self.get_config('manhole', 'user', '') + passwd = self.get_config('manhole', 'passwd', '') + port = self.get_config('manhole', 'port', manhole.PORT) if user and passwd: conf = {'user': user, 'passwd': passwd, 'port': port} return conf @@ -116,7 +116,7 @@ class BitmaskBackend(configurable.ConfigurableService): on_start(self._init_websockets) manholecfg = with_manhole() - if manhole: + if manholecfg: on_start(self._init_manhole, manholecfg) def _touch_token_file(self): @@ -227,10 +227,7 @@ class BitmaskBackend(configurable.ConfigurableService): return service def _init_manhole(self, cfg): - try: - port = int(cfg.get('port')) - except ValueError: - port = manhole.PORT + port = cfg['port'] user, passwd = cfg['user'], cfg['passwd'] sshFactory = manhole.getManholeFactory( {'core': self}, user, passwd) -- cgit v1.2.3