def finish(self, needs_lxd_setup=False, lxdnetwork=None, back=False): """ Processes the new LXD setup and loads the controller to finish bootstrapping the model. Arguments: back: if true loads previous controller needs_lxd_setup: if true prompt user to run lxd init """ if back: return controllers.use('clouds').render() if needs_lxd_setup: EventLoop.remove_alarms() EventLoop.exit(1) if lxdnetwork is None: return app.ui.show_exception_message( Exception("Unable to configure LXD network bridge.")) formatted_network = self.__format_input(lxdnetwork) app.log.debug("LXD Config {}".format(formatted_network)) out = self.__format_conf(formatted_network) with NamedTemporaryFile(mode="w", encoding="utf-8", delete=False) as tempf: app.log.debug("Saving LXD config to {}".format(tempf.name)) utils.spew(tempf.name, out) sh = utils.run('sudo mv {} /etc/default/lxd-bridge'.format( tempf.name), shell=True) if sh.returncode > 0: return app.ui.show_exception_message( Exception("Problem saving config: {}".format( sh.stderr.decode('utf8')))) app.log.debug("Restarting lxd-bridge") utils.run("sudo systemctl restart lxd-bridge.service", shell=True) utils.pollinate(app.session_id, 'L002') controllers.use('newcloud').render( cloud='localhost', bootstrap=True)
def finish(self, needs_lxd_setup=False, lxdnetwork=None, back=False): """ Processes the new LXD setup and loads the controller to finish bootstrapping the model. Arguments: back: if true loads previous controller needs_lxd_setup: if true prompt user to run lxd init """ if back: return controllers.use('clouds').render() if needs_lxd_setup: EventLoop.remove_alarms() EventLoop.exit(1) if lxdnetwork is None: return app.ui.show_exception_message( Exception("Unable to configure LXD network bridge.")) formatted_network = self.__format_input(lxdnetwork) app.log.debug("LXD Config {}".format(formatted_network)) out = self.__format_conf(formatted_network) with NamedTemporaryFile(mode="w", encoding="utf-8", delete=False) as tempf: app.log.debug("Saving LXD config to {}".format(tempf.name)) utils.spew(tempf.name, out) sh = run('sudo mv {} /etc/default/lxd-bridge'.format( tempf.name), shell=True) if sh.returncode > 0: return app.ui.show_exception_message( Exception("Problem saving config: {}".format( sh.stderr.decode('utf8')))) app.log.debug("Restarting lxd-bridge") run("sudo systemctl restart lxd-bridge.service", shell=True) utils.pollinate(app.session_id, 'L002') controllers.use('newcloud').render( cloud='localhost', bootstrap=True)
def unhandled_input(self, key): if key in ['q', 'Q']: EventLoop.exit(0)
def cancel(self, btn): EventLoop.exit(0)
def finish(self): EventLoop.remove_alarms() EventLoop.exit(0)
def cancel(self, button): pollinate(app.session_id, 'UC') EventLoop.exit(0)
def cancel(self, button): EventLoop.exit(0)
def unhandled_input(key): if key in ['q', 'Q']: async .shutdown() EventLoop.exit(0)
def unhandled_input(key): if key in ['q', 'Q']: async.shutdown() EventLoop.exit(0)
def done_cb(self): log.debug("done_cb called") EventLoop.exit(0)