Use one ConfigOpts in placement-status

Because of a conflict between how the oslo.upgradecheck library uses
oslo config and how we want to use it in placement, two different
ConfigOpts were needed to avoid an args already parsed error. The
new release of the oslo.upgradecheck library is change to allow
the two steps in main (registering the CLI opts and running the
command) to be called separately if desired. Doing so allows us
to use just one ConfigOpts.

Requirements and constraints are updated.

Change-Id: I792df18cb17da95659628bfe7f7a69897c6f37ab
This commit is contained in:
Chris Dent 2019-01-28 19:57:29 +00:00
parent 09c1318294
commit 71a6aa21c6
3 changed files with 12 additions and 8 deletions

View File

@ -56,7 +56,7 @@ oslo.middleware==3.31.0
oslo.policy==1.35.0
oslo.serialization==2.18.0
oslo.service==1.24.0
oslo.upgradecheck==0.1.1
oslo.upgradecheck==0.2.0
oslo.utils==3.37.0
oslo.versionedobjects==1.31.2
oslotest==3.4.0

View File

@ -120,13 +120,17 @@ def main():
# Set up the configuration to configure the database.
config = cfg.ConfigOpts()
conf.register_opts(config)
config(args=[], project='placement')
# Register cli opts before parsing args.
upgradecheck.register_cli_options(config, Checks(config))
# A slice of sys.argv is provided to pass the command line
# arguments for processing, without the name of the calling
# script ('placement-status'). If we were using
# upgradecheck.main() directly, it would do it for us, but
# we do not because of the need to configure the database
# first.
config(args=sys.argv[1:], project='placement')
db_api.configure(config)
# NOTE(tetsuro): To parse the CLI commands, we pass a fresh ConfigOpts
# to oslo.upgradecheck. We don't use the same config above since it is
# already set up.
return upgradecheck.main(
cfg.ConfigOpts(), project='placement', upgrade_command=Checks(config))
return upgradecheck.run(config)
if __name__ == '__main__':

View File

@ -21,7 +21,7 @@ oslo.db>=4.40.0 # Apache-2.0
oslo.policy>=1.35.0 # Apache-2.0
oslo.i18n>=3.15.3 # Apache-2.0
oslo.middleware>=3.31.0 # Apache-2.0
oslo.upgradecheck>=0.1.1 # Apache-2.0
oslo.upgradecheck>=0.2.0 # Apache-2.0
oslo.versionedobjects>=1.31.2 # Apache-2.0
os-resource-classes>=0.2.0 # Apache-2.0
os-traits>=0.4.0 # Apache-2.0