Add ALT_USER to cloud model.

Added alt_user to cloud model.

Change-Id: Ic25375663bd556aa7a6f9c14e0e126fee355f96f
This commit is contained in:
Raymond Wong 2014-04-07 12:17:00 -07:00
parent c92d830565
commit 3454d2acfd
5 changed files with 43 additions and 8 deletions

View File

@ -0,0 +1,24 @@
"""added_alt_user
Revision ID: 121ee191d348
Revises: 2d1f3e3cd357
Create Date: 2014-04-07 11:43:51.800255
"""
# revision identifiers, used by Alembic.
revision = '121ee191d348'
down_revision = '2d1f3e3cd357'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
'cloud',
sa.Column('alt_user', sa.String(length=80), nullable=True))
def downgrade():
op.drop_column('cloud', 'alt_user')

View File

@ -59,7 +59,8 @@ class Vendor(db.Model):
"""Note: The vendor list will be pre-populated from the
sponsoring company database.
TODO: better define the vendor object and its relationship with user
it needs the ability to facilitate a login."""
it needs the ability to facilitate a login.
"""
__tablename__ = 'vendor'
id = db.Column(db.Integer, primary_key=True)
vendor_name = db.Column(db.String(80), unique=True)
@ -80,6 +81,7 @@ class Cloud(db.Model):
endpoint_v3 = db.Column(db.String(512), unique=False)
admin_endpoint = db.Column(db.String(512), unique=False)
test_user = db.Column(db.String(80), unique=False)
alt_user = db.Column(db.String(80), unique=False)
admin_user = db.Column(db.String(80), unique=False)
version = db.Column(db.String(80), unique=False)
tempest_sha = db.Column(db.String(128), unique=False)

View File

@ -10,8 +10,10 @@
<dd><input type='text' name='endpoint_v3' size='30' value="{{ request.values.endpoint_v3 }}"></dd>
<dt>Non-Admin Keystone Endpoint:</dt>
<dd><input type='text' name='endpoint' size='30' value="{{ request.values.endpoint }}"></dd>
<dt>Non-Admin User:</dt>
<dt>Non-Admin Test User:</dt>
<dd><input type='text' name='test_user' size='30' value="{{ request.values.test_user }}"></dd>
<dt>Alternate Non-Admin Test User:</dt>
<dd><input type='text' name='alt_user' size='30' value="{{ request.values.alt_user }}"></dd>
<dt>Admin Keystone Endpoint:</dt>
<dd><input type='text' name='admin_endpoint' size='30' value="{{ request.values.admin_endpoint }}"></dd>
<dt>Admin User:</dt>
@ -24,6 +26,5 @@
<input type='submit' value="Create">
<input type='hidden' name='next' value="{{ next }}">
</form>
{% endblock %}
{% endblock %}

View File

@ -10,8 +10,10 @@
<dd><input type='text' name='endpoint_v3' size='30' value="{{ form.endpoint_v3 }}"></dd>
<dt>Non-Admin Keystone Endpoint:</dt>
<dd><input type='text' name='endpoint' size='30' value="{{ form.endpoint }}"></dd>
<dt>Non-Admin User:</dt>
<dt>Non-Admin Test User:</dt>
<dd><input type='text' name='test_user' size='30' value="{{ form.test_user }}"></dd>
<dt>Alternate Non-Admin Test User:</dt>
<dd><input type='text' name='alt_user' size='30' value="{{ form.alt_user }}"></dd>
<dt>Admin Keystone Endpoint:</dt>
<dd><input type='text' name='admin_endpoint' size='30' value="{{ form.admin_endpoint }}"></dd>
<dt>Admin User:</dt>
@ -24,6 +26,5 @@
<input type='submit' value="Save">
<input type='hidden' name='next' value="{{ next }}">
</form>
{% endblock %}
{% endblock %}

View File

@ -165,6 +165,8 @@ def edit_cloud(cloud_id):
flash(u'Error: All fields are required')
elif not request.form['test_user']:
flash(u'Error: All fields are required')
elif not request.form['alt_user']:
flash(u'Error: All fields are required')
elif not request.form['admin_endpoint']:
flash(u'Error: All fields are required')
elif not request.form['admin_user']:
@ -173,6 +175,7 @@ def edit_cloud(cloud_id):
cloud.label = request.form['label']
cloud.endpoint = request.form['endpoint']
cloud.test_user = request.form['test_user']
cloud.alt_user = request.form['alt_user']
cloud.admin_endpoint = request.form['admin_endpoint']
cloud.endpoint_v3 = request.form['endpoint_v3']
cloud.version = request.form['version']
@ -189,7 +192,8 @@ def edit_cloud(cloud_id):
admin_endpoint=cloud.admin_endpoint,
admin_user=cloud.admin_user,
version=cloud.version,
test_user=cloud.test_user)
test_user=cloud.test_user,
alt_user=cloud.alt_user)
return render_template('edit_cloud.html', form=form)
@ -207,6 +211,8 @@ def create_cloud():
flash(u'Error: All fields are required')
elif not request.form['test_user']:
flash(u'Error: All fields are required')
elif not request.form['alt_user']:
flash(u'Error: All fields are required')
elif not request.form['admin_endpoint']:
flash(u'Error: All fields are required')
elif not request.form['admin_user']:
@ -217,6 +223,7 @@ def create_cloud():
new_cloud.label = request.form['label']
new_cloud.endpoint = request.form['endpoint']
new_cloud.test_user = request.form['test_user']
new_cloud.alt_user = request.form['alt_user']
new_cloud.admin_endpoint = request.form['admin_endpoint']
new_cloud.endpoint_v3 = request.form['endpoint_v3']
new_cloud.version = request.form['version']