def set_perms(self): """ sets permissions """ try: log.info("Setting permissions for user {}".format(utils.install_user())) utils.chown(self.config.cfg_path, utils.install_user(), utils.install_user(), recursive=True) utils.get_command_output("sudo chmod 777 {}".format(self.config.cfg_path)) utils.get_command_output("sudo chmod 777 -R {}/*".format(self.config.cfg_path)) except: msg = "Error setting ownership for " "{}".format(self.config.cfg_path) log.exception(msg) raise Exception(msg)
def set_perms(self): # Set permissions dirs = [self.config.cfg_path, os.path.join(utils.install_home(), '.juju')] for d in dirs: try: utils.chown(d, utils.install_user(), utils.install_user(), recursive=True) except: raise MaasInstallError( "Unable to set ownership for {}".format(d))
def set_perms(self): # Set permissions dirs = [self.config.cfg_path, os.path.join(utils.install_home(), '.juju')] for d in dirs: try: utils.chown(d, utils.install_user(), utils.install_user(), recursive=True) except: utils.pollinate(self.session_id, 'EO') raise Exception( "Unable to set ownership for {}".format(d))
def set_perms(self): # Set permissions dirs = [ self.config.cfg_path, os.path.join(utils.install_home(), '.juju') ] for d in dirs: try: utils.chown(d, utils.install_user(), utils.install_user(), recursive=True) except: raise Exception("Unable to set ownership for {}".format(d))
def set_perms(self): # Set permissions dirs = [self.config.cfg_path, os.path.join(utils.install_home(), '.juju')] for d in dirs: try: utils.chown(d, utils.install_user(), utils.install_user(), recursive=True) except: utils.pollinate(self.session_id, 'EO') raise MaasInstallError( "Unable to set ownership for {}".format(d))
def set_perms(self): """ sets permissions """ try: utils.chown(self.config.cfg_path, utils.install_user(), utils.install_user(), recursive=True) utils.get_command_output("sudo chmod 700 {}".format( self.config.cfg_path)) utils.get_command_output("sudo chmod 600 -R {}/*".format( self.config.cfg_path)) except: raise SingleInstallException( "Unable to set ownership for {}".format(self.config.cfg_path))
def set_perms(self): """ sets permissions """ try: log.info("Setting permissions for user {}".format( utils.install_user())) utils.chown(self.config.cfg_path, utils.install_user(), utils.install_user(), recursive=True) utils.get_command_output("sudo chmod 777 {}".format( self.config.cfg_path)) utils.get_command_output("sudo chmod 777 -R {}/*".format( self.config.cfg_path)) except: msg = ("Error setting ownership for " "{}".format(self.config.cfg_path)) log.exception(msg) raise Exception(msg)
def copy_installdata_and_set_perms(self): """ copies install data and sets permissions on files/dirs """ try: utils.chown(self.config.cfg_path, utils.install_user(), utils.install_user(), recursive=True) except: raise SingleInstallException( "Unable to set ownership for {}".format(self.config.cfg_path)) # copy over the rest of our installation data from host # and setup permissions # 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.container_run( self.container_name, 'mkdir -p .cloud-install') utils.container_run( self.container_name, 'sudo mkdir -p /etc/openstack') utils.container_cp(self.container_name, os.path.join( utils.install_home(), '.cloud-install/*'), '.cloud-install/.') # our ssh keys too utils.container_cp(self.container_name, os.path.join(utils.install_home(), '.ssh/id_rsa*'), '.ssh/.') utils.container_run(self.container_name, "chmod 600 .ssh/id_rsa*")
def continue_with_interface(self): self.display_controller.ui.hide_widget_on_top() self.start_task("Installing MAAS") check_output('mkdir -p /etc/openstack', shell=True) check_output(['cp', '/etc/network/interfaces', '/etc/openstack/interfaces.cloud.bak']) check_output(['cp', '-r', '/etc/network/interfaces.d', '/etc/openstack/interfaces.cloud.d.bak']) utils.spew('/etc/openstack/interface', self.target_iface) utils.apt_install('openstack-multi') self.start_task("Configuring MAAS") self.create_superuser() self.apikey = self.get_apikey() self.login_to_maas(self.apikey) try: utils.chown(os.path.join(utils.install_home(), '.maascli.db'), utils.install_user(), utils.install_user()) except: raise MaasInstallError("Unable to set permissions on {}".format( os.path.join(utils.install_home(), '.maascli.db'))) self.start_task("Waiting for MAAS cluster registration") cluster_uuid = self.wait_for_registration() self.create_maas_bridge(self.target_iface) self.prompt_for_bridge() self.start_task("Configuring MAAS networks") self.configure_maas_networking(cluster_uuid, 'br0', self.gateway, self.dhcp_range, self.static_range) self.configure_dns() self.config.save_maas_creds(self.gateway, self.apikey) if "MAAS_HTTP_PROXY" in os.environ: pv = os.environ['MAAS_HTTP_PROXY'] out = utils.get_command_output('maas maas maas set-config ' 'name=http_proxy ' 'value={}'.format(pv)) if out['status'] != 0: log.debug("Error setting maas proxy config: {}".format(out)) raise MaasInstallError("Error setting proxy config") self.display_controller.info_message("Importing MAAS boot images") self.start_task("Importing MAAS boot images") out = utils.get_command_output('maas maas boot-resources import') if out['status'] != 0: log.debug("Error starting boot images import: {}".format(out)) raise MaasInstallError("Error setting proxy config") def pred(out): return out['output'] != '[]' ok = utils.poll_until_true('maas maas boot-images read ' ' {}'.format(cluster_uuid), pred, 15, timeout=7200) if not ok: log.debug("poll timed out for getting boot images") raise MaasInstallError("Downloading boot images timed out") self.display_controller.info_message("Done importing boot images") self.stop_current_task() msg = "Waiting for sufficient resources in MAAS" self.display_controller.info_message(msg) self.display_controller.current_installer = self self.display_controller.current_state = InstallState.NODE_WAIT
def continue_with_interface(self): self.display_controller.hide_widget_on_top() self.tasker.start_task("Installing MAAS") check_output('mkdir -p /etc/openstack', shell=True) check_output([ 'cp', '/etc/network/interfaces', '/etc/openstack/interfaces.cloud.bak' ]) check_output([ 'cp', '-r', '/etc/network/interfaces.d', '/etc/openstack/interfaces.cloud.d.bak' ]) utils.spew('/etc/openstack/interface', self.target_iface) utils.apt_install('openstack-multi') self.tasker.start_task("Configuring MAAS") self.create_superuser() self.apikey = self.get_apikey() self.login_to_maas(self.apikey) try: utils.chown(os.path.join(utils.install_home(), '.maascli.db'), utils.install_user(), utils.install_user()) except: raise MaasInstallError("Unable to set permissions on {}".format( os.path.join(utils.install_home(), '.maascli.db'))) self.tasker.start_task("Waiting for MAAS cluster registration") cluster_uuid = self.wait_for_registration() self.create_maas_bridge(self.target_iface) self.prompt_for_bridge() self.tasker.start_task("Configuring MAAS networks") self.configure_maas_networking(cluster_uuid, 'br0', self.gateway, self.dhcp_range, self.static_range) self.configure_dns() self.config.setopt('maascreds', dict(api_host=self.gateway, api_key=self.apikey)) if "MAAS_HTTP_PROXY" in os.environ: pv = os.environ['MAAS_HTTP_PROXY'] out = utils.get_command_output('maas maas maas set-config ' 'name=http_proxy ' 'value={}'.format(pv)) if out['status'] != 0: log.debug("Error setting maas proxy config: {}".format(out)) raise MaasInstallError("Error setting proxy config") self.display_controller.status_info_message( "Importing MAAS boot images") self.tasker.start_task("Importing MAAS boot images") out = utils.get_command_output('maas maas boot-resources import') if out['status'] != 0: log.debug("Error starting boot images import: {}".format(out)) raise MaasInstallError("Error setting proxy config") def pred(out): return out['output'] != '[]' ok = utils.poll_until_true('maas maas boot-images read ' ' {}'.format(cluster_uuid), pred, 15, timeout=7200) if not ok: log.debug("poll timed out for getting boot images") raise MaasInstallError("Downloading boot images timed out") self.display_controller.status_info_message( "Done importing boot images") self.tasker.stop_current_task() msg = "Waiting for sufficient resources in MAAS" self.display_controller.status_info_message(msg) self.display_controller.current_installer = self self.display_controller.current_state = InstallState.NODE_WAIT