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

Netbox sites with comma in name not parsed correctly in site relation mappings #42

Closed
justinhippen opened this issue Feb 12, 2021 · 4 comments
Labels
awaiting reply Awaiting reply from issue owner bug Something isn't working
Milestone

Comments

@justinhippen
Copy link

Our Netbox sites are in a "City, State" or "City, Country" format (ex. Chicago, IL or London, UK) and the cluster site relation function would split at the comma causing errors.

I don't know if it is the cleanest, but I fixed this locally with this regex and a slight modification to the strip functions in the vmware/connection.py @ line 190:

for relation in re.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)",config_settings.get(relation_option)):

            object_name = relation.split("=")[0].strip(' "')
            relation_name = relation.split("=")[1].strip(' "')`
@bb-Ricardo
Copy link
Owner

Hi,

that is totally true, site names which contain a comma won't work with this setup.

Your approach sounds great. I will check it out next week.

@bb-Ricardo bb-Ricardo added this to the 1.1.0 milestone Feb 26, 2021
bb-Ricardo added a commit that referenced this issue Feb 26, 2021
@bb-Ricardo
Copy link
Owner

Hey,

I found a different regex which works with quoted and unquoted names.
Can you try the "development" branch and see if it works for you?

Thank you

@bb-Ricardo bb-Ricardo added awaiting reply Awaiting reply from issue owner bug Something isn't working labels Feb 27, 2021
@justinhippen
Copy link
Author

I was finally able to test the dev branch & everything worked correctly for quoted names.

@bb-Ricardo
Copy link
Owner

Great. Thank you for testing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reply Awaiting reply from issue owner bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants