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

healthcheck: Loopback IP Parsing #1199

Open
clwluvw opened this issue Mar 12, 2024 · 6 comments
Open

healthcheck: Loopback IP Parsing #1199

clwluvw opened this issue Mar 12, 2024 · 6 comments
Assignees
Labels

Comments

@clwluvw
Copy link
Contributor

clwluvw commented Mar 12, 2024

** Bug Report **

Describe the bug

When having two ips with labels like labelname and labelname-something, specifying --label labelname would pick both labelname and labelname-something.

Expected behavior

Only the desired label be chosen.

Additional context

It must be probably because of the startswith func here (https://github.com/Exa-Networks/exabgp/blob/main/src/exabgp/application/healthcheck.py#L221)

@vincentbernat
Copy link
Member

I think this would work if label was replaced by "{0}:".format(label).

@clwluvw
Copy link
Contributor Author

clwluvw commented Mar 12, 2024

I see a backslash at the end of the label from /sbin/ip -o address show dev lo output.

@vincentbernat
Copy link
Member

I don't remember if it was the reason I have used startswith. Maybe the right fix would be:

if lmo.groupdict().get("label", "").rstrip("\\") == label:

@vincentbernat
Copy link
Member

Sorry, looking at the documentation string, this is something expected. Labels need to be unique, so that's why there is a startswith(). If you want to use several loopbacks, you label them haproxy1, haproxy2, haproxy3 and you use --label haproxy.

@clwluvw
Copy link
Contributor Author

clwluvw commented Mar 12, 2024

hmm - maybe a better approach was to support regex as an arg so this wouldn't be confusing. I mean now you can't use it unless you change the names completely.

@vincentbernat
Copy link
Member

It would break existing setups and just adding a new option means more code to support, more bugs and more people confused. In years, this is the first time this issue is reported. If we were to start over, we would use "label + number" like the example, but now, who knows how people did use this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants