Search code examples
python-2.7configopenstackoslo

Openstack: Oslo_Config NoSuchOptError for a Deprecated Name - probably need to define Deprecated_Opts?


I recently made a code fix in trove to rename a config parameter name in vertica from 'cluster_member_count' to 'min_cluster_member_count'. Also, I deprecated the value of the old parameter so it can be backwards-compatible. Here is the group where the config option is to be deprecated:

# Vertica
     vertica_group = cfg.OptGroup(
         'vertica', title='Vertica options',
          help="Oslo option group designed for Vertica datastore")
     vertica_opts = [
         cfg.ListOpt('tcp_ports',
               default=["5433", "5434", "22", "5444", "5450", "4803"],
               help='List of TCP ports and/or port ranges to open '
                    'in the security group (only applicable '
                    'if trove_security_groups_support is True).'),
  (skip lines)

I am changing the following cfg.IntOpt:

    cfg.IntOpt('cluster_member_count', default=3,
           help='Number of members in Vertica cluster.'),

Changes to be made:

  • change the parameter name 'cluster_member_count' to 'min_cluster_member_count'
  • the help description is changed accordingly
  • DEPRECATE the old parameter name 'cluster_member_count' and reference it under the group (use DEPRECATED_GROUP) = 'vertical'. This is done for backward compatibility.

The updated cfg.IntOpt is shown below:

    cfg.IntOpt('min_cluster_member_count', default=3,
           help='Minimum number of members in Vertica cluster.',
           deprecated_name='cluster_member_count',
           deprecated_group='vertica'),

however when I ran the tox -e py27 test I am getting the following error:

oslo.config.cfg.NoSuchOptError: no such option in group vertica: cluster_member_count

What am I missing here? I initially thought that this should have worked, as I assigned the correct deprecated_group = 'vertica' for the deprecated name. I appreciate any helpful input - thank you.

UPDATE: I believe I may have to define 'cluster_member_group' under DEPRECATED_OPTS, but googling does not show any sample on how to do it. Wish the Openstack doc provides a sample code, not just the syntax.


Solution

  • because somethere in trove is using cfg.CONF.vertica.cluster_member_count but there is no such option, you should change the code to cfg.CONF.vertica.min_cluster_member_count

    and I think you should not deprecate the group, it is better to be in vertica group, if you do want to deprecate the group name as well, you need to register it in a specific group, for example, the DEFAULT, then other code should reference it as cfg.CONF.min_cluster_member_count

    Cheers