Modified the database structure
Change-Id: Ia58c160b281ab928cd66815b869ad519f7c805a4 Implements: blueprint Schema redesign
This commit is contained in:
parent
aac0f61ce6
commit
c30f0a53f7
@ -11,8 +11,8 @@ script_location = alembic
|
|||||||
# the 'revision' command, regardless of autogenerate
|
# the 'revision' command, regardless of autogenerate
|
||||||
# revision_environment = false
|
# revision_environment = false
|
||||||
|
|
||||||
sqlalchemy.url = driver://user:pass@localhost/dbname
|
#sqlalchemy.url = driver://user:pass@localhost/dbname
|
||||||
|
sqlalchemy.url = sqlite:///db.sqlite
|
||||||
|
|
||||||
[alembic_sqlite]
|
[alembic_sqlite]
|
||||||
# path to migration scripts
|
# path to migration scripts
|
||||||
|
@ -31,9 +31,9 @@ fileConfig(config.config_file_name)
|
|||||||
|
|
||||||
# add your model's MetaData object here
|
# add your model's MetaData object here
|
||||||
# for 'autogenerate' support
|
# for 'autogenerate' support
|
||||||
# from refstack.models import db
|
from refstack.models import db
|
||||||
# target_metadata = db.metadata
|
target_metadata = db.metadata
|
||||||
target_metadata = None
|
#target_metadata = None
|
||||||
|
|
||||||
# other values from the config, defined by the needs of env.py,
|
# other values from the config, defined by the needs of env.py,
|
||||||
# can be acquired:
|
# can be acquired:
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
"""added vendor contact name
|
"""added architecture to cloud
|
||||||
|
|
||||||
Revision ID: 1d6540fc6279
|
Revision ID: 2d1f3e3cd357
|
||||||
Revises: 3790aed42558
|
Revises: 4a425a7aff50
|
||||||
Create Date: 2013-10-31 01:30:12.489026
|
Create Date: 2014-03-07 12:11:20.403933
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '1d6540fc6279'
|
revision = '2d1f3e3cd357'
|
||||||
down_revision = '3790aed42558'
|
down_revision = '4a425a7aff50'
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
@ -17,12 +17,12 @@ import sqlalchemy as sa
|
|||||||
def upgrade():
|
def upgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
op.add_column(
|
op.add_column(
|
||||||
'vendor',
|
'cloud',
|
||||||
sa.Column('contact_name', sa.String(length=120), nullable=True))
|
sa.Column('architecture', sa.String(length=40), nullable=True))
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_column('vendor', 'contact_name')
|
op.drop_column('cloud', 'architecture')
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
@ -1,23 +0,0 @@
|
|||||||
"""added user - cloud relationship
|
|
||||||
|
|
||||||
Revision ID: 4288db006e5
|
|
||||||
Revises: 1d6540fc6279
|
|
||||||
Create Date: 2013-10-31 21:00:27.473833
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '4288db006e5'
|
|
||||||
down_revision = '1d6540fc6279'
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
|
||||||
pass
|
|
||||||
### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
|
||||||
pass
|
|
||||||
### end Alembic commands ###
|
|
@ -1,32 +0,0 @@
|
|||||||
"""empty message
|
|
||||||
|
|
||||||
Revision ID: 449461dbc725
|
|
||||||
Revises: 59e15d864941
|
|
||||||
Create Date: 2013-11-26 16:57:16.062788
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '449461dbc725'
|
|
||||||
down_revision = '59e15d864941'
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
op.create_table(
|
|
||||||
'apikey',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('name', sa.String(length=60), nullable=True),
|
|
||||||
sa.Column('key', sa.String(length=200), nullable=True),
|
|
||||||
sa.Column('openid', sa.String(length=200), nullable=True),
|
|
||||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
op.drop_Table('apikey')
|
|
@ -1,13 +1,13 @@
|
|||||||
"""from scratch
|
"""major restructure
|
||||||
|
|
||||||
Revision ID: 3790aed42558
|
Revision ID: 4a425a7aff50
|
||||||
Revises: None
|
Revises: None
|
||||||
Create Date: 2013-10-30 03:52:16.922050
|
Create Date: 2014-03-07 11:20:58.899889
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '3790aed42558'
|
revision = '4a425a7aff50'
|
||||||
down_revision = None
|
down_revision = None
|
||||||
|
|
||||||
from alembic import op
|
from alembic import op
|
||||||
@ -16,24 +16,12 @@ import sqlalchemy as sa
|
|||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
op.create_table(
|
|
||||||
'cloud',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('label', sa.String(length=60), nullable=True),
|
|
||||||
sa.Column('endpoint', sa.String(length=120), nullable=True),
|
|
||||||
sa.Column('test_user', sa.String(length=80), nullable=True),
|
|
||||||
sa.Column('test_key', sa.String(length=80), nullable=True),
|
|
||||||
sa.Column('admin_endpoint', sa.String(length=120), nullable=True),
|
|
||||||
sa.Column('admin_user', sa.String(length=80), nullable=True),
|
|
||||||
sa.Column('admin_key', sa.String(length=80), nullable=True),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('endpoint')
|
|
||||||
)
|
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'vendor',
|
'vendor',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('vendor_name', sa.String(length=80), nullable=True),
|
sa.Column('vendor_name', sa.String(length=80), nullable=True),
|
||||||
sa.Column('contact_email', sa.String(length=120), nullable=True),
|
sa.Column('contact_email', sa.String(length=120), nullable=True),
|
||||||
|
sa.Column('contact_name', sa.String(length=120), nullable=True),
|
||||||
sa.PrimaryKeyConstraint('id'),
|
sa.PrimaryKeyConstraint('id'),
|
||||||
sa.UniqueConstraint('contact_email'),
|
sa.UniqueConstraint('contact_email'),
|
||||||
sa.UniqueConstraint('vendor_name')
|
sa.UniqueConstraint('vendor_name')
|
||||||
@ -54,20 +42,39 @@ def upgrade():
|
|||||||
sa.UniqueConstraint('openid')
|
sa.UniqueConstraint('openid')
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'test',
|
'apikey',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('cloud_id', sa.Integer(), nullable=True),
|
sa.Column('name', sa.String(length=60), nullable=True),
|
||||||
sa.Column('config', sa.String(length=4096), nullable=True),
|
sa.Column('key', sa.String(length=200), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['cloud_id'], ['cloud.id'], ),
|
sa.Column('openid', sa.String(length=200), nullable=True),
|
||||||
|
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
||||||
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
'test_results',
|
'cloud',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('test_id', sa.Integer(), nullable=True),
|
sa.Column('label', sa.String(length=60), nullable=True),
|
||||||
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
sa.Column('endpoint', sa.String(length=512), nullable=True),
|
||||||
sa.Column('blob', sa.Binary(), nullable=True),
|
sa.Column('endpoint_v3', sa.String(length=512), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
|
sa.Column('admin_endpoint', sa.String(length=512), nullable=True),
|
||||||
|
sa.Column('test_user', sa.String(length=80), nullable=True),
|
||||||
|
sa.Column('admin_user', sa.String(length=80), nullable=True),
|
||||||
|
sa.Column('version', sa.String(length=80), nullable=True),
|
||||||
|
sa.Column('tempest_sha', sa.String(length=128), nullable=True),
|
||||||
|
sa.Column('user_id', sa.Integer(), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
|
||||||
|
sa.PrimaryKeyConstraint('id')
|
||||||
|
)
|
||||||
|
op.create_table(
|
||||||
|
'test',
|
||||||
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
sa.Column('cloud_id', sa.Integer(), nullable=True),
|
||||||
|
sa.Column('finished', sa.Boolean(), nullable=True),
|
||||||
|
sa.Column('subunit', sa.String(length=4096), nullable=True),
|
||||||
|
sa.Column('parsed', sa.String(length=4096), nullable=True),
|
||||||
|
sa.ForeignKeyConstraint(['cloud_id'], ['cloud.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table(
|
op.create_table(
|
||||||
@ -75,7 +82,6 @@ def upgrade():
|
|||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
sa.Column('test_id', sa.Integer(), nullable=True),
|
sa.Column('test_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('message', sa.String(length=1024), nullable=True),
|
sa.Column('message', sa.String(length=1024), nullable=True),
|
||||||
sa.Column('finished', sa.Boolean(), nullable=True),
|
|
||||||
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
sa.Column('timestamp', sa.DateTime(), nullable=True),
|
||||||
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
|
sa.ForeignKeyConstraint(['test_id'], ['test.id'], ),
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
@ -86,9 +92,9 @@ def upgrade():
|
|||||||
def downgrade():
|
def downgrade():
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
### commands auto generated by Alembic - please adjust! ###
|
||||||
op.drop_table('test_status')
|
op.drop_table('test_status')
|
||||||
op.drop_table('test_results')
|
|
||||||
op.drop_table('test')
|
op.drop_table('test')
|
||||||
|
op.drop_table('cloud')
|
||||||
|
op.drop_table('apikey')
|
||||||
op.drop_table('user')
|
op.drop_table('user')
|
||||||
op.drop_table('vendor')
|
op.drop_table('vendor')
|
||||||
op.drop_table('cloud')
|
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
@ -1,26 +0,0 @@
|
|||||||
"""really added user - cloud relationship
|
|
||||||
|
|
||||||
Revision ID: 4f6f77184d45
|
|
||||||
Revises: 4288db006e5
|
|
||||||
Create Date: 2013-10-31 21:09:16.469966
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '4f6f77184d45'
|
|
||||||
down_revision = '4288db006e5'
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.add_column('cloud', sa.Column('user_id', sa.Integer(), nullable=True))
|
|
||||||
### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_column('cloud', 'user_id')
|
|
||||||
### end Alembic commands ###
|
|
@ -1,29 +0,0 @@
|
|||||||
"""added subunit output field
|
|
||||||
|
|
||||||
Revision ID: 59e15d864941
|
|
||||||
Revises: 4f6f77184d45
|
|
||||||
Create Date: 2013-11-02 04:41:58.431516
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision = '59e15d864941'
|
|
||||||
down_revision = '4f6f77184d45'
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade():
|
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.add_column(
|
|
||||||
'test_results',
|
|
||||||
sa.Column('subunit', sa.String(length=8192), nullable=True)
|
|
||||||
)
|
|
||||||
### end Alembic commands ###
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
|
||||||
### commands auto generated by Alembic - please adjust! ###
|
|
||||||
op.drop_column('test_results', 'subunit')
|
|
||||||
### end Alembic commands ###
|
|
@ -75,14 +75,15 @@ class Cloud(db.Model):
|
|||||||
"""
|
"""
|
||||||
__tablename__ = 'cloud'
|
__tablename__ = 'cloud'
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
|
||||||
label = db.Column(db.String(60), unique=False)
|
label = db.Column(db.String(60), unique=False)
|
||||||
endpoint = db.Column(db.String(120), unique=True)
|
endpoint = db.Column(db.String(512), unique=False)
|
||||||
|
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)
|
test_user = db.Column(db.String(80), unique=False)
|
||||||
test_key = db.Column(db.String(80), unique=False)
|
|
||||||
admin_endpoint = db.Column(db.String(120), unique=False)
|
|
||||||
admin_user = db.Column(db.String(80), unique=False)
|
admin_user = db.Column(db.String(80), unique=False)
|
||||||
admin_key = db.Column(db.String(80), unique=False)
|
version = db.Column(db.String(80), unique=False)
|
||||||
|
tempest_sha = db.Column(db.String(128), unique=False)
|
||||||
|
architecture = db.Column(db.String(40), unique=False)
|
||||||
|
|
||||||
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
|
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
|
||||||
user = db.relationship('User',
|
user = db.relationship('User',
|
||||||
@ -95,7 +96,9 @@ class Test(db.Model):
|
|||||||
cloud_id = db.Column(db.Integer, db.ForeignKey('cloud.id'))
|
cloud_id = db.Column(db.Integer, db.ForeignKey('cloud.id'))
|
||||||
cloud = db.relationship('Cloud',
|
cloud = db.relationship('Cloud',
|
||||||
backref=db.backref('tests', lazy='dynamic'))
|
backref=db.backref('tests', lazy='dynamic'))
|
||||||
config = db.Column(db.String(4096))
|
finished = db.Column(db.Boolean, default=False)
|
||||||
|
subunit = db.Column(db.String(4096))
|
||||||
|
parsed = db.Column(db.String(4096))
|
||||||
|
|
||||||
def __init__(self, cloud_id):
|
def __init__(self, cloud_id):
|
||||||
self.cloud_id = cloud_id
|
self.cloud_id = cloud_id
|
||||||
@ -108,21 +111,9 @@ class TestStatus(db.Model):
|
|||||||
test = db.relationship('Test',
|
test = db.relationship('Test',
|
||||||
backref=db.backref('status', lazy='dynamic'))
|
backref=db.backref('status', lazy='dynamic'))
|
||||||
message = db.Column(db.String(1024))
|
message = db.Column(db.String(1024))
|
||||||
finished = db.Column(db.Boolean, default=False)
|
|
||||||
timestamp = db.Column(db.DateTime, default=datetime.now)
|
timestamp = db.Column(db.DateTime, default=datetime.now)
|
||||||
|
|
||||||
def __init__(self, test_id, message, finished=False):
|
def __init__(self, test_id, message, finished=False):
|
||||||
self.test_id = test_id
|
self.test_id = test_id
|
||||||
self.message = message
|
self.message = message
|
||||||
self.finished = finished
|
self.finished = finished
|
||||||
|
|
||||||
|
|
||||||
class TestResults(db.Model):
|
|
||||||
__tablename__ = 'test_results'
|
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
|
||||||
test_id = db.Column(db.Integer, db.ForeignKey('test.id'))
|
|
||||||
test = db.relationship('Test',
|
|
||||||
backref=db.backref('results', lazy='dynamic'))
|
|
||||||
timestamp = db.Column(db.DateTime, default=datetime.now)
|
|
||||||
subunit = db.Column(db.String(8192))
|
|
||||||
blob = db.Column(db.Binary)
|
|
||||||
|
@ -2,22 +2,22 @@
|
|||||||
{% block title %}Create Cloud{% endblock %}
|
{% block title %}Create Cloud{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h2>Create Cloud</h2>
|
<h2>Create Cloud</h2>
|
||||||
<form action="" method='post'>
|
<form action="#" method='post'>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Label:</dt>
|
<dt>Label:</dt>
|
||||||
<dd><input type='text' name='label' size='30' value="{{ request.values.label }}"></dd>
|
<dd><input type='text' name='label' size='30' value="{{ request.values.label }}"></dd>
|
||||||
|
<dt>v3 Endpoint:</dt>
|
||||||
|
<dd><input type='text' name='endpoint_v3' size='30' value="{{ request.values.endpoint_v3 }}"></dd>
|
||||||
<dt>Non-Admin Keystone Endpoint:</dt>
|
<dt>Non-Admin Keystone Endpoint:</dt>
|
||||||
<dd><input type='text' name='endpoint' size='30' value="{{ request.values.endpoint }}"></dd>
|
<dd><input type='text' name='endpoint' size='30' value="{{ request.values.endpoint }}"></dd>
|
||||||
<dt>Non-Admin User:</dt>
|
<dt>Non-Admin User:</dt>
|
||||||
<dd><input type='text' name='test_user' size='30' value="{{ request.values.test_user }}"></dd>
|
<dd><input type='text' name='test_user' size='30' value="{{ request.values.test_user }}"></dd>
|
||||||
<dt>Non-Admin Password or Key:</dt>
|
|
||||||
<dd><input type='text' name='test_key' size='30' value="{{ request.values.test_key }}"></dd>
|
|
||||||
<dt>Admin Keystone Endpoint:</dt>
|
<dt>Admin Keystone Endpoint:</dt>
|
||||||
<dd><input type='text' name='admin_endpoint' size='30' value="{{ request.values.admin_endpoint }}"></dd>
|
<dd><input type='text' name='admin_endpoint' size='30' value="{{ request.values.admin_endpoint }}"></dd>
|
||||||
<dt>Admin User:</dt>
|
<dt>Admin User:</dt>
|
||||||
<dd><input type='text' name='admin_user' size='30' value="{{ request.values.admin_user }}"></dd>
|
<dd><input type='text' name='admin_user' size='30' value="{{ request.values.admin_user }}"></dd>
|
||||||
<dt>Admin Password or Key:</dt>
|
<dt>Version:</dt>
|
||||||
<dd><input type='text' name='admin_key' size='30' value="{{ request.values.admin_key }}"></dd>
|
<dd><input type='text' name='version' size='30' value="{{ request.values.version }}"></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<p>
|
<p>
|
||||||
<input type='button' value="Cancel" onclick="location.href='/'">
|
<input type='button' value="Cancel" onclick="location.href='/'">
|
||||||
|
@ -6,18 +6,18 @@
|
|||||||
<dl>
|
<dl>
|
||||||
<dt>Label:</dt>
|
<dt>Label:</dt>
|
||||||
<dd><input type='text' name='label' size='30' value="{{ form.label }}"></dd>
|
<dd><input type='text' name='label' size='30' value="{{ form.label }}"></dd>
|
||||||
|
<dt>v3 Endpoint:</dt>
|
||||||
|
<dd><input type='text' name='endpoint_v3' size='30' value="{{ form.endpoint_v3 }}"></dd>
|
||||||
<dt>Non-Admin Keystone Endpoint:</dt>
|
<dt>Non-Admin Keystone Endpoint:</dt>
|
||||||
<dd><input type='text' name='endpoint' size='30' value="{{ form.endpoint }}"></dd>
|
<dd><input type='text' name='endpoint' size='30' value="{{ form.endpoint }}"></dd>
|
||||||
<dt>Non-Admin User:</dt>
|
<dt>Non-Admin User:</dt>
|
||||||
<dd><input type='text' name='test_user' size='30' value="{{ form.test_user }}"></dd>
|
<dd><input type='text' name='test_user' size='30' value="{{ form.test_user }}"></dd>
|
||||||
<dt>Non-Admin Password or Key:</dt>
|
|
||||||
<dd><input type='text' name='test_key' size='30' value="{{ form.test_key }}"></dd>
|
|
||||||
<dt>Admin Keystone Endpoint:</dt>
|
<dt>Admin Keystone Endpoint:</dt>
|
||||||
<dd><input type='text' name='admin_endpoint' size='30' value="{{ form.admin_endpoint }}"></dd>
|
<dd><input type='text' name='admin_endpoint' size='30' value="{{ form.admin_endpoint }}"></dd>
|
||||||
<dt>Admin User:</dt>
|
<dt>Admin User:</dt>
|
||||||
<dd><input type='text' name='admin_user' size='30' value="{{ form.admin_user }}"></dd>
|
<dd><input type='text' name='admin_user' size='30' value="{{ form.admin_user }}"></dd>
|
||||||
<dt>Admin Password or Key:</dt>
|
<dt>Version:</dt>
|
||||||
<dd><input type='text' name='admin_key' size='30' value="{{ form.admin_key }}"></dd>
|
<dd><input type='text' name='version' size='30' value="{{ form.version }}"></dd>
|
||||||
</dl>
|
</dl>
|
||||||
<p>
|
<p>
|
||||||
<input type='button' value="Cancel" onclick="location.href='/'">
|
<input type='button' value="Cancel" onclick="location.href='/'">
|
||||||
|
@ -135,29 +135,26 @@ def edit_cloud(cloud_id):
|
|||||||
flash(u"This isn't your cloud!")
|
flash(u"This isn't your cloud!")
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
#validate this biotch
|
# some validation
|
||||||
|
# todo: do this smarter
|
||||||
if not request.form['label']:
|
if not request.form['label']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['endpoint']:
|
elif not request.form['endpoint']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['test_user']:
|
elif not request.form['test_user']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['test_key']:
|
|
||||||
flash(u'Error: All fields are required')
|
|
||||||
elif not request.form['admin_endpoint']:
|
elif not request.form['admin_endpoint']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['admin_user']:
|
elif not request.form['admin_user']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['admin_key']:
|
|
||||||
flash(u'Error: All fields are required')
|
|
||||||
else:
|
else:
|
||||||
c.label = request.form['label']
|
c.label = request.form['label']
|
||||||
c.endpoint = request.form['endpoint']
|
c.endpoint = request.form['endpoint']
|
||||||
c.test_user = request.form['test_user']
|
c.test_user = request.form['test_user']
|
||||||
c.test_key = request.form['test_key']
|
|
||||||
c.admin_endpoint = request.form['admin_endpoint']
|
c.admin_endpoint = request.form['admin_endpoint']
|
||||||
|
c.endpoint_v3 = request.form['endpoint_v3']
|
||||||
|
c.version = request.form['version']
|
||||||
c.admin_user = request.form['admin_user']
|
c.admin_user = request.form['admin_user']
|
||||||
c.admin_key = request.form['admin_key']
|
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
@ -166,11 +163,11 @@ def edit_cloud(cloud_id):
|
|||||||
|
|
||||||
form = dict(label=c.label,
|
form = dict(label=c.label,
|
||||||
endpoint=c.endpoint,
|
endpoint=c.endpoint,
|
||||||
test_user=c.test_user,
|
endpoint_v3=c.endpoint_v3,
|
||||||
test_key=c.test_key,
|
|
||||||
admin_endpoint=c.admin_endpoint,
|
admin_endpoint=c.admin_endpoint,
|
||||||
admin_user=c.admin_user,
|
admin_user=c.admin_user,
|
||||||
admin_key=c.admin_key)
|
version=c.version,
|
||||||
|
test_user=c.test_user)
|
||||||
|
|
||||||
return render_template('edit_cloud.html', form=form)
|
return render_template('edit_cloud.html', form=form)
|
||||||
|
|
||||||
@ -179,8 +176,8 @@ def edit_cloud(cloud_id):
|
|||||||
def create_cloud():
|
def create_cloud():
|
||||||
"""This is the handler for creating a new cloud."""
|
"""This is the handler for creating a new cloud."""
|
||||||
|
|
||||||
#if g.user is None:
|
if g.user is None:
|
||||||
# abort(401)
|
abort(401)
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if not request.form['label']:
|
if not request.form['label']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
@ -188,24 +185,20 @@ def create_cloud():
|
|||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['test_user']:
|
elif not request.form['test_user']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['test_key']:
|
|
||||||
flash(u'Error: All fields are required')
|
|
||||||
elif not request.form['admin_endpoint']:
|
elif not request.form['admin_endpoint']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['admin_user']:
|
elif not request.form['admin_user']:
|
||||||
flash(u'Error: All fields are required')
|
flash(u'Error: All fields are required')
|
||||||
elif not request.form['admin_key']:
|
|
||||||
flash(u'Error: All fields are required')
|
|
||||||
else:
|
else:
|
||||||
c = Cloud()
|
c = Cloud()
|
||||||
c.user_id = g.user.id
|
c.user_id = g.user.id
|
||||||
c.label = request.form['label']
|
c.label = request.form['label']
|
||||||
c.endpoint = request.form['endpoint']
|
c.endpoint = request.form['endpoint']
|
||||||
c.test_user = request.form['test_user']
|
c.test_user = request.form['test_user']
|
||||||
c.test_key = request.form['test_key']
|
|
||||||
c.admin_endpoint = request.form['admin_endpoint']
|
c.admin_endpoint = request.form['admin_endpoint']
|
||||||
|
c.endpoint_v3 = request.form['endpoint_v3']
|
||||||
|
c.version = request.form['version']
|
||||||
c.admin_user = request.form['admin_user']
|
c.admin_user = request.form['admin_user']
|
||||||
c.admin_key = request.form['admin_key']
|
|
||||||
|
|
||||||
db.session.add(c)
|
db.session.add(c)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user