neutron-remove-duplicated-port-bindings does not write to stdout
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Confirmed
|
Medium
|
Miguel Lavalle |
Bug Description
The new neutron-
The logger gets initialized with log_level = WARNING, but the tool uses LOG.info() to display its messages, therefore the user never receives any results.
Furthermore, the logger does not take into account any parameters from the neutron config file during its initialization, and instead relies on its default settings, so log-related settings (log-level, log-path, etc.) cannot be changed.
On another note, dry-running is only possible when setting [cli_script] dry_run=True in the neutron config file, which is inconvenient to say the least.
A proper --debug CLI option would be way more helpful.
The script neutron- remove- duplicated- port-bindings gets a logger here https:/ /opendev. org/openstack/ neutron/ src/branch/ master/ neutron/ cmd/remove_ duplicated_ port_bindings. py#L27, which calls oslo.log which in turn calls Python's logging facility here: https:/ /github. com/openstack/ oslo.log/ blob/master/ oslo_log/ log.py# L507. The default Python logging level is WARNING. So, yes, since the code logs at INFO level, nothing gets logged.
We should call https:/ /opendev. org/openstack/ neutron/ src/branch/ master/ neutron/ common/ config. py#L111 to initialize logging, like in for example https:/ /opendev. org/openstack/ neutron/ src/branch/ master/ neutron/ cmd/netns_ cleanup. py#L271. This calls oslo.log setup which sets logging level at INFO level by default: https:/ /github. com/openstack/ oslo.log/ blob/master/ oslo_log/ log.py# L352