Unverified Commit 08da5b11 authored by Kali Kaneko's avatar Kali Kaneko
Browse files

[refactor] pass backend to core service

parent 928f547a
......@@ -17,17 +17,22 @@
"""
Run bitmask daemon.
"""
from twisted.scripts.twistd import run
from os.path import join
from sys import argv
from twisted.scripts.twistd import run
from leap.bitmask.util import here
from leap.bitmask import core
from leap.bitmask.core import flags
def run_bitmaskd():
# TODO --- configure where to put the logs... (get --logfile, --logdir
# from the bitmask_cli
for (index, arg) in enumerate(argv):
if arg == '--backend':
flags.BACKEND = argv[index + 1]
argv[1:] = [
'-y', join(here(core), "bitmaskd.tac"),
'--pidfile', '/tmp/bitmaskd.pid',
......
......@@ -17,6 +17,7 @@
"""
Bitmask-core Service.
"""
import json
import resource
from twisted.internet import reactor
......@@ -26,6 +27,7 @@ from leap.bitmask import __version__
from leap.bitmask.core import configurable
from leap.bitmask.core import mail_services
from leap.bitmask.core import _zmq
from leap.bitmask.core import flags
from leap.bonafide.service import BonafideService
from leap.common.events import server as event_server
# from leap.vpn import EIPService
......@@ -126,17 +128,18 @@ class BitmaskBackend(configurable.ConfigurableService):
# we may want to make this tuple a class member
services = ('soledad', 'keymanager', 'mail', 'eip')
status_messages = []
status = {}
for name in services:
status = 'stopped'
_status = 'stopped'
try:
if self.getServiceNamed(name).running:
status = "running"
_status = 'running'
except KeyError:
pass
status_messages.append("[{}: {}]".format(name, status))
status[name] = _status
status['backend'] = flags.BACKEND
return " ".join(status_messages)
return json.dumps(status)
def do_version(self):
version = __version__
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment