]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Remove unnecessary aws_* from user_creds
authorSteven Hardy <shardy@redhat.com>
Fri, 23 Aug 2013 10:28:01 +0000 (11:28 +0100)
committerSteven Hardy <shardy@redhat.com>
Tue, 27 Aug 2013 17:01:51 +0000 (18:01 +0100)
We currently store aws_creds, but it's never used in any of the clients
which consume the stored context.  It makes sense to remove it from the
DB, but leave it in heat/common/context.py; then the credentials used for
real requests *to* heat (authenticated via the ec2token middleware) are
obtainable in the context, but we don't populate them in context to be
used in client connections for requests going *from* heat.

Fixes bug #1215850

Change-Id: I7a75c70beb0318a1e83ac0ab45d13802999d1282

heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py [new file with mode: 0644]
heat/db/sqlalchemy/models.py

diff --git a/heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py b/heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py
new file mode 100644 (file)
index 0000000..69e7cb9
--- /dev/null
@@ -0,0 +1,37 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+#    License for the specific language governing permissions and limitations
+#    under the License.
+
+import sqlalchemy
+
+
+def upgrade(migrate_engine):
+    meta = sqlalchemy.MetaData(bind=migrate_engine)
+
+    user_creds = sqlalchemy.Table('user_creds', meta, autoload=True)
+
+    user_creds.c.aws_creds.drop()
+    user_creds.c.aws_auth_url.drop()
+
+
+def downgrade(migrate_engine):
+    meta = sqlalchemy.MetaData(bind=migrate_engine)
+
+    user_creds = sqlalchemy.Table('user_creds', meta, autoload=True)
+
+    aws_creds = sqlalchemy.Column('aws_creds',
+                                  sqlalchemy.String(length=255))
+    aws_creds.create(user_creds)
+    aws_auth_url = sqlalchemy.Column('aws_auth_url',
+                                     sqlalchemy.String(length=255))
+    aws_auth_url.create(user_creds)
index 50141ab637e369d2033f4d4b5ae20a6934f91f3b..44c44c4d454c3ddf70b81ae202c10dac2a2df5cf 100644 (file)
@@ -209,9 +209,7 @@ class UserCreds(BASE, HeatBase):
     password = sqlalchemy.Column(sqlalchemy.String)
     tenant = sqlalchemy.Column(sqlalchemy.String)
     auth_url = sqlalchemy.Column(sqlalchemy.String)
-    aws_auth_url = sqlalchemy.Column(sqlalchemy.String)
     tenant_id = sqlalchemy.Column(sqlalchemy.String)
-    aws_creds = sqlalchemy.Column(sqlalchemy.String)
     stack = relationship(Stack, backref=backref('user_creds'))