Commit 6e15fa38 authored by Boxiang Sun's avatar Boxiang Sun

Let parsed_parameters can get '_' correctly from instance-parameter:configuration

When there has no '_', SlapOS will report 'configuration._', was not defined.
And there has '!py!' prefix in the instance-parameter. And we also need to take care the key of
'_' use double quotes instead single quotes. So use ast.literal_eval instead the json.dump
parent efcd31e7
......@@ -50,8 +50,11 @@ def main():
args = parser.parse_args()
import json
parsed_parameters = json.loads('$${instance-parameter:configuration._}')
no_py_prefix = '''$${instance-parameter:configuration}'''[4:] # The input_str has "!py!" prefix.
json_style_para = no_py_prefix.replace('\'', '\"')
parameters = json.loads(json_style_para)
parsed_parameters = json.loads(parameters.get('_', '{}'))
print(parsed_parameters)
if not getattr(args, 'target', None):
args.target = parsed_parameters.get('target', 'firefox')
......@@ -87,7 +90,8 @@ def main():
##########################
is_appium = False
if args.target == 'firefox':
firefox_capabilities = webdriver.common.desired_capabilities.DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
......
......@@ -107,7 +107,7 @@ mode = 0644
[template-runTestSuite]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/runTestSuite.in
md5sum = fcf15b2a90340e0afe8f8b9921a4ffae
md5sum = ac50975607770280fd988e307ef93cfe
output = ${buildout:directory}/runTestSuite.in
mode = 0644
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment