Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Fixed search strategy for python_logging config#1292

Merged
dirk-thomas merged 2 commits intoros:lunar-develfrom
magazino:fix-search-for-logging-config
Feb 1, 2018
Merged

Fixed search strategy for python_logging config#1292
dirk-thomas merged 2 commits intoros:lunar-develfrom
magazino:fix-search-for-logging-config

Conversation

@mgrrx
Copy link
Copy Markdown
Contributor

@mgrrx mgrrx commented Jan 1, 2018

The current strategy tries to first find a file named python_logging.conf and, in case none was found, continues searching the yaml version.
A custom configuration in /etc/ros/python_logging.yaml would be ignored as the file python_logging.conf is always present in the share/conf folder of rosgraph.

@mgrrx mgrrx force-pushed the fix-search-for-logging-config branch from 94fd2ab to 14fb677 Compare January 1, 2018 20:32
Copy link
Copy Markdown
Member

@mikepurvis mikepurvis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, but can you describe more about how you verified the new and existing behaviour?

'/etc/ros/%s'%(fname),
os.path.join(rosgraph_d, 'conf', fname)]:
for config_dir in [os.path.join(rospkg.get_ros_home(), 'config'),
'/etc/ros/',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use get_etc_ros_dir, since that accounts for the ROS_ETC_DIR envvar:

http://docs.ros.org/independent/api/rospkg/html/rospkg_environment.html#get_etc_ros_dir

for config_dir in [os.path.join(rospkg.get_ros_home(), 'config'),
'/etc/ros/',
os.path.join(rosgraph_d, 'conf')]:
for extension in ['.conf', '.yaml', '.yml']:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider os.extsep, but it isn't used a lot elsewhere in ROS tooling, and . works on all of the supported ROS platforms.

@mgrrx mgrrx force-pushed the fix-search-for-logging-config branch from 14fb677 to bb77dc9 Compare January 2, 2018 17:50
@mgrrx
Copy link
Copy Markdown
Contributor Author

mgrrx commented Jan 2, 2018

Updated as suggested. I played a bit and placed files here and there. And from the code it was somehow obvious that when a file is found, the search ends.

@mikepurvis
Copy link
Copy Markdown
Member

👍

@dirk-thomas
Copy link
Copy Markdown
Member

I don't think we need to introduce the option for yml. Support yaml should be sufficient. Therefore I removed it in 9801667.

Thank you for the patch. This order makes much more sense.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants