def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES): # start admin node admin = self.nodes().admin admin.disk_devices.get(device='cdrom').volume.upload(settings.ISO_PATH) self.get_virtual_environment().start(self.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys(self.get_keys(admin, custom=custom, build_images=build_images)) if custom: self.setup_customisation() # wait while installation complete admin.await(self.admin_net, timeout=10 * 60) self.set_admin_ssh_password() self.wait_bootstrap() time.sleep(10) self.set_admin_keystone_password() self.sync_time_admin_node() if settings.MULTIPLE_NETWORKS: self.describe_second_admin_interface() multiple_networks_hacks.configure_second_admin_cobbler(self) multiple_networks_hacks.configure_second_dhcrelay(self) self.nailgun_actions.set_collector_address( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT ))
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES): # start admin node admin = self.nodes().admin admin.disk_devices.get(device='cdrom').volume.upload(settings.ISO_PATH) self.get_virtual_environment().start(self.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys( self.get_keys(admin, custom=custom, build_images=build_images)) if custom: self.setup_customisation() # wait while installation complete admin. await (self.admin_net, timeout=10 * 60) self.set_admin_ssh_password() self.wait_bootstrap() time.sleep(10) self.set_admin_keystone_password() self.sync_time_admin_node() if settings.MULTIPLE_NETWORKS: self.describe_second_admin_interface() multiple_networks_hacks.configure_second_admin_cobbler(self) multiple_networks_hacks.configure_second_dhcrelay(self) self.nailgun_actions.set_collector_address(settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT))
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE): # start admin node admin = self.d_env.nodes().admin if(iso_connect_as == 'usb'): admin.disk_devices.get(device='disk', bus='usb').volume.upload(settings.ISO_PATH) else: # cdrom is default admin.disk_devices.get( device='cdrom').volume.upload(settings.ISO_PATH) self.d_env.start(self.d_env.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys(self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if custom: self.setup_customisation() # wait while installation complete admin.await(self.d_env.admin_net, timeout=10 * 60) self.set_admin_ssh_password() self.admin_actions.modify_configs(self.d_env.router()) self.wait_bootstrap() self.docker_actions.wait_for_ready_containers() time.sleep(10) self.set_admin_keystone_password() self.sync_time() if settings.UPDATE_MASTER: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) cmd = ("echo -e" " '[temporary-{0}]\nname=temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=1' > {2}").format(i, url, conf_file) with self.d_env.get_admin_remote() as remote: remote.execute(cmd) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_second_admin_interface() multiple_networks_hacks.configure_second_admin_cobbler(self) self.nailgun_actions.set_collector_address( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd in order to apply new settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT )) if settings.PATCHING_DISABLE_UPDATES: remote = self.d_env.get_admin_remote() cmd = "find /etc/yum.repos.d/ -type f -regextype posix-egrep" \ " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " \ "xargs -n1 -i sed '$aenabled=0' -i {}" self.execute_remote_cmd(remote, cmd)
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE): # start admin node admin = self.d_env.nodes().admin if(iso_connect_as == 'usb'): admin.disk_devices.get(device='disk', bus='usb').volume.upload(settings.ISO_PATH) else: # cdrom is default admin.disk_devices.get( device='cdrom').volume.upload(settings.ISO_PATH) self.d_env.start(self.d_env.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys(self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if custom: self.setup_customisation() # wait while installation complete admin.await(self.d_env.admin_net, timeout=10 * 60) self.set_admin_ssh_password() self.admin_actions.modify_configs(self.d_env.router()) self.wait_bootstrap() self.docker_actions.wait_for_ready_containers() time.sleep(10) self.set_admin_keystone_password() self.sync_time() if settings.MULTIPLE_NETWORKS: self.describe_second_admin_interface() multiple_networks_hacks.configure_second_admin_cobbler(self) self.nailgun_actions.set_collector_address( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd in order to apply new settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT ))
def setup_environment(self, custom=settings.CUSTOM_ENV, build_images=settings.BUILD_IMAGES, iso_connect_as=settings.ADMIN_BOOT_DEVICE, security=settings.SECURITY_TEST): # start admin node admin = self.d_env.nodes().admin if (iso_connect_as == 'usb'): admin.disk_devices.get(device='disk', bus='usb').volume.upload(settings.ISO_PATH) else: # cdrom is default admin.disk_devices.get(device='cdrom').volume.upload( settings.ISO_PATH) self.d_env.start(self.d_env.nodes().admins) logger.info("Waiting for admin node to start up") wait(lambda: admin.driver.node_active(admin), 60) logger.info("Proceed with installation") # update network parameters at boot screen admin.send_keys( self.get_keys(admin, custom=custom, build_images=build_images, iso_connect_as=iso_connect_as)) if custom: self.setup_customisation() if security: nessus_node = NessusActions(self.d_env) nessus_node.add_nessus_node() # wait while installation complete admin. await (self.d_env.admin_net, timeout=10 * 60) self.set_admin_ssh_password() self.admin_actions.modify_configs(self.d_env.router()) self.wait_bootstrap() self.docker_actions.wait_for_ready_containers() time.sleep(10) self.set_admin_keystone_password() self.sync_time() if settings.UPDATE_MASTER: if settings.UPDATE_FUEL_MIRROR: for i, url in enumerate(settings.UPDATE_FUEL_MIRROR): conf_file = '/etc/yum.repos.d/temporary-{}.repo'.format(i) cmd = ("echo -e" " '[temporary-{0}]\nname=" "temporary-{0}\nbaseurl={1}/" "\ngpgcheck=0\npriority=" "1' > {2}").format(i, url, conf_file) with self.d_env.get_admin_remote() as remote: remote.execute(cmd) self.admin_install_updates() if settings.MULTIPLE_NETWORKS: self.describe_second_admin_interface() multiple_networks_hacks.configure_second_admin_cobbler(self) self.nailgun_actions.set_collector_address(settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT, settings.FUEL_STATS_SSL) # Restart statsenderd in order to apply new settings(Collector address) self.nailgun_actions.force_fuel_stats_sending() if settings.FUEL_STATS_ENABLED: self.fuel_web.client.send_fuel_stats(enabled=True) logger.info('Enabled sending of statistics to {0}:{1}'.format( settings.FUEL_STATS_HOST, settings.FUEL_STATS_PORT)) if settings.PATCHING_DISABLE_UPDATES: with self.d_env.get_admin_remote() as remote: cmd = "find /etc/yum.repos.d/ -type f -regextype posix-egrep" \ " -regex '.*/mos[0-9,\.]+\-(updates|security).repo' | " \ "xargs -n1 -i sed '$aenabled=0' -i {}" self.execute_remote_cmd(remote, cmd)