From: Steven Hardy Date: Fri, 23 Aug 2013 10:28:01 +0000 (+0100) Subject: Remove unnecessary aws_* from user_creds X-Git-Tag: 2014.1~116 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8765bf3d2ef07eb0e15719738e16cc0da2fa6afe;p=openstack-build%2Fheat-build.git Remove unnecessary aws_* from user_creds 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 --- 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 index 00000000..69e7cb99 --- /dev/null +++ b/heat/db/sqlalchemy/migrate_repo/versions/026_user_creds_drop_aws.py @@ -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) diff --git a/heat/db/sqlalchemy/models.py b/heat/db/sqlalchemy/models.py index 50141ab6..44c44c4d 100644 --- a/heat/db/sqlalchemy/models.py +++ b/heat/db/sqlalchemy/models.py @@ -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'))