Merge "Expand script path by os.path.expanduser"

This commit is contained in:
Jenkins 2015-08-16 09:35:35 +00:00 committed by Gerrit Code Review
commit dcc3e6d37a
4 changed files with 11 additions and 11 deletions

View File

@ -656,7 +656,7 @@
size: 2
use_floatingip: true
command:
script_file: "/home/jenkins/.rally/extra/instance_dd_test.sh"
script_file: "~/.rally/extra/instance_dd_test.sh"
interpreter: "/bin/sh"
username: "cirros"
runner:
@ -679,7 +679,7 @@
name: {{image_name}}
use_floatingip: false
command:
script_file: "/home/jenkins/.rally/extra/instance_dd_test.sh"
script_file: "~/.rally/extra/instance_dd_test.sh"
interpreter: "/bin/sh"
username: "cirros"
runner:

View File

@ -296,7 +296,7 @@
floating_network: "net04_ext"
use_floatingip: true
command:
script_file: "/home/rally/.rally/extra/instance_dd_test.sh"
script_file: "~/.rally/extra/instance_dd_test.sh"
interpreter: "/bin/sh"
username: "cirros"
runner:

View File

@ -463,7 +463,7 @@
image:
name: {{image_name}}
command:
script_file: "/home/jenkins/.rally/extra/instance_dd_test.sh"
script_file: "~/.rally/extra/instance_dd_test.sh"
interpreter: "/bin/sh"
username: "cirros"
runner:

View File

@ -174,13 +174,13 @@ def check_command_dict(command):
# due to template-driven configuration generation that can leave keys
# defined but values empty.
if command.get("interpreter"):
# An interpreter is given, check if exactly one way to specify
# script body is used: file or inline
if not (bool(command.get("script_file")) ^
bool(command.get("script_inline"))):
script_file = command.get("script_file")
if script_file:
command["script_file"] = os.path.expanduser(script_file)
if "script_inline" in command:
raise ValueError(
"Exactly one of script_inline or script_file with interpreter"
" is expected: %r" % command)
"Exactly one of script_inline or script_file with "
"interpreter is expected: %r" % command)
# User tries to upload a shell? Make sure it is same as interpreter
interpreter = command.get("interpreter")
interpreter = (interpreter[-1]