Commit ec01c5bf authored by Senthil Kumaran S's avatar Senthil Kumaran S Committed by Neil Williams

Replace "!!python/unicode" in job definitions.

* Add a template filter to replace "!!python/unicode " with ""
  - required for old job definitions
* Use yaml.safe_dump to store job definitions whereever required.
  - acts on new job definitions that gets submitted.

Change-Id: I3ee3a711576e6edbe7aa3464e741d53c1b8f9bb1
parent c9ff6e9f
......@@ -1134,8 +1134,9 @@ def _create_pipeline_job(job_data, user, taglist, device=None,
if not orig:
orig = yaml.dump(job_data)
job = TestJob(definition=yaml.dump(job_data), original_definition=orig,
orig = yaml.safe_dump(job_data)
job = TestJob(definition=yaml.safe_dump(job_data),
......@@ -1193,7 +1194,7 @@ def _pipeline_protocols(job_data, user, yaml_data=None): # pylint: disable=too-
return device_list
if not yaml_data:
yaml_data = yaml.dump(job_data)
yaml_data = yaml.safe_dump(job_data)
role_dictionary = {} # map of the multinode group
if 'lava-multinode' in job_data['protocols']:
# create target_group uuid, just a label for the coordinator.
......@@ -113,7 +113,7 @@
<h4 class="modal-header">Definition</h4>
<div class="pull-right"><small><a href="javascript: void(0);" id="copy_link"
class="btn btn-xs btn-default"><span class="glyphicon glyphicon-copy"></span> Copy to clipboard</a></small></div><span
style="display: none" id="job_definition_text">{{ job.display_definition }}</span><br/>
style="display: none" id="job_definition_text">{{ job.display_definition|replace_python_unicode }}</span><br/>
{% with job.display_definition|split_definition as definition_data %}
{% for line in definition_data %}
<div class="row">
......@@ -121,7 +121,7 @@
<a href="#defline{{ forloop.counter }}">{{ forloop.counter }}</a>
<div class="col-md-8">
<span style="font-family: monospace; white-space: pre;">{{ line.rstrip }}</span>
<span style="font-family: monospace; white-space: pre;">{{ line.rstrip|replace_python_unicode }}</span>
{% endfor %}
......@@ -248,3 +248,8 @@ def level_replace(level):
def sort_items(items):
return sorted(items)
def replace_python_unicode(data):
return data.replace('!!python/unicode ', '')
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment