def do_install(self): self.display_controller.info_message("Building environment") if os.path.exists(self.container_abspath): # Container exists, handle return code in installer raise Exception("Container exists, please uninstall or kill " "existing cloud before proceeding.") utils.ssh_genkey() # Preparations self.prep_userdata() # setup charm configurations utils.render_charm_config(self.config, self.opts) self.prep_juju() # Set permissions self.set_perms() # Start container self.create_container_and_wait() # Install local copy of openstack installer if provided if self.opts.upstream_deb and os.path.isfile(self.opts.upstream_deb): shutil.copy(self.opts.upstream_deb, self.config.cfg_path) self._install_upstream_deb() # start the party cloud_status_bin = ['openstack-status'] self.display_controller.info_message("Bootstrapping Juju") self.start_task("Bootstrapping Juju") utils.container_run( self.container_name, "JUJU_HOME={} juju bootstrap".format( self.config.cfg_path)) utils.container_run( self.container_name, "JUJU_HOME={} juju status".format( self.config.cfg_path)) if self.opts.install_only: log.info("Done installing, stopping here per --install-only.") sys.exit(0) self.display_controller.info_message("Starting cloud deployment") utils.container_run_status( self.container_name, " ".join(cloud_status_bin))
def do_install(self): self.display_controller.info_message("Building environment") if os.path.exists(self.container_abspath): # Container exists, handle return code in installer raise Exception("Container exists, please uninstall or kill " "existing cloud before proceeding.") utils.ssh_genkey() # Prepare cloud-init file for creation self.prep_userdata() # Start container self.create_container_and_wait() # configure juju environment for bootstrap single_env = utils.load_template('juju-env/single.yaml') single_env_modified = single_env.render( openstack_password=self.config.openstack_password) utils.spew('/tmp/single.yaml', single_env_modified) utils.container_run(self.container_name, 'mkdir -p .juju') utils.container_cp(self.container_name, '/tmp/single.yaml', '.juju/environments.yaml') # Set permissions self.copy_installdata_and_set_perms() # start the party cloud_status_bin = ['openstack-status'] if self.opts.enable_swift: cloud_status_bin.append('--enable-swift') self.display_controller.info_message("Bootstrapping Juju ..") self.start_task("Starting Juju server") utils.container_run(self.container_name, "juju bootstrap") utils.container_run(self.container_name, "juju status") if self.opts.install_only: log.info("Done installing, stopping here per --install-only.") sys.exit(0) self.display_controller.info_message("Starting cloud deployment ..") utils.container_run_status( self.container_name, " ".join(cloud_status_bin))
def do_install(self): # Install package deps utils.apt_install('openstack-multi') self.tasker.start_task("Bootstrapping Juju") self.config.setopt('current_state', InstallState.RUNNING.value) maas_creds = self.config.getopt('maascreds') maas_env = utils.load_template('juju-env/maas.yaml') render_parts = { 'openstack_password': self.config.getopt('openstack_password'), 'maas_server': maas_creds['api_host'], 'maas_apikey': maas_creds['api_key'], 'ubuntu_series': self.config.getopt('ubuntu_series') } for opt in [ 'http_proxy', 'https_proxy', 'no_proxy', 'apt_proxy', 'image_metadata_url', 'tools_metadata_url' ]: val = self.config.getopt(opt) if val: render_parts[opt] = val maas_env_modified = maas_env.render(render_parts) check_output(['mkdir', '-p', self.config.juju_path()]) utils.spew(self.config.juju_environments_path, maas_env_modified) utils.render_charm_config(self.config) utils.ssh_genkey() # Set remaining permissions self.set_perms() # Starts the party self.display_controller.status_info_message("Bootstrapping Juju") dbgflags = "" if os.getenv("DEBUG_JUJU_BOOTSTRAP"): dbgflags = "--debug" bsflags = "" bstarget = os.getenv("JUJU_BOOTSTRAP_TO") if bstarget: bsflags += " --to {}".format(bstarget) cons = self.config.getopt('constraints') if cons: bsflags += " --constraints \"{}\"".format(cons) cmd = ("{0} juju {1} bootstrap {2}".format(self.config.juju_home(), dbgflags, bsflags)) log.debug("Bootstrapping Juju: {}".format(cmd)) out = utils.get_command_output(cmd, timeout=None, user_sudo=True) if out['status'] != 0: log.debug("Problem during bootstrap: '{}'".format(out)) raise Exception("Problem with juju bootstrap.") # workaround to avoid connection failure at beginning of # openstack-status out = utils.get_command_output("{0} juju status".format( self.config.juju_home()), timeout=None, user_sudo=True) if out['status'] != 0: log.debug("failure to get initial juju status: '{}'".format(out)) raise Exception("Problem with juju status poke.") self.add_bootstrap_to_no_proxy() self.tasker.stop_current_task() if self.config.getopt('install_only'): log.info("Done installing, stopping here per --install-only.") self.config.setopt('install_only', True) self.loop.exit(0) # Return control back to landscape_install if need be if not self.config.is_landscape(): args = ['openstack-status'] if self.config.getopt('edit_placement'): args.append('--edit-placement') self.drop_privileges() os.execvp('openstack-status', args) else: log.debug("Finished MAAS step, now deploying Landscape.") return LandscapeInstallFinal(self, self.display_controller, self.config, self.loop).run()
def do_install(self): self.display_controller.status_info_message("Building environment") if os.path.exists(self.container_abspath): raise Exception("Container exists, please uninstall or kill " "existing cloud before proceeding.") # check for deb early, will actually install it later upstream_deb = self.config.getopt('upstream_deb') if upstream_deb and not os.path.isfile(upstream_deb): raise Exception("Upstream deb '{}' " "not found.".format(upstream_deb)) utils.ssh_genkey() self.setup_apt_proxy() self.prep_userdata() utils.render_charm_config(self.config) self.prep_juju() self.set_perms() self.create_container_and_wait() # Copy over host ssh keys Container.cp(self.container_name, os.path.join(utils.install_home(), '.ssh/id_rsa*'), '.ssh/.') # Install local copy of openstack installer if provided if upstream_deb: shutil.copy(upstream_deb, self.config.cfg_path) self._install_upstream_deb() # Stop before we attempt to access container if self.config.getopt('install_only'): log.info("Done installing, stopping here per --install-only.") self.config.setopt('install_only', True) self.loop.exit(0) # Update jujus no-proxy setting if applicable if self.config.getopt('http_proxy') or \ self.config.getopt('https_proxy'): log.info("Updating juju environments for proxy support") lxc_net = self.config.getopt('lxc_network') self.config.update_environments_yaml( key='no-proxy', val='{},localhost,{}'.format( Container.ip(self.container_name), netutils.get_ip_set(lxc_net))) # start the party cloud_status_bin = ['openstack-status'] self.tasker.start_task("Bootstrapping Juju", self.read_progress_output) Container.run(self.container_name, "{0} juju --debug bootstrap".format( self.config.juju_home(use_expansion=True)), use_ssh=True, output_cb=self.set_progress_output) Container.run( self.container_name, "{0} juju status".format( self.config.juju_home(use_expansion=True)), use_ssh=True) self.tasker.stop_current_task() self.display_controller.status_info_message( "Starting cloud deployment") Container.run_status( self.container_name, " ".join(cloud_status_bin), self.config)
def do_install(self): # Install package deps utils.apt_install('openstack-multi') self.tasker.start_task("Bootstrapping Juju") self.config.setopt('current_state', InstallState.RUNNING.value) maas_creds = self.config.getopt('maascreds') maas_env = utils.load_template('juju-env/maas.yaml') render_parts = {'openstack_password': self.config.getopt('openstack_password'), 'maas_server': maas_creds['api_host'], 'maas_apikey': maas_creds['api_key'], 'ubuntu_series': self.config.getopt('ubuntu_series')} for opt in ['http_proxy', 'https_proxy', 'no_proxy', 'image_metadata_url', 'tools_metadata_url']: val = self.config.getopt(opt) if val: render_parts[opt] = val maas_env_modified = maas_env.render(render_parts) check_output(['mkdir', '-p', self.config.juju_path()]) utils.spew(self.config.juju_environments_path, maas_env_modified) utils.render_charm_config(self.config) utils.ssh_genkey() # Set remaining permissions self.set_perms() # Starts the party self.display_controller.status_info_message("Bootstrapping Juju") dbgflags = "" if os.getenv("DEBUG_JUJU_BOOTSTRAP"): dbgflags = "--debug" bsflags = "" bstarget = os.getenv("JUJU_BOOTSTRAP_TO") if bstarget: bsflags += " --to {}".format(bstarget) cons = self.config.getopt('constraints') if cons: bsflags += " --constraints \"{}\"".format(cons) cmd = ("{0} juju {1} bootstrap {2}".format( self.config.juju_home(), dbgflags, bsflags)) log.debug("Bootstrapping Juju: {}".format(cmd)) out = utils.get_command_output(cmd, timeout=None, user_sudo=True) if out['status'] != 0: log.debug("Problem during bootstrap: '{}'".format(out)) raise Exception("Problem with juju bootstrap.") # workaround to avoid connection failure at beginning of # openstack-status out = utils.get_command_output( "{0} juju status".format( self.config.juju_home()), timeout=None, user_sudo=True) if out['status'] != 0: log.debug("failure to get initial juju status: '{}'".format(out)) raise Exception("Problem with juju status poke.") self.add_bootstrap_to_no_proxy() self.tasker.stop_current_task() if self.config.getopt('install_only'): log.info("Done installing, stopping here per --install-only.") self.config.setopt('install_only', True) self.loop.exit(0) # Return control back to landscape_install if need be if not self.config.is_landscape(): args = ['openstack-status'] if self.config.getopt('edit_placement'): args.append('--edit-placement') self.drop_privileges() os.execvp('openstack-status', args) else: log.debug("Finished MAAS step, now deploying Landscape.") return LandscapeInstallFinal(self, self.display_controller, self.config, self.loop).run()
def do_install(self): self.display_controller.status_info_message("Building environment") if os.path.exists(self.container_abspath): raise Exception("Container exists, please uninstall or kill " "existing cloud before proceeding.") # check for deb early, will actually install it later upstream_deb = self.config.getopt('upstream_deb') if upstream_deb and not os.path.isfile(upstream_deb): raise Exception("Upstream deb '{}' " "not found.".format(upstream_deb)) utils.ssh_genkey() self.setup_apt_proxy() self.prep_userdata() utils.render_charm_config(self.config) self.prep_juju() self.set_perms() self.create_container_and_wait() # Copy over host ssh keys Container.cp(self.container_name, os.path.join(utils.install_home(), '.ssh/id_rsa*'), '.ssh/.') # Install local copy of openstack installer if provided if upstream_deb: shutil.copy(upstream_deb, self.config.cfg_path) self._install_upstream_deb() # Stop before we attempt to access container if self.config.getopt('install_only'): log.info("Done installing, stopping here per --install-only.") self.config.setopt('install_only', True) self.loop.exit(0) # Update jujus no-proxy setting if applicable if self.config.getopt('http_proxy') or \ self.config.getopt('https_proxy'): log.info("Updating juju environments for proxy support") lxc_net = self.config.getopt('lxc_network') self.config.update_environments_yaml( key='no-proxy', val='{},localhost,{}'.format(Container.ip(self.container_name), netutils.get_ip_set(lxc_net))) # start the party cloud_status_bin = ['openstack-status'] self.tasker.start_task("Bootstrapping Juju", self.read_progress_output) Container.run(self.container_name, "{0} juju --debug bootstrap".format( self.config.juju_home(use_expansion=True)), use_ssh=True, output_cb=self.set_progress_output) Container.run(self.container_name, "{0} juju status".format( self.config.juju_home(use_expansion=True)), use_ssh=True) self.tasker.stop_current_task() self.display_controller.status_info_message( "Starting cloud deployment") Container.run_status(self.container_name, " ".join(cloud_status_bin), self.config)
def do_install(self): self.start_task("Bootstrapping Juju") self.display_controller.current_state = InstallState.RUNNING maas_creds = self.config.maas_creds maas_env = utils.load_template('juju-env/maas.yaml') maas_env_modified = maas_env.render( maas_server=maas_creds['api_host'], maas_apikey=maas_creds['api_key'], openstack_password=self.config.openstack_password) check_output(['mkdir', '-p', self.config.juju_path]) utils.spew(self.config.juju_environments_path, maas_env_modified) utils.render_charm_config(self.config, self.opts) utils.ssh_genkey() # Set remaining permissions self.set_perms() # Starts the party self.display_controller.info_message("Bootstrapping Juju") dbgflags = "" if os.getenv("DEBUG_JUJU_BOOTSTRAP"): dbgflags = "--debug" bsflags = "" # bsflags = " --constraints tags=physical" bstarget = os.getenv("JUJU_BOOTSTRAP_TO") if bstarget: bsflags += " --to {}".format(bstarget) cmd = ("JUJU_HOME={0} juju {1} bootstrap {2}".format( self.config.cfg_path, dbgflags, bsflags)) log.debug("Bootstrapping Juju: {}".format(cmd)) out = utils.get_command_output(cmd, timeout=None, user_sudo=True) if out['status'] != 0: log.debug("Problem during bootstrap: '{}'".format(out)) raise Exception("Problem with juju bootstrap.") # workaround to avoid connection failure at beginning of # openstack-status out = utils.get_command_output( "JUJU_HOME={} juju status".format( self.config.cfg_path), timeout=None, user_sudo=True) if out['status'] != 0: log.debug("failure to get initial juju status: '{}'".format(out)) raise Exception("Problem with juju status poke.") self.stop_current_task() if self.opts.install_only: return # Return control back to landscape_install if need be if not self.config.is_landscape: args = ['openstack-status'] if self.opts.edit_placement: args.append('--placement') self.drop_privileges() os.execvp('openstack-status', args) else: log.debug("Finished MAAS step, now deploying Landscape.") return LandscapeInstallFinal(self, self.display_controller).run()
def do_install(self): self.start_task("Starting Juju server") maas_creds = self.config.maas_creds maas_env = utils.load_template('juju-env/maas.yaml') maas_env_modified = maas_env.render( maas_server=maas_creds['api_host'], maas_apikey=maas_creds['api_key'], openstack_password=self.config.openstack_password) check_output(['mkdir', '-p', self.config.juju_path]) utils.spew(self.config.juju_environments_path, maas_env_modified) # setup charm configurations charm_conf = utils.load_template('charmconf.yaml') charm_conf_modified = charm_conf.render( openstack_password=self.config.openstack_password) utils.spew(os.path.join(self.config.cfg_path, 'charmconf.yaml'), charm_conf_modified) utils.ssh_genkey() # Set remaining permissions self.set_perms() # Starts the party self.display_controller.info_message("Bootstrapping juju ..") dbgflags = "" if os.getenv("DEBUG_JUJU_BOOTSTRAP"): dbgflags = "--debug" bsflags = "" # FIXME: this tag is never defined, removing to allow # installers to work again # if not self.installing_new_maas: # bsflags = " --constraints tags=physical" out = utils.get_command_output("juju {} bootstrap {}".format(dbgflags, bsflags), timeout=None, user_sudo=True) if out['status'] != 0: log.debug("Problem during bootstrap: '{}'".format(out)) raise Exception("Problem with juju bootstrap.") # workaround to avoid connection failure at beginning of # openstack-status out = utils.get_command_output("juju status", timeout=None, user_sudo=True) if out['status'] != 0: log.debug("failure to get initial juju status: '{}'".format(out)) raise Exception("Problem with juju status poke.") self.stop_current_task() if self.opts.install_only: return # Return control back to landscape_install if need be if not self.config.is_landscape: args = ['openstack-status'] if self.opts.enable_swift: args.append('--enable-swift') if self.opts.edit_placement: args.append('--placement') self.drop_privileges() os.execvp('openstack-status', args) else: log.debug("Finished MAAS step, now deploying Landscape.") return LandscapeInstallFinal(self.opts, self, self.display_controller).run()