Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device_templates.attach_to_device #99

Open
jeremypng opened this issue Dec 18, 2020 · 0 comments
Open

device_templates.attach_to_device #99

jeremypng opened this issue Dec 18, 2020 · 0 comments

Comments

@jeremypng
Copy link

I would like to modify this function so that it will accept variable or property names in the uuid['variables'] data structure. I'm already constructing this data format to verify whether a sync is needed. It seems redundant to convert it all to variables for the function to then convert it back to property names.

Here is the secion I'm talking about:

           for entry in template_variables['columns']:
                if entry['variable']:
                    if entry['variable'] in uuid[device_uuid]['variables']:
                        device_template_variables[entry['property']] = uuid[device_uuid]['variables'][entry['variable']]
                    elif entry['property'] in uuid[device_uuid]['variables']:
                        device_template_variables[entry['property']] = uuid[device_uuid]['variables'][entry['property']]
                    else:
                        raise Exception(f"{entry['variable']} is missing for template {uuid[device_uuid]['host_name']}")

I would be adding the elif:

 elif entry['property'] in uuid[device_uuid]['variables']:
                        device_template_variables[entry['property']] = uuid[device_uuid]['variables'][entry['property']]

What do you think about that?

jeremypng added a commit to jeremypng/python-viptela that referenced this issue Dec 21, 2020
…le names as acceptable identifiers for attach_to_device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant