This commit is contained in:
Michael Hudson-Doyle 2016-07-28 11:13:19 +12:00
parent 95dc9664e5
commit e4d5c7fa85
5 changed files with 17 additions and 10 deletions

View File

@ -18,7 +18,7 @@ import argparse
import sys
import logging
import signal
from subiquitycore.log import setup_logger, LOGFILE
from subiquitycore.log import setup_logger
from subiquitycore import __version__ as VERSION
from console_conf.core import ConsoleConf
from subiquitycore.core import ApplicationError
@ -70,10 +70,14 @@ def parse_options(argv):
def control_c_handler(signum, frame):
sys.exit(1)
LOGDIR = "/writable/.subiquity"
def main():
opts = parse_options(sys.argv[1:])
setup_logger()
global LOGDIR
if opts.dry_run:
LOGDIR = ".subiquity"
LOGFILE = setup_logger(dir=LOGDIR)
logger = logging.getLogger('console_conf')
logger.info("Starting console-conf v{}".format(VERSION))
logger.info("Arguments passed: {}".format(sys.argv))

View File

@ -15,9 +15,8 @@
from subiquitycore.controllers.identity import BaseIdentityController
from subiquitycore.ui.views import LoginView
from console_conf.ui.views import IdentityView
from console_conf.ui.views import IdentityView, LoginView
class IdentityController(BaseIdentityController):
@ -39,7 +38,8 @@ class IdentityController(BaseIdentityController):
net_model = self.controllers['Network'].model
configured_ifaces = net_model.get_configured_interfaces()
login_view = LoginView(self.model,
login_view = LoginView(self.opts,
self.model,
self.signal,
self.model.user,
configured_ifaces)

View File

@ -16,4 +16,5 @@
""" ConsoleConf UI Views """
from .identity import IdentityView # NOQA
from .login import LoginView # NOQA
from .welcome import WelcomeView # NOQA

View File

@ -122,7 +122,7 @@ class IdentityView(BaseView):
'realname': self.email.value,
'username': self.email.value,
'passwod': '',
'confirm_password': ''
'confirm_password': '',
}
self.model.add_user(result)
self.signal.emit_signal('menu:identity:login:main')
@ -131,3 +131,4 @@ def users():
r = set()
for pw in pwd.getpwall():
r.add(pw.pw_name)
return r

View File

@ -22,10 +22,11 @@ LOGDIR = "/writable/.subiquity"
LOGFILE = os.path.join(LOGDIR, "subiquity-debug.log")
def setup_logger(name=__name__):
def setup_logger(name=__name__, dir=LOGDIR):
LOGFILE = os.path.join(dir, "subiquity-debug.log")
try:
if not os.path.isdir(LOGDIR):
os.makedirs(LOGDIR)
if not os.path.isdir(dir):
os.makedirs(dir)
log = TimedRotatingFileHandler(LOGFILE,
when='D',
interval=1,
@ -46,4 +47,4 @@ def setup_logger(name=__name__):
logger = logging.getLogger('')
logger.setLevel('DEBUG')
logger.addHandler(log)
return logger
return LOGFILE