From 14e13f68a5a466e9e74501f49b4bcd770bc36c39 Mon Sep 17 00:00:00 2001 From: Kei Nohguchi Date: Mon, 9 May 2016 00:58:49 -0700 Subject: [PATCH] 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. --- network/openswitch/ops_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/network/openswitch/ops_template.py b/network/openswitch/ops_template.py index da25395139e..974048a65ff 100644 --- a/network/openswitch/ops_template.py +++ b/network/openswitch/ops_template.py @@ -195,7 +195,7 @@ def main(): updates = dict() for path, key, new_value, old_value in changeset: path = '%s.%s' % ('.'.join(path), key) - updates[path] = new_value + updates[path] = str(new_value) result['updates'] = updates if changeset: