oops + lint

This commit is contained in:
Michael Hudson-Doyle 2018-12-10 11:57:40 +13:00
parent 85b581e587
commit 0d5566dc9f
2 changed files with 19 additions and 7 deletions

View File

@ -80,7 +80,7 @@ class InstallTask(BackgroundTask):
self.kw = kw self.kw = kw
def __repr__(self): def __repr__(self):
return "InstallTask(%r, *%r, **%r)"%(self.func, self.args, self.kw) return "InstallTask(%r, *%r, **%r)" % (self.func, self.args, self.kw)
def start(self): def start(self):
self.controller._install_event_start(self.step_name) self.controller._install_event_start(self.step_name)
@ -280,7 +280,7 @@ class InstallProgressController(BaseController):
else: else:
os.unlink( os.unlink(
os.path.join( os.path.join(
self.base_model, "etc/apt/sources.list.d/iso.list")) self.base_model.target, "etc/apt/sources.list.d/iso.list"))
cmd = [ cmd = [
sys.executable, "-m", "curtin", "in-target", "-t", "/target", sys.executable, "-m", "curtin", "in-target", "-t", "/target",
"--", "apt-get", "update", "--", "apt-get", "update",
@ -291,18 +291,24 @@ class InstallProgressController(BaseController):
self.copy_logs_to_target() self.copy_logs_to_target()
class w(TaskWatcher): class w(TaskWatcher):
def __init__(self, controller): def __init__(self, controller):
self.controller = controller self.controller = controller
def task_complete(self, stage): def task_complete(self, stage):
pass pass
def task_error(self, stage, info): def task_error(self, stage, info):
if isinstance(info, tuple): if isinstance(info, tuple):
tb = traceback.format_exception(*info) tb = traceback.format_exception(*info)
self.controller.curtin_error("".join(tb)) self.controller.curtin_error("".join(tb))
else: else:
self.controller.curtin_error() self.controller.curtin_error()
def tasks_finished(self): def tasks_finished(self):
self.controller.loop.set_alarm_in(0.0, lambda loop, ud:self.controller.postinstall_complete()) self.controller.loop.set_alarm_in(
0.0,
lambda loop, ud: self.controller.postinstall_complete())
tasks = [ tasks = [
('drain', WaitForCurtinEventsTask(self)), ('drain', WaitForCurtinEventsTask(self)),
('cloud-init', InstallTask( ('cloud-init', InstallTask(

View File

@ -150,15 +150,21 @@ class SubiquityModel:
'preserve_sources_list': False, 'preserve_sources_list': False,
'sources': { 'sources': {
'iso.list': { 'iso.list': {
'source': 'deb file:///run/cdrom $RELEASE main restricted', 'source':
'deb file:///run/cdrom $RELEASE main restricted',
}, },
}, },
}, },
'curthooks_commands': { 'curthooks_commands': {
'000-setup-tmpfs': ['mount', '-t', 'tmpfs', 'tmpfs', os.path.join(self.target, 'run')], '000-setup-tmpfs': [
'001-create-run-cdrom': ['mkdir', '-p', os.path.join(self.target, 'run', 'cdrom')], 'mount', '-t', 'tmpfs', 'tmpfs',
'002-mount-run-cdrom': ['mount', '--bind', '/cdrom', os.path.join(self.target, 'run', 'cdrom')], os.path.join(self.target, 'run')],
'001-create-run-cdrom': [
'mkdir', '-p', os.path.join(self.target, 'run', 'cdrom')],
'002-mount-run-cdrom': [
'mount', '--bind', '/cdrom',
os.path.join(self.target, 'run', 'cdrom')],
}, },
'install': { 'install': {