← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1264193] [NEW] wrong doc string for glance.db.sqlalchemy.migration.db_sync

 

Public bug reported:

When review patch: https://review.openstack.org/#/c/64076/
I found that:

def db_sync(version=None, current_version=None):
    """
Place a database under migration control and perform an upgrade

:retval version number
"""
    sql_connection = CONF.sql_connection
    try:
        _version_control(current_version or 0)
    except versioning_exceptions.DatabaseAlreadyControlledError as e:
        pass

    if current_version is None:
        current_version = int(db_version())
    if version is not None and int(version) < current_version:
        downgrade(version=version)
    elif version is None or int(version) > current_version:
        upgrade(version=version)

db_sync doesn't return anything, the doc string and code are broken.
Since db_sync() accept empty arguments list, so a reasonable version
number should be returned instead of remove the incorrect doc string.

** Affects: glance
     Importance: Undecided
     Assignee: ZhiQiang Fan (aji-zqfan)
         Status: New


** Tags: db low-hanging-fruit

** Changed in: glance
     Assignee: (unassigned) => ZhiQiang Fan (aji-zqfan)

** Tags added: db low-hanging-fruit

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1264193

Title:
  wrong doc string for glance.db.sqlalchemy.migration.db_sync

Status in OpenStack Image Registry and Delivery Service (Glance):
  New

Bug description:
  When review patch: https://review.openstack.org/#/c/64076/
  I found that:

  def db_sync(version=None, current_version=None):
      """
  Place a database under migration control and perform an upgrade

  :retval version number
  """
      sql_connection = CONF.sql_connection
      try:
          _version_control(current_version or 0)
      except versioning_exceptions.DatabaseAlreadyControlledError as e:
          pass

      if current_version is None:
          current_version = int(db_version())
      if version is not None and int(version) < current_version:
          downgrade(version=version)
      elif version is None or int(version) > current_version:
          upgrade(version=version)

  db_sync doesn't return anything, the doc string and code are broken.
  Since db_sync() accept empty arguments list, so a reasonable version
  number should be returned instead of remove the incorrect doc string.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1264193/+subscriptions


Follow ups

References