From a7b7fea7a3fe7677981fbf9bac5121bc15601163 Mon Sep 17 00:00:00 2001 From: Brant Knudson Date: Thu, 18 Feb 2016 14:08:36 -0600 Subject: [PATCH] db_sync doesn't create default domain The reason db_sync needed to create the default domain is because we needed a domain for existing v2 users. Since the migrations don't add the domain_id to users anymore there's no need to create the default domain. DocImpact -- The install guide should be updated to say to use keystone-manage bootstrap or to create the default domain if the deployment is going to support v2. Change-Id: I65860fe989ac2456b73bcc12fd02643564b24574 --- .../common/sql/migrate_repo/versions/067_kilo.py | 7 ------- keystone/tests/unit/test_sql_upgrade.py | 16 ---------------- .../no-default-domain-2161ada44bf7a3f7.yaml | 6 ++++++ 3 files changed, 6 insertions(+), 23 deletions(-) create mode 100644 releasenotes/notes/no-default-domain-2161ada44bf7a3f7.yaml diff --git a/keystone/common/sql/migrate_repo/versions/067_kilo.py b/keystone/common/sql/migrate_repo/versions/067_kilo.py index fbce57b207..a6dbed670f 100644 --- a/keystone/common/sql/migrate_repo/versions/067_kilo.py +++ b/keystone/common/sql/migrate_repo/versions/067_kilo.py @@ -14,11 +14,9 @@ import migrate from oslo_log import log import sqlalchemy as sql -from sqlalchemy import orm from keystone.assignment.backends import sql as assignment_sql from keystone.common import sql as ks_sql -from keystone.common.sql import migration_helpers from keystone.identity.mapping_backends import mapping as mapping_backend @@ -317,8 +315,3 @@ def upgrade(migrate_engine): migrate.ForeignKeyConstraint(columns=fkey['columns'], refcolumns=fkey['references'], name=fkey.get('name')).create() - - # Create the default domain. - session = orm.sessionmaker(bind=migrate_engine)() - domain.insert(migration_helpers.get_default_domain()).execute() - session.commit() diff --git a/keystone/tests/unit/test_sql_upgrade.py b/keystone/tests/unit/test_sql_upgrade.py index d3df4179e4..cfd597fcb4 100644 --- a/keystone/tests/unit/test_sql_upgrade.py +++ b/keystone/tests/unit/test_sql_upgrade.py @@ -281,22 +281,6 @@ class SqlUpgradeTests(SqlMigrateBase): for table in INITIAL_TABLE_STRUCTURE: self.assertTableColumns(table, INITIAL_TABLE_STRUCTURE[table]) - # Ensure the default domain was properly created. - default_domain = migration_helpers.get_default_domain() - - meta = sqlalchemy.MetaData() - meta.bind = self.engine - - domain_table = sqlalchemy.Table('domain', meta, autoload=True) - - session = self.Session() - q = session.query(domain_table) - refs = q.all() - - self.assertEqual(1, len(refs)) - for k in default_domain.keys(): - self.assertEqual(default_domain[k], getattr(refs[0], k)) - def insert_dict(self, session, table_name, d, table=None): """Naively inserts key-value pairs into a table, given a dictionary.""" if table is None: diff --git a/releasenotes/notes/no-default-domain-2161ada44bf7a3f7.yaml b/releasenotes/notes/no-default-domain-2161ada44bf7a3f7.yaml new file mode 100644 index 0000000000..654be4f68e --- /dev/null +++ b/releasenotes/notes/no-default-domain-2161ada44bf7a3f7.yaml @@ -0,0 +1,6 @@ +--- +other: + - > + ``keystone-manage db_sync`` will no longer create the Default domain. This + domain is used as the domain for any users created using the legacy v2.0 + API. A default domain is created by ``keystone-manage bootstrap``.