def main(): utils.init_config_and_logging( config.COMMON_OPTS + config.OPENSTACK_OPTS + config.SERVER_OPTS + config.REPORT_OPTS ) act()
def main(): utils.init_config_and_logging( config.COMMON_OPTS + config.OPENSTACK_OPTS + config.SERVER_OPTS + config.REPORT_OPTS ) output = dict(records=[], agents={}, scenarios={}, tests={}) for scenario_file_name in [cfg.CONF.scenario]: scenario = utils.read_yaml_file(scenario_file_name) scenario['title'] = scenario.get('title') or scenario_file_name scenario['file_name'] = cfg.CONF.scenario play_output = play_scenario(scenario) output['scenarios'][scenario['title']] = play_output['scenario'] output['records'] += play_output['records'] output['agents'].update(play_output['agents']) output['tests'].update(play_output['tests']) if cfg.CONF.output: utils.write_file(json.dumps(output, indent=2), cfg.CONF.output) if cfg.CONF.no_report_on_error and 'error' in output: LOG.info('Skipped report generation due to errors and ' 'no_report_on_error=True') else: report.generate_report(output, cfg.CONF.report_template, cfg.CONF.report, cfg.CONF.subunit)
def main(): utils.init_config_and_logging(config.REPORT_OPTS + config.INPUT_OPTS) LOG.debug('Reading JSON data from: %s', cfg.CONF.input) report_data = json.loads(utils.read_file(cfg.CONF.input)) generate_report(report_data, cfg.CONF.report_template, cfg.CONF.report, cfg.CONF.subunit, cfg.CONF.book)
def main(): utils.init_config_and_logging(config.COMMON_OPTS + config.AGENT_OPTS) endpoint = cfg.CONF.server_endpoint polling_interval = cfg.CONF.polling_interval agent_id = cfg.CONF.agent_id if check_if_already_running(endpoint): LOG.warning('Shaker-agent already running with the same endpoint') exit(1) if not agent_id: agent_id = get_mac() LOG.info('Using MAC address as agent_id: %s', agent_id) work(agent_id, endpoint, polling_interval)
def init(): utils.init_config_and_logging( config.OPENSTACK_OPTS + config.IMAGE_BUILDER_OPTS) openstack_client = None try: openstack_client = openstack.OpenStackClient( username=cfg.CONF.os_username, password=cfg.CONF.os_password, tenant_name=cfg.CONF.os_tenant_name, auth_url=cfg.CONF.os_auth_url, region_name=cfg.CONF.os_region_name) except Exception as e: LOG.error('Error establishing connection to OpenStack: %s. ' 'Please verify OpenStack credentials (--os-username, ' '--os-password, --os-tenant-name, --os-auth-url)', e) exit(1) return openstack_client
def main(): utils.init_config_and_logging(config.COMMON_OPTS + config.OPENSTACK_OPTS + config.SERVER_OPTS + config.REPORT_OPTS + config.IMAGE_BUILDER_OPTS + config.CLEANUP_OPTS) artifacts_dir = cfg.CONF.artifacts_dir if not artifacts_dir: artifacts_dir = tempfile.mkdtemp(prefix='shaker') cfg.CONF.set_override('artifacts_dir', artifacts_dir) # image-builder _configure_log_file( utils.join_folder_prefix_ext(artifacts_dir, 'image_builder', 'log')) LOG.info('Building the image') image_builder.build_image() # core _configure_log_file( utils.join_folder_prefix_ext(artifacts_dir, 'execution', 'log')) if len(cfg.CONF.scenario) > 1: cfg.CONF.set_override( 'output', utils.join_folder_prefix_ext(artifacts_dir, 'aggregated', 'json')) cfg.CONF.set_override( 'report', utils.join_folder_prefix_ext(artifacts_dir, 'aggregated', 'html')) cfg.CONF.set_override( 'subunit', utils.join_folder_prefix_ext(artifacts_dir, 'aggregated', 'subunit')) cfg.CONF.set_override( 'book', utils.join_folder_prefix_ext(artifacts_dir, 'aggregated')) LOG.info('Executing scenario(s)') server.act() # cleanup _configure_log_file( utils.join_folder_prefix_ext(artifacts_dir, 'cleanup', 'log')) LOG.info('Cleaning up') image_builder.cleanup()
def init(): utils.init_config_and_logging(config.OPENSTACK_OPTS + config.IMAGE_BUILDER_OPTS) openstack_client = None try: openstack_client = openstack.OpenStackClient( username=cfg.CONF.os_username, password=cfg.CONF.os_password, tenant_name=cfg.CONF.os_tenant_name, auth_url=cfg.CONF.os_auth_url, region_name=cfg.CONF.os_region_name) except Exception as e: LOG.error( 'Error establishing connection to OpenStack: %s. ' 'Please verify OpenStack credentials (--os-username, ' '--os-password, --os-tenant-name, --os-auth-url)', e) exit(1) return openstack_client
def main(): utils.init_config_and_logging(config.COMMON_OPTS + config.AGENT_OPTS) endpoint = cfg.CONF.server_endpoint polling_interval = cfg.CONF.polling_interval agent_id = cfg.CONF.agent_id if not re.match('\S+:\d+', endpoint): LOG.error('Wrong value of server_endpoint, expected <host>:<port>, ' 'but got: %s', endpoint) exit(1) if check_if_already_running(endpoint): LOG.warning('Shaker-agent already running with the same endpoint') exit(1) if not agent_id: agent_id = get_mac() LOG.info('Using MAC address as agent_id: %s', agent_id) work(agent_id, endpoint, polling_interval)
def main(): utils.init_config_and_logging(config.COMMON_OPTS + config.AGENT_OPTS) endpoint = cfg.CONF.server_endpoint polling_interval = cfg.CONF.polling_interval agent_id = cfg.CONF.agent_id if not re.match('\S+:\d+', endpoint): LOG.error( 'Wrong value of server_endpoint, expected <host>:<port>, ' 'but got: %s', endpoint) exit(1) if check_if_already_running(endpoint): LOG.warning('Shaker-agent already running with the same endpoint') exit(1) if not agent_id: agent_id = get_mac() LOG.info('Using MAC address as agent_id: %s', agent_id) work(agent_id, endpoint, polling_interval)
def main(): utils.init_config_and_logging( config.COMMON_OPTS + config.OPENSTACK_OPTS + config.SERVER_OPTS + config.REPORT_OPTS + config.IMAGE_BUILDER_OPTS + config.CLEANUP_OPTS + config.ALL_IN_ONE_OPTS ) artifacts_dir = cfg.CONF.artifacts_dir if artifacts_dir: _mkdir_p(artifacts_dir) else: artifacts_dir = tempfile.mkdtemp(prefix='shaker') # image-builder _configure_log_file(_make_filename(artifacts_dir, 'image_builder', 'log')) LOG.info('Building the image') image_builder.build_image() # core scenario = cfg.CONF.scenario prefix = utils.strict(scenario) _configure_log_file(_make_filename(artifacts_dir, prefix, 'log')) LOG.info('Executing scenario: %s', scenario) cfg.CONF.set_override('output', _make_filename(artifacts_dir, prefix, 'json')) cfg.CONF.set_override('report', _make_filename(artifacts_dir, prefix, 'html')) cfg.CONF.set_override('subunit', _make_filename(artifacts_dir, prefix, 'subunit')) cfg.CONF.set_override('book', _make_filename(artifacts_dir, prefix)) server.act() # cleanup _configure_log_file(_make_filename(artifacts_dir, 'cleanup', 'log')) LOG.info('Cleaning up') image_builder.cleanup()
def main(): utils.init_config_and_logging( config.COMMON_OPTS + config.OPENSTACK_OPTS + config.SERVER_OPTS + config.REPORT_OPTS ) output = dict(records={}, agents={}, scenarios={}, tests={}) for scenario_param in [cfg.CONF.scenario]: LOG.debug('Processing scenario: %s', scenario_param) alias = '%s%s.yaml' % (config.SCENARIOS, scenario_param) packaged = utils.resolve_relative_path(alias) # use packaged scenario or fallback to full path scenario_file_name = packaged or scenario_param LOG.info('Play scenario: %s', scenario_file_name) scenario = utils.read_yaml_file(scenario_file_name) scenario['title'] = scenario.get('title') or scenario_file_name scenario['file_name'] = scenario_file_name play_output = play_scenario(scenario) output['scenarios'][scenario['title']] = play_output['scenario'] output['records'].update(play_output['records']) output['agents'].update(play_output['agents']) output['tests'].update(play_output['tests']) if cfg.CONF.output: utils.write_file(json.dumps(output, indent=2), cfg.CONF.output) if cfg.CONF.no_report_on_error and 'error' in output: LOG.info('Skipped report generation due to errors and ' 'no_report_on_error=True') else: report.generate_report(output, cfg.CONF.report_template, cfg.CONF.report, cfg.CONF.subunit)
def main(): utils.init_config_and_logging(config.SCENARIO_OPTS + config.REPORT_OPTS) server.act()
def cleanup_entry_point(): utils.init_config_and_logging(config.OPENSTACK_OPTS + config.CLEANUP_OPTS) cleanup()
def build_image_entry_point(): utils.init_config_and_logging( config.OPENSTACK_OPTS + config.IMAGE_BUILDER_OPTS ) build_image()
def main(): utils.init_config_and_logging( config.SCENARIO_OPTS + config.REPORT_OPTS ) server.act()
def main(): utils.init_config_and_logging(config.COMMON_OPTS + config.OPENSTACK_OPTS + config.SERVER_OPTS + config.REPORT_OPTS) act()