1====================
2 Option Deprecation
3====================
4
5If you want to rename some options, move them to another group or remove
6completely, you may change their declarations using `deprecated_name`,
7`deprecated_group`  and `deprecated_for_removal` parameters to the :class:`Opt`
8constructor:
9
10.. code-block:: python
11
12    from oslo_config import cfg
13
14    conf = cfg.ConfigOpts()
15
16    opt_1 = cfg.StrOpt('opt_1', default='foo', deprecated_name='opt1')
17    opt_2 = cfg.StrOpt('opt_2', default='spam', deprecated_group='DEFAULT')
18    opt_3 = cfg.BoolOpt('opt_3', default=False, deprecated_for_removal=True)
19
20    conf.register_opt(opt_1, group='group_1')
21    conf.register_opt(opt_2, group='group_2')
22    conf.register_opt(opt_3)
23
24    conf(['--config-file', 'config.conf'])
25
26    assert conf.group_1.opt_1 == 'bar'
27    assert conf.group_2.opt_2 == 'eggs'
28    assert conf.opt_3
29
30Assuming that the file config.conf has the following content:
31
32.. code-block:: ini
33
34    [group_1]
35    opt1 = bar
36
37    [DEFAULT]
38    opt_2 = eggs
39    opt_3 = True
40
41the script will succeed, but will log three respective warnings about the
42given deprecated options.
43
44There are also `deprecated_reason` and `deprecated_since` parameters for
45specifying some additional information about a deprecation.
46
47All the mentioned parameters can be mixed together in any combinations.
48