← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1206257] Re: migration 20 fails when member_role_id already in metadata

 

** Changed in: keystone
       Status: Fix Committed => Fix Released

** Changed in: keystone
    Milestone: None => havana-3

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

Title:
  migration 20 fails when member_role_id already in metadata

Status in OpenStack Identity (Keystone):
  Fix Released

Bug description:
  If member_role_id is already in the a user-project's metadata, the old
  metadata never gets deserialized.

      for metadata in session.query(old_metadata_table):
          if config.CONF.member_role_id not in metadata.data:
              data = json.loads(metadata.data)
              data['roles'].append(config.CONF.member_role_id)
          else:
              data = metadata.data

  
  This means, when data is later accessed as a dictionary (when its actually just a string) you get the following exception.

  'Traceback (most recent call last):\\\\\\\
  File "/usr/bin/keystone-manage", line 28, in <module>\\\\\\\
  cli.main(argv=sys.argv, config_files=config_files)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/keystone/cli.py", line 197, in main\\\\\\\
  CONF.command.cmd_class.main()\\\\\\\
  File "/usr/lib/python2.7/dist-packages/keystone/cli.py", line 65, in main\\\\\\\
  driver.db_sync(CONF.command.version)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/keystone/identity/backends/sql.py", line 156, in db_sync\\\\\\\
  migration.db_sync(version=version)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/keystone/common/sql/migration.py", line 52, in db_sync\\\\\\\
  return versioning_api.upgrade(CONF.sql.connection, repo_path, version)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 186, in upgrade\\\\\\\
  return _migrate(url, repository, version, upgrade=True, err=err, **opts)\\\\\\\
  File "<string>", line 2, in _migrate\\\\\\\
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/util/_init_.py", line 159, in with_engine\\\\\\\
  return f(*a, **kw)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/api.py", line 366, in _migrate\\\\\\\
  schema.runchange(ver, change, changeset.step)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/schema.py", line 91, in runchange\\\\\\\
  change.run(self.engine, step)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/migrate/versioning/script/py.py", line 145, in run\\\\\\\
  script_func(engine)\\\\\\\
  File "/usr/lib/python2.7/dist-packages/keystone/common/sql/migrate_repo/versions/021_migrate_metadata_table_roles.py", line 41, in upgrade\\\\\\\
  old_roles = data\\\\\\\\\\\\\\\'roles\\\\\\\\\\\\\\\'\\\\\\\
  TypeError: string indices must be integers, not str\\\\\\\
  \\\\\\\'\\\'\

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