diff --git a/tests/ci/rally-gate.sh b/tests/ci/rally-gate.sh index f75c3157..271578b3 100755 --- a/tests/ci/rally-gate.sh +++ b/tests/ci/rally-gate.sh @@ -63,8 +63,7 @@ rally show keypairs rally -v --rally-debug task start --task $TASK $TASK_ARGS mkdir -p rally-plot/extra -python $BASE/new/rally/rally/ui/utils.py render\ - tests/ci/rally-gate/index.mako > rally-plot/extra/index.html +python $BASE/new/rally/tests/ci/render.py ci/index.mako > rally-plot/extra/index.html cp $TASK rally-plot/task.txt tar -czf rally-plot/plugins.tar.gz -C $RALLY_PLUGINS_DIR . rally task results | python -m json.tool > rally-plot/results.json diff --git a/tests/ci/render.py b/tests/ci/render.py new file mode 100644 index 00000000..a08723f8 --- /dev/null +++ b/tests/ci/render.py @@ -0,0 +1,37 @@ +# Copyright 2015: Mirantis Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from __future__ import print_function +import re +import sys + +from rally.ui import utils + + +HELP_MESSAGE = ( + "Usage:\n\t" + "render.py ci/template.mako" + "[= = ...]\n\n\t" + "Where key-1,value-1 and key-2,value-2 are key pairs of template.") + + +if __name__ == "__main__": + args = sys.argv + if (len(args) < 1 or not all(re.match("^[^=]+=[^=]+$", + arg) for arg in args[2:])): + print(HELP_MESSAGE, file=sys.stderr) + sys.exit(1) + render_kwargs = dict([arg.split("=") for arg in args[2:]]) + print(utils.get_template(args[1]).render(**render_kwargs))