-
Notifications
You must be signed in to change notification settings - Fork 157
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
Solved bug when trying to find node info in namespaces #206
Conversation
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
b79325e
to
e1215c7
Compare
Maybe, I should also correct #181 here |
ros2node/ros2node/api/__init__.py
Outdated
namespace = '/'.join(tokens[:-1]) | ||
return NodeName(node_name, namespace, full_node_name) | ||
namespace = '/' + '/'.join(tokens[:-1]) | ||
return NodeName(node_name, namespace, '/' + full_node_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The terminology seems to be all mixed in this function. The parameter full_node_name
must explicitly not have a leading slash. But the returned value of NodeName.full_name
explicitly does.
While not part of this patch the condition 1 > len(tokens)
can never be true. Also some callers explicitly remove the leading slash before calling the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right. Maybe I should do the following:
- Change callers to not remove the leading slash.
- Also fix [ros2node] info requires fully qualified node name #181 here, adding a leading slash to non fully qualified names (inside parse_node_name).
- Change "parse_node_name(full_node_name)" to "parse_node_name(node_name)" and node_name to "bare_node_name" or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Change callers to not remove the leading slash.
- Also fix [ros2node] info requires fully qualified node name #181 here, adding a leading slash to non fully qualified names (inside parse_node_name).
- Change "parse_node_name(full_node_name)" to "parse_node_name(node_name)" ...
👍
... and node_name to "bare_node_name" or something similar.
Maybe node_basename
to match terminology for paths?
…bles. Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
@dirk-thomas The failing test is unrelated, so I will merge if you think it is ok. |
ros2node/ros2node/api/__init__.py
Outdated
node_name = full_node_name | ||
namespace = '/' | ||
def parse_node_name(node_name): | ||
if (node_name[0] == '/'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: no need for parenthesis around conditions.
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
I simplified the logic a bit in c5c72d4. That unfortunately broke the DCO check. Feel free to override it (or squash before merging to make it pass again). |
Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
c5c72d4
to
4efa4ed
Compare
Merging, as CI failures are unrelated |
Could it be that this issue still persists?
when invoked without
|
Fixes #201
Fixes #181
Initial '/' was missing when the node was inside a namespace.
Now, non fully qualified names are also accepted.
Added unit test.