def boot(self): """ Boots up the file server vm. :return: """ self.logger.info('Initializing file server env') self.local_env = local.init_env(self.blueprint_path, inputs=self.inputs, name='File-Server', ignored_modules=cli_constants. IGNORED_LOCAL_WORKFLOW_MODULES) self.logger.info('Starting up a file server vm') self.local_env.execute('install', task_retries=40, task_retry_interval=30) self.fab_env_conf = { 'user': '******', 'key_filename': self.inputs['key_pair_path'], 'host_string': self.local_env.outputs()['vm_public_ip_address'], 'timeout': 30, 'connection_attempts': 10, 'abort_on_prompts': True } self.fs_base_url = '{0}:{1}'.format(self.fab_env_conf['host_string'], FILE_SERVER_PORT) wait_for_vm_to_become_ssh_available(self.fab_env_conf, self._execute_command, self.logger)
def boot(self): """ Boots up the file server vm. :return: """ self.logger.info('Initializing file server env') self.local_env = local.init_env( self.blueprint_path, inputs=self.inputs, name='File-Server', ignored_modules=cli_constants.IGNORED_LOCAL_WORKFLOW_MODULES) self.logger.info('Starting up a file server vm') self.local_env.execute('install', task_retries=40, task_retry_interval=30) self.fab_env_conf = { 'user': '******', 'key_filename': self.inputs['key_pair_path'], 'host_string': self.local_env.outputs()['vm_public_ip_address'], 'timeout': 30, 'connection_attempts': 10, 'abort_on_prompts': True } self.fs_base_url = '{0}:{1}'.format(self.fab_env_conf['host_string'], FILE_SERVER_PORT) wait_for_vm_to_become_ssh_available(self.fab_env_conf, self._execute_command, self.logger)
def _test_cli_package(self): """ Tests cli package in offline mode (Only Linux compatible) :return: """ self.keystone_url = self.bootstrap_inputs['keystone_url'] iaas_resolver = '{0} {1}' \ .format(*self._resolve_url_to_ip_and_netloc(self.keystone_url)) iaas_resolver_cmd = 'echo {0} >> /etc/hosts'.format(iaas_resolver) # Make sure cli machine is up with a registered ssh key wait_for_vm_to_become_ssh_available(env, self._execute_command, self.logger) with self.dns(): self.logger.info('Preparing CLI and downloading example') package_name = self._prepare_cli() blueprint_path = self.get_hello_world_blueprint() self._install_cli(package_name) self.logger.info('Preparing manager blueprint') self.prepare_manager_blueprint() self._update_hosts_file(iaas_resolver) # Getting the remote manager blueprint and preparing resources self.logger.info('Retrieving remote manager blueprint file...') manager_blueprint = StringIO() fab.get(self.test_manager_blueprint_path, manager_blueprint) manager_blueprint_yaml = yaml.load(manager_blueprint.getvalue()) resources_to_download = self._get_resource_list(manager_blueprint_yaml) # each os should implement any vm-related function before this comment with FileServer(self._get_file_server_inputs(), resources_to_download, FILE_SERVER_PORT, self.logger) as fs: additional_inputs = fs.get_processed_inputs() self._update_inputs_file(additional_inputs) self.logger.info('Bootstrapping...') self.bootstrap_manager() # Adding iaas resolver for the manager machine. self.logger.info('adding {0} to /etc/hosts of the manager vm' .format(iaas_resolver)) manager_fab_conf = { 'user': self.client_user, 'key_filename': self._get_manager_kp(), 'host_string': self.manager_ip, 'timeout': 30, 'connection_attempts': 10 } wait_for_vm_to_become_ssh_available(manager_fab_conf, self._execute_command, self.logger) self._run_cmd_on_custom_machine(iaas_resolver_cmd, manager_fab_conf, sudo=True) # Uploading, deploying and testing hello_world blueprint # Any sleep is to allow the execution to complete # TODO: remove this line when the openstack sg description fix is applied # NOQA self._update_example_sg() self.logger.info('Testing the example deployment cycle...') blueprint_id = 'blueprint-{0}'.format(uuid.uuid4()) self._upload_blueprint(blueprint_path, blueprint_id, self.app_blueprint_file) self.deployment_id = self.create_deployment(blueprint_id) self.addCleanup(self.uninstall_deployment) self.install_deployment(self.deployment_id) self.assert_deployment_working( self._get_app_property('http_endpoint'))
def _test_cli_package(self): """ Tests cli package in offline mode (Only Linux compatible) :return: """ self.keystone_url = self.bootstrap_inputs['keystone_url'] iaas_resolver = '{0} {1}' \ .format(*self._resolve_url_to_ip_and_netloc(self.keystone_url)) iaas_resolver_cmd = 'echo {0} >> /etc/hosts'.format(iaas_resolver) # Make sure cli machine is up with a registered ssh key wait_for_vm_to_become_ssh_available(env, self._execute_command, self.logger) with self.dns(): self.logger.info('Preparing CLI and downloading example') package_name = self._prepare_cli() blueprint_path = self.get_hello_world_blueprint() self._install_cli(package_name) self.logger.info('Preparing manager blueprint') self.prepare_manager_blueprint() self._update_hosts_file(iaas_resolver) # Getting the remote manager blueprint and preparing resources self.logger.info('Retrieving remote manager blueprint file...') manager_blueprint = StringIO() fab.get(self.test_manager_blueprint_path, manager_blueprint) manager_blueprint_yaml = yaml.load(manager_blueprint.getvalue()) resources_to_download = self._get_resource_list(manager_blueprint_yaml) # each os should implement any vm-related function before this comment with FileServer(self._get_file_server_inputs(), resources_to_download, FILE_SERVER_PORT, self.logger) as fs: additional_inputs = fs.get_processed_inputs() self._update_inputs_file(additional_inputs) self.logger.info('Bootstrapping...') self.bootstrap_manager() # Adding iaas resolver for the manager machine. self.logger.info( 'adding {0} to /etc/hosts of the manager vm'.format( iaas_resolver)) manager_fab_conf = { 'user': self.client_user, 'key_filename': self._get_manager_kp(), 'host_string': self.manager_ip, 'timeout': 30, 'connection_attempts': 10 } wait_for_vm_to_become_ssh_available(manager_fab_conf, self._execute_command, self.logger) self._run_cmd_on_custom_machine(iaas_resolver_cmd, manager_fab_conf, sudo=True) # Uploading, deploying and testing hello_world blueprint # Any sleep is to allow the execution to complete # TODO: remove this line when the openstack sg description fix is applied # NOQA self._update_example_sg() self.logger.info('Testing the example deployment cycle...') blueprint_id = 'blueprint-{0}'.format(uuid.uuid4()) self._upload_blueprint(blueprint_path, blueprint_id, self.app_blueprint_file) self.deployment_id = self.create_deployment(blueprint_id) self.addCleanup(self.uninstall_deployment) self.install_deployment(self.deployment_id) self.assert_deployment_working( self._get_app_property('http_endpoint'))