diff --git a/doc/source/tools/performa-report.txt b/doc/source/tools/performa-report.txt index 0b7763e..1fb2d95 100644 --- a/doc/source/tools/performa-report.txt +++ b/doc/source/tools/performa-report.txt @@ -1,5 +1,5 @@ usage: performa-report [-h] [--book BOOK] [--config-dir DIR] - [--config-file PATH] [--debug] [--hosts HOSTS] + [--config-file PATH] [--debug] [--log-config-append PATH] [--log-date-format DATE_FORMAT] [--log-dir LOG_DIR] [--log-file PATH] [--mongo-db MONGO_DB] @@ -7,7 +7,7 @@ usage: performa-report [-h] [--book BOOK] [--config-dir DIR] [--noverbose] [--nowatch-log-file] [--remote-user REMOTE_USER] [--scenario SCENARIO] [--syslog-log-facility SYSLOG_LOG_FACILITY] [--tag TAG] - [--use-syslog] [--verbose] [--version] + [--use-syslog] [--vars VARS] [--verbose] [--version] [--watch-log-file] optional arguments: @@ -25,8 +25,6 @@ optional arguments: precedence. Defaults to None. --debug, -d If set to true, the logging level will be set to DEBUG instead of the default INFO level. - --hosts HOSTS Hosts inventory definition in YAML format, Can be - specified via env[PERFORMA_HOSTS]. --log-config-append PATH, --log_config PATH The name of a logging configuration file. This file is appended to any existing logging configuration files. @@ -69,6 +67,8 @@ optional arguments: --use-syslog Use syslog for logging. Existing syslog format is DEPRECATED and will be changed later to honor RFC5424. This option is ignored if log_config_append is set. + --vars VARS Variables that are injected into scenario template. + Can be specified via env[PERFORMA_VARS]. --verbose, -v If set to false, the logging level will be set to WARNING instead of the default INFO level. --version show program's version number and exit diff --git a/doc/source/tools/performa.txt b/doc/source/tools/performa.txt index 7a68172..912df69 100644 --- a/doc/source/tools/performa.txt +++ b/doc/source/tools/performa.txt @@ -1,12 +1,13 @@ usage: performa [-h] [--book BOOK] [--config-dir DIR] [--config-file PATH] - [--debug] [--hosts HOSTS] [--log-config-append PATH] + [--debug] [--log-config-append PATH] [--log-date-format DATE_FORMAT] [--log-dir LOG_DIR] [--log-file PATH] [--mongo-db MONGO_DB] [--mongo-url MONGO_URL] [--nodebug] [--nouse-syslog] [--noverbose] [--nowatch-log-file] [--remote-user REMOTE_USER] [--scenario SCENARIO] [--syslog-log-facility SYSLOG_LOG_FACILITY] [--tag TAG] - [--use-syslog] [--verbose] [--version] [--watch-log-file] + [--use-syslog] [--vars VARS] [--verbose] [--version] + [--watch-log-file] optional arguments: -h, --help show this help message and exit @@ -23,8 +24,6 @@ optional arguments: precedence. Defaults to None. --debug, -d If set to true, the logging level will be set to DEBUG instead of the default INFO level. - --hosts HOSTS Hosts inventory definition in YAML format, Can be - specified via env[PERFORMA_HOSTS]. --log-config-append PATH, --log_config PATH The name of a logging configuration file. This file is appended to any existing logging configuration files. @@ -67,6 +66,8 @@ optional arguments: --use-syslog Use syslog for logging. Existing syslog format is DEPRECATED and will be changed later to honor RFC5424. This option is ignored if log_config_append is set. + --vars VARS Variables that are injected into scenario template. + Can be specified via env[PERFORMA_VARS]. --verbose, -v If set to false, the logging level will be set to WARNING instead of the default INFO level. --version show program's version number and exit diff --git a/etc/performa.conf b/etc/performa.conf index a3bf9f6..b0b6b37 100644 --- a/etc/performa.conf +++ b/etc/performa.conf @@ -113,9 +113,9 @@ # (string value) #remote_user = -# Hosts inventory definition in YAML format, Can be specified via -# env[PERFORMA_HOSTS]. (string value) -#hosts = +# Variables that are injected into scenario template. Can be specified via +# env[PERFORMA_VARS]. (string value) +#vars = # Generate report in ReST format and store it into the specified folder, # defaults to env[PERFORMA_BOOK]. (string value) diff --git a/performa/engine/config.py b/performa/engine/config.py index ac5b04a..5f0f69b 100644 --- a/performa/engine/config.py +++ b/performa/engine/config.py @@ -72,12 +72,12 @@ MAIN_OPTS = [ required=True, help='User for connecting to remote systems, ' 'defaults to env[PERFORMA_REMOTE_USER].'), - cfg.Opt('hosts', + cfg.Opt('vars', type=Yaml(), - default=utils.env('PERFORMA_HOSTS'), + default=utils.env('PERFORMA_VARS'), required=True, - help='Hosts inventory definition in YAML format, ' - 'Can be specified via env[PERFORMA_HOSTS].'), + help='Variables that are injected into scenario template. ' + 'Can be specified via env[PERFORMA_VARS].'), cfg.StrOpt('book', default=utils.env('PERFORMA_BOOK'), help='Generate report in ReST format and store it into the ' diff --git a/performa/engine/main.py b/performa/engine/main.py index 77dcc10..201d5ce 100644 --- a/performa/engine/main.py +++ b/performa/engine/main.py @@ -31,11 +31,11 @@ from performa.engine import utils LOG = logging.getLogger(__name__) -def resolve_hosts(scenario_template, hosts): +def resolve_vars(scenario_template, vars): jinja_env = jinja2.Environment() compiled_template = jinja_env.from_string(scenario_template) - rendered_template = compiled_template.render(hosts) + rendered_template = compiled_template.render(vars) return rendered_template @@ -48,7 +48,7 @@ def main(): alias_mapper=lambda f: config.SCENARIOS + '%s.yaml' % f) scenario_raw = utils.read_file(scenario_file_path) - scenario_raw = resolve_hosts(scenario_raw, cfg.CONF.hosts) + scenario_raw = resolve_vars(scenario_raw, cfg.CONF.vars) scenario = yaml.safe_load(scenario_raw) base_dir = os.path.dirname(scenario_file_path) diff --git a/performa/scenarios/mq/omsimulator.yaml b/performa/scenarios/mq/omsimulator.yaml index 9be0eda..f9fd79a 100644 --- a/performa/scenarios/mq/omsimulator.yaml +++ b/performa/scenarios/mq/omsimulator.yaml @@ -43,13 +43,13 @@ execution: - hosts: {{ target }} matrix: - host_count: [ 1, 2, 3 ] + host_count: [ 1, 2 ] tasks: - omsimulator: mode: call duration: 10 threads: 1 - url: "rabbit://stackrabbit:swordfish@localhost:5672/" + url: {{ rabbit_url }} - hosts: {{ target }} tasks: