Merge "Support getting and updating network_info of environment."
This commit is contained in:
commit
cdc3d82fef
@ -114,6 +114,7 @@ def handle_result(message):
|
||||
return
|
||||
|
||||
environment.description = environment_result
|
||||
environment.networking = environment_result.get('networking', {})
|
||||
environment.version += 1
|
||||
environment.save(session)
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# 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.
|
||||
from migrate.changeset.constraint import ForeignKeyConstraint
|
||||
|
||||
from sqlalchemy.schema import MetaData, Table, Column
|
||||
from sqlalchemy.types import String, Text, DateTime, BigInteger
|
||||
|
||||
|
||||
meta = MetaData()
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
environment = Table('environment', meta, autoload=True)
|
||||
networking = Column('networking', Text(), nullable=True, default='{}')
|
||||
networking.create(environment)
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
meta.bind = migrate_engine
|
||||
environment = Table('environment', meta, autoload=True)
|
||||
environment.c.networking.drop()
|
@ -104,6 +104,7 @@ class Environment(BASE, ModelBase):
|
||||
tenant_id = Column(String(32), nullable=False)
|
||||
version = Column(BigInteger, nullable=False, default=0)
|
||||
description = Column(JsonBlob(), nullable=False, default={})
|
||||
networking = Column(JsonBlob(), nullable=True, default={})
|
||||
|
||||
sessions = relationship("Session", backref='environment',
|
||||
cascade='save-update, merge, delete')
|
||||
|
Loading…
Reference in New Issue
Block a user