No warning when deprecated opt used

Bug #1390408 reported by Ben Nemec
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
oslo.config
High
Ben Nemec

Bug Description

In TripleO we were recently bitten by a large number of deprecated opts being removed in Nova, and as far as I can tell there is no indication from oslo.config when a deprecated opt is used. We should be logging a warning so that operators can easily tell when they are using something that might disappear on them.

This is related to https://bugs.launchpad.net/oslo.config/+bug/1319868 but actually goes further in logging _every_ time a deprecated opt is used rather than just when one is used with a non-deprecated opt.

I thought we were already doing this, but it doesn't appear so:
[bnemec@RedHat config]$ grep -r LOG
cfg.py:LOG = logging.getLogger(__name__)
cfg.py: LOG.debug(('Expected default value of type(s) %(extypes)s but got '
cfg.py: LOG.warn("Caught SystemExit while reloading configure files "
cfg.py: LOG.warn("Caught Error while reloading configure files: %s",
generator.py:LOG = logging.getLogger(__name__)
generator.py: LOG.warning('"%s" is missing a help string', opt.dest)
generator.py: LOG.warning('Unknown option type: %s', repr(opt))
[bnemec@RedHat config]$ grep -r logger.log
cfg.py: logger.log()
cfg.py: logger.log(lvl, "*" * 80)
cfg.py: logger.log(lvl, "Configuration options gathered from:")
cfg.py: logger.log(lvl, "command line args: %s", self._args)
cfg.py: logger.log(lvl, "config files: %s", self.config_file)
cfg.py: logger.log(lvl, "=" * 80)
cfg.py: logger.log(lvl, "%-30s = %s", opt_name,
cfg.py: logger.log(lvl, "%-30s = %s",
cfg.py: logger.log(lvl, "*" * 80)

Tags: ops Edit Tag help
Revision history for this message
Ben Nemec (bnemec) wrote :

Specifically, it was commits like https://github.com/openstack/nova/commit/c4489643b37cd7ed09737448891329fc7c1f7b83 that caused issues. I'm not sure why they bothered to remove the deprecated opts, but they did.

tags: added: ops
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :
Changed in oslo.config:
assignee: nobody → Nolan Brubaker (nolan-brubaker)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.config (master)

Fix proposed to branch: master
Review: https://review.openstack.org/141928

Changed in oslo.config:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/148020

Changed in oslo.config:
assignee: Nolan Brubaker (nolan-brubaker) → Ben Nemec (bnemec)
Changed in oslo.config:
milestone: none → kilo-next
Changed in oslo.config:
milestone: 1.6.1 → next-kilo
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.config (master)

Reviewed: https://review.openstack.org/148020
Committed: https://git.openstack.org/cgit/openstack/oslo.config/commit/?id=dc1d2340d552796ad66165bc0ff88e10fe0b6f06
Submitter: Jenkins
Branch: master

commit dc1d2340d552796ad66165bc0ff88e10fe0b6f06
Author: Ben Nemec <email address hidden>
Date: Fri Jan 16 23:14:51 2015 +0000

    Log a warning when deprecated opts are used

    This change logs the warning at lookup time instead of parse time
    because we have no way of knowing at parse time which options are
    deprecated. It does use a set to make sure it only logs a given
    deprecation warning once per option so it won't spam the logs.

    I could not find a way to log deprecations for cli args. argparse
    seems to only write the value to the undeprecated name, so there's
    no way to tell whether it came from a deprecated name originally.
    Since most of our opts are set through config files I don't see
    this as a huge issue though.

    I'm also not using the warnings module because its deprecation
    mechanisms seem more developer focused, and for config opts we
    need to notify the user. This is not possible with the warnings
    module in Python 2.6 (there's no way to send warnings to the log
    by default), and since we still need to support that for oslo libs
    I went with a simple logged warning instead.

    Change-Id: I4580831f34c48882fb07288fa8d55272b58e2674
    Closes-Bug: 1390408

Changed in oslo.config:
status: In Progress → Fix Committed
Changed in oslo.config:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on oslo.config (master)

Change abandoned by Nolan Brubaker (<email address hidden>) on branch: master
Review: https://review.openstack.org/141928
Reason: This review is stale and no longer relevant.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers