Remove deprecated arguments in db sync command

Remove deprecated optional argument '--version'
in the following commands.

* nova-manage db sync
* nova-manage api_db sync

Change-Id: I7795e308497de66329f288b43ecfbf978d67ad75
This commit is contained in:
Takashi NATSUME 2019-06-20 10:35:18 +09:00
parent 74aebe0d4e
commit 2c94aa7d9f
2 changed files with 14 additions and 23 deletions

View File

@ -23,7 +23,6 @@
from __future__ import print_function from __future__ import print_function
import argparse
import functools import functools
import re import re
import sys import sys
@ -441,20 +440,12 @@ class DbCommands(object):
else: else:
print(encodeutils.safe_encode(pt.get_string()).decode()) print(encodeutils.safe_encode(pt.get_string()).decode())
@args('--version', metavar='<version>', help=argparse.SUPPRESS)
@args('--local_cell', action='store_true', @args('--local_cell', action='store_true',
help='Only sync db in the local cell: do not attempt to fan-out ' help='Only sync db in the local cell: do not attempt to fan-out '
'to all cells') 'to all cells')
@args('version2', metavar='VERSION', nargs='?', help='Database version') @args('version', metavar='VERSION', nargs='?', help='Database version')
def sync(self, version=None, local_cell=False, version2=None): def sync(self, version=None, local_cell=False):
"""Sync the database up to the most recent version.""" """Sync the database up to the most recent version."""
if version and not version2:
print(_("DEPRECATED: The '--version' parameter was deprecated in "
"the Pike cycle and will not be supported in future "
"versions of nova. Use the 'VERSION' positional argument "
"instead"))
version2 = version
if not local_cell: if not local_cell:
ctxt = context.RequestContext() ctxt = context.RequestContext()
# NOTE(mdoff): Multiple cells not yet implemented. Currently # NOTE(mdoff): Multiple cells not yet implemented. Currently
@ -463,7 +454,7 @@ class DbCommands(object):
cell_mapping = objects.CellMapping.get_by_uuid(ctxt, cell_mapping = objects.CellMapping.get_by_uuid(ctxt,
objects.CellMapping.CELL0_UUID) objects.CellMapping.CELL0_UUID)
with context.target_cell(ctxt, cell_mapping) as cctxt: with context.target_cell(ctxt, cell_mapping) as cctxt:
migration.db_sync(version2, context=cctxt) migration.db_sync(version, context=cctxt)
except exception.CellMappingNotFound: except exception.CellMappingNotFound:
print(_('WARNING: cell0 mapping not found - not' print(_('WARNING: cell0 mapping not found - not'
' syncing cell0.')) ' syncing cell0.'))
@ -871,18 +862,10 @@ class ApiDbCommands(object):
def __init__(self): def __init__(self):
pass pass
@args('--version', metavar='<version>', help=argparse.SUPPRESS) @args('version', metavar='VERSION', nargs='?', help='Database version')
@args('version2', metavar='VERSION', nargs='?', help='Database version') def sync(self, version=None):
def sync(self, version=None, version2=None):
"""Sync the database up to the most recent version.""" """Sync the database up to the most recent version."""
if version and not version2: return migration.db_sync(version, database='api')
print(_("DEPRECATED: The '--version' parameter was deprecated in "
"the Pike cycle and will not be supported in future "
"versions of nova. Use the 'VERSION' positional argument "
"instead"))
version2 = version
return migration.db_sync(version2, database='api')
def version(self): def version(self):
"""Print the current database version.""" """Print the current database version."""

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
The ``--version`` argument has been removed in the following commands.
Use the ``VERSION`` positional argument instead.
- ``nova-manage db sync``
- ``nova-manage api_db sync``