summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-20 13:52:30 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-20 13:52:30 -0300
commit98ecb0421d8f5cc2f1420ad39c514315fd048118 (patch)
tree2c5f5a2af54e8a4c0ef22c569b274d1831ae54a0
parent5aa163f1519e96bdc16892d4073a86bd19df3bd3 (diff)
Do not try/except sections in the config, explicitly check for their existence
This avoids adding useless tracebacks to the real exceptions caught by Twisted. Possible tx bug here.
-rw-r--r--changes/bug_dont_raise_nosectionerror2
-rw-r--r--src/launcher.py21
2 files changed, 13 insertions, 10 deletions
diff --git a/changes/bug_dont_raise_nosectionerror b/changes/bug_dont_raise_nosectionerror
new file mode 100644
index 0000000..fbc2306
--- /dev/null
+++ b/changes/bug_dont_raise_nosectionerror
@@ -0,0 +1,2 @@
+ o Avoid the try/except idiom when accessing configs to avoid messing
+ with the client traceback. Fixes #5007. \ No newline at end of file
diff --git a/src/launcher.py b/src/launcher.py
index b62bd23..2a43e54 100644
--- a/src/launcher.py
+++ b/src/launcher.py
@@ -4,21 +4,22 @@ import time
import threading
import ConfigParser
-from leap.bitmask.app import main as leap_client
+from leap.bitmask.app import main as bitmask_client
from leap.common.events import server
from thandy.ClientCLI import update as thandy_update
bundles_per_platform = {
- "Windows" : "/bundleinfo/LEAPClient-win/",
- "Darwin" : "",
- "Linux" : "/bundleinfo/LEAPClient/",
+ "Windows": "/bundleinfo/LEAPClient-win/",
+ "Darwin": "",
+ "Linux": "/bundleinfo/LEAPClient/",
}
GENERAL_SECTION = "General"
UPDATES_KEY = "Updates"
+
class Thandy(threading.Thread):
def run(self):
while True:
@@ -50,16 +51,16 @@ if __name__ == "__main__":
config.read("launcher.conf")
launch_thandy = False
- try:
+
+ has_config = config.has_section(GENERAL_SECTION) and \
+ config.has_option(GENERAL_SECTION, UPDATES_KEY)
+
+ if has_config:
launch_thandy = config.getboolean(GENERAL_SECTION, UPDATES_KEY)
- except ConfigParser.NoSectionError as ns:
- pass
- except ConfigParser.NoOptionError as no:
- pass
if launch_thandy:
thandy_thread = Thandy()
thandy_thread.daemon = True
thandy_thread.start()
- leap_client()
+ bitmask_client()