diff --git a/subiquity/models/installpath.py b/subiquity/models/installpath.py index 5e814cb0..a366fd7f 100644 --- a/subiquity/models/installpath.py +++ b/subiquity/models/installpath.py @@ -46,34 +46,62 @@ class InstallpathModel(object): elif self.path == 'maas_region': self.source = '/media/region' self.curtin['debconf_selections'] = { - 'maas-username': 'maas-region-controller maas/username string %s' % results['username'], - 'maas-password': 'maas-region-controller maas/password password %s' % results['password'], + 'maas-username': ('maas-region-controller maas/username ' + 'string %s' % results['username']), + 'maas-password': ('maas-region-controller maas/password ' + 'password %s' % results['password']), } self.curtin['late_commands'] = { - # Maintainer scripts cache results, from config files, if they exist - # These shouldn't exist, since this was fixed in livecd-rootfs - # but remove these, just to be sure + # Maintainer scripts cache results, from config files, if they + # exist. These shouldn't exist, since this was fixed in + # livecd-rootfs but remove these, just to be sure. '900-maas': ['rm', '-f', '/target/etc/maas/rackd.conf'], '901-maas': ['rm', '-f', '/target/etc/maas/region.conf'], - # All the crazy things are workarounds for maas maintainer scripts deficiencies - # see https://bugs.launchpad.net/ubuntu/+source/maas/+bugs?field.tag=subiquity + # All the crazy things are workarounds for maas maintainer + # scripts deficiencies see: + # LP: #1766209 + # LP: #1766211 + # LP: #1766214 + # LP: #1766218 + # LP: #1766241 # - # uuid is not initialized by reconfigure, maybe it should, if it is at all used - # make it so, to make it match the udeb/deb installs - '902-maas': ['curtin', 'in-target', '--', 'maas-rack', 'config', '--init'], - # this should do setups of maas-url for the rack controller, and secret if needed. - '903-maas': ['curtin', 'in-target', '--', 'dpkg-reconfigure', '-u', '-fnoninteractive', 'maas-rack-controller'], - # Below are workaround to make postgresql database running, and invoke-rc.d --force to not fail - # And a running postgresql is needed, to change the role password and to create an admin user + # uuid is not initialized by reconfigure, maybe it should, + # if it is at all used make it so, to make it match the + # udeb/deb installs + '902-maas': ['curtin', 'in-target', '--', + 'maas-rack', 'config', '--init'], + # this should do setups of maas-url for the rack controller, + # and secret if needed. + '903-maas': ['curtin', 'in-target', '--', 'dpkg-reconfigure', + '-u', '-fnoninteractive', 'maas-rack-controller'], + # Below are workaround to make postgresql database running, + # and invoke-rc.d --force to not faill and a running postgresql + # is needed, to change the role password and to create an admin + # user. '904-maas': ['mount', '-o', 'bind', '/proc', '/target/proc'], '905-maas': ['mount', '-o', 'bind', '/sys', '/target/sys'], '906-maas': ['mount', '-o', 'bind', '/dev', '/target/dev'], - '907-maas': ['mount', '-o', 'bind', '/target/bin/true', '/target/usr/sbin/invoke-rc.d'], - '908-maas': ['chroot', '/target', 'sh', '-c', 'pg_ctlcluster --skip-systemctl-redirect $(/bin/ls /var/lib/postgresql/) main start'], - # These are called like this, because reconfigure doesn't create nor change an admin user account, nor regens the semi-autogenerated maas-url - '909-maas': ['chroot', '/target', 'sh', '-c', 'debconf -fnoninteractive -omaas-region-controller /var/lib/dpkg/info/maas-region-controller.config configure'], - '910-maas': ['chroot', '/target', 'sh', '-c', 'debconf -fnoninteractive -omaas-region-controller /var/lib/dpkg/info/maas-region-controller.postinst configure'], - '911-maas': ['chroot', '/target', 'sh', '-c', 'pg_ctlcluster --skip-systemctl-redirect $(/bin/ls /var/lib/postgresql/) main stop'], + '907-maas': ['mount', '-o', 'bind', '/target/bin/true', + '/target/usr/sbin/invoke-rc.d'], + '908-maas': ['chroot', '/target', 'sh', '-c', + 'pg_ctlcluster --skip-systemctl-redirect ' + '$(/bin/ls /var/lib/postgresql/) main start'], + # These are called like this, because reconfigure doesn't + # create nor change an admin user account, nor regens the + # semi-autogenerated maas-url + '909-maas': + ['chroot', '/target', 'sh', '-c', ( + 'debconf -fnoninteractive -omaas-region-controller ' + '/var/lib/dpkg/info/maas-region-controller.config ' + 'configure')], + '910-maas': + ['chroot', '/target', 'sh', '-c', ( + 'debconf -fnoninteractive -omaas-region-controller ' + '/var/lib/dpkg/info/maas-region-controller.postinst ' + 'configure')], + '911-maas': ['chroot', '/target', 'sh', '-c', ( + 'pg_ctlcluster --skip-systemctl-redirect ' + '$(/bin/ls /var/lib/postgresql/) main stop')], '912-maas': ['umount', '/target/usr/sbin/invoke-rc.d'], '913-maas': ['umount', '/target/dev'], '914-maas': ['umount', '/target/sys'], @@ -82,16 +110,25 @@ class InstallpathModel(object): elif self.path == 'maas_rack': self.source = '/media/rack' self.curtin['debconf_selections'] = { - 'maas-url': 'maas-rack-controller maas-rack-controller/maas-url string %s' % results['url'], - 'maas-secret': 'maas-rack-controller maas-rack-controller/shared-secret password %s' % results['secret'], + 'maas-url': ('maas-rack-controller ' + 'maas-rack-controller/maas-url ' + 'string %s' % results['url']), + 'maas-secret': ('maas-rack-controller ' + 'maas-rack-controller/shared-secret ' + 'password %s' % results['secret']), } self.curtin['late_commands'] = { '90-maas': ['rm', '-f', '/target/etc/maas/rackd.conf'], - '91-maas': ['curtin', 'in-target', '--', 'maas-rack', 'config', '--init'], - # maas-rack-controller is broken, and does db_input & go on the password question in the postinst... - # when it should have been done in .config - # and it doesn't gracefully handle the case of db_go returning 30 skipped - '93-maas': ['curtin', 'in-target', '--', 'sh', '-c', 'debconf -fnoninteractive -omaas-rack-controller /var/lib/dpkg/info/maas-rack-controller.postinst configure || :'], + '91-maas': ['curtin', 'in-target', '--', 'maas-rack', + 'config', '--init'], + # maas-rack-controller is broken, and does db_input & go on + # the password question in the postinst... when it should have + # been done in .config and it doesn't gracefully handle the + # case of db_go returning 30 skipped + '93-maas': ['curtin', 'in-target', '--', 'sh', '-c', + ('debconf -fnoninteractive -omaas-rack-controller ' + '/var/lib/dpkg/info/maas-rack-controller.postinst' + ' configure || :')], } else: raise ValueError("invalid Installpath %s" % self.path)