Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[configlet] Python3 compatible syntax for extracting a key from the d…
…ict (sonic-net#1721) Signed-off-by: Neetha John <[email protected]> Syntax error seen while trying to apply a configlet Traceback (most recent call last): File "/usr/local/bin/configlet", line 212, in main() File "/usr/local/bin/configlet", line 205, in main process_entry (do_update, i) File "/usr/local/bin/configlet", line 175, in process_entry do_operate(op_upd, t, (), data[t]) File "/usr/local/bin/configlet", line 162, in do_operate if type(lst[lst.keys()[0]]) == dict: TypeError: 'dict_keys' object is not subscriptable What I did Use next(iter()) to derive a key from the dict. This is both python2 and python3 compatible How to verify it Tried applying the json file below using the command 'configlet -j test.json -d'. Configlet was applied successfully. No errors were seen [ { "ACL_TABLE": { "EVERFLOW": {}, "EVERFLOWV6": {} } } ]
- Loading branch information