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

View File

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

View File

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

View File

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