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

Topology Maps - Regexp with comma failed #632

Closed
kryskool opened this issue Oct 22, 2016 · 0 comments
Closed

Topology Maps - Regexp with comma failed #632

kryskool opened this issue Oct 22, 2016 · 0 comments
Labels
type: bug A confirmed report of unexpected behavior in the application

Comments

@kryskool
Copy link
Contributor

kryskool commented Oct 22, 2016

Hi

Thanks for this great app.

I found an issue with this Regexp when i would like to find Switch1 to Switch999

Switch[0-9]{1,3}

When the ligne is split with comma to compose the topology map, it failed with this message

Exception Type: DataError
Exception Value: ERREUR:  expression rationnelle invalide : braces {} not balanced

params (u'(Switch){1',)
self    <django.db.backends.utils.CursorDebugWrapper object at 0xb4906a6c>

sql u'SELECT (CAST(SUBSTRING(dcim_device.name FROM \'(\\d+)$\') AS integer)) AS "_dcim_device_name3", (SUBSTRING(dcim_device.name FROM \'^\\d*(.*?)\\d*$\')) AS "_dcim_device_name2", (CAST(SUBSTRING(dcim_device.name FROM \'^(\\d+)\') AS integer)) AS "_dcim_device_name1", "dcim_device"."id", "dcim_device"."created", "dcim_device"."last_updated", "dcim_device"."device_type_id", "dcim_device"."device_role_id", "dcim_device"."tenant_id", "dcim_device"."platform_id", "dcim_device"."name", "dcim_device"."serial", "dcim_device"."asset_tag", "dcim_device"."rack_id", "dcim_device"."position", "dcim_device"."face", "dcim_device"."status", "dcim_device"."primary_ip4_id", "dcim_device"."primary_ip6_id", "dcim_device"."comments" FROM "dcim_device" WHERE "dcim_device"."name"::text ~ %s ORDER BY "_dcim_device_name1" ASC, "_dcim_device_name2" ASC, "_dcim_device_name3" ASC'

I think the comma must be replace by semicolon ; as the line separator (because semicolon is a reserve character in SQL and not use as part of the regexp)

A migration script can migrate all existings regexp with no problem

Regards,

@jeremystretch jeremystretch added the type: bug A confirmed report of unexpected behavior in the application label Nov 1, 2016
lampwins pushed a commit to lampwins/netbox that referenced this issue Oct 13, 2017
jeremystretch added a commit that referenced this issue Feb 21, 2018
…632) to fix database error on extras/0009_topologymap_type
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants