cisco-gnmi-python icon indicating copy to clipboard operation
cisco-gnmi-python copied to clipboard

xr.py check_config() doing a wrong type check

Open oranima opened this issue 2 years ago • 0 comments

check_config() function in set_json() under xr.py contains some bugs. see below what should be changed

    def check_configs(name, configs):

[-] if isinstance(name, string_types): [+] if isinstance(configs, string_types): ... [-] elif isinstance(name, dict): [+] elif isinstance(configs, dict):

name is indeed always a string as the function is called with lines 188,189 updates = create_updates("update_json_configs", update_json_configs) replaces = create_updates("replace_json_configs", replace_json_configs) line 155
configs = check_configs(name, configs)

The test should be checked against configs which it the variable containing the actual config and which should be either a string, a dict or an iterable

oranima avatar Jul 05 '23 07:07 oranima