ops_template.py: Change integer key into stirng

This fix passing the update variable to the str()
so that it avoids the exception when ops.dc.read()
returns a dictionary which contains non-string keys.

This is due to the fact that some of the key types in
OpenSwitch schema are actually defined as integer
and ops.dc declerative config module encode those
in integer inside the dictionary.  This could be
the right encoding from the schema point of view
but someone needs to convert it to the string
somewhere, as JSON key should be string.
This commit is contained in:
Kei Nohguchi 2016-05-09 00:58:49 -07:00 committed by Matt Clay
parent ff1c591c3e
commit d738ad0ee0

View file

@ -195,7 +195,7 @@ def main():
updates = dict() updates = dict()
for path, key, new_value, old_value in changeset: for path, key, new_value, old_value in changeset:
path = '%s.%s' % ('.'.join(path), key) path = '%s.%s' % ('.'.join(path), key)
updates[path] = new_value updates[path] = str(new_value)
result['updates'] = updates result['updates'] = updates
if changeset: if changeset: