Store the user parameters in the stack table
This allows us to use the raw template + the parameters in place of the parsed_template. Using the parsed template we lose the dependancy information that is necessary when deleting the stack. Change-Id: Icc6ed9ae1617ea9f760a674b44630918669124f9 Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
a2fc69d905
commit
038a65947c
@ -0,0 +1,16 @@
|
||||
from sqlalchemy import *
|
||||
from migrate import *
|
||||
|
||||
|
||||
def upgrade(migrate_engine):
|
||||
meta = MetaData(bind=migrate_engine)
|
||||
|
||||
stack = Table('stack', meta, autoload=True)
|
||||
Column('parameters', Text()).create(stack)
|
||||
|
||||
|
||||
def downgrade(migrate_engine):
|
||||
meta = MetaData(bind=migrate_engine)
|
||||
|
||||
stack = Table('stack', meta, autoload=True)
|
||||
stack.c.parameters.drop()
|
@ -160,6 +160,7 @@ class Stack(BASE, HeatBase):
|
||||
username = Column(String)
|
||||
status = Column('status', String)
|
||||
status_reason = Column('status_reason', String)
|
||||
parameters = Column('parameters', Json)
|
||||
user_creds_id = Column(Integer, ForeignKey('user_creds.id'),
|
||||
nullable=False)
|
||||
owner_id = Column(Integer, nullable=True)
|
||||
|
@ -191,6 +191,7 @@ class EngineManager(manager.Manager):
|
||||
s['raw_template_id'] = new_rt.id
|
||||
s['user_creds_id'] = new_creds.id
|
||||
s['username'] = context.username
|
||||
s['parameters'] = user_params
|
||||
new_s = db_api.stack_create(context, s)
|
||||
stack.id = new_s.id
|
||||
|
||||
@ -267,8 +268,8 @@ class EngineManager(manager.Manager):
|
||||
logger.info('deleting stack %s' % stack_name)
|
||||
|
||||
ps = parser.Stack(context, st.name,
|
||||
st.raw_template.parsed_template.template,
|
||||
st.id, _extract_user_params(params))
|
||||
st.raw_template.template,
|
||||
st.id, st.parameters)
|
||||
greenpool.spawn_n(ps.delete)
|
||||
return None
|
||||
|
||||
@ -484,8 +485,8 @@ class EngineManager(manager.Manager):
|
||||
user_creds = db_api.user_creds_get(s.user_creds_id)
|
||||
ctxt = ctxtlib.RequestContext.from_dict(dict(user_creds))
|
||||
ps = parser.Stack(ctxt, s.name,
|
||||
s.raw_template.parsed_template.template,
|
||||
s.id)
|
||||
s.raw_template.template,
|
||||
s.id, s.parameters)
|
||||
for a in wr.rule[action_map[new_state]]:
|
||||
greenpool.spawn_n(ps[a].alarm)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user