Import the stack module directly

Note: the patch imports "stack as parser" in some places to maintain
API (service.py and event.py).

Change-Id: I0409a04789f0ca362cb9ab0b612d47226d785334
This commit is contained in:
Angus Salkeld 2014-09-09 10:56:09 +10:00
parent 35d7465c11
commit 5131d6c9b2
7 changed files with 17 additions and 17 deletions

View File

@ -52,7 +52,7 @@ class Event(object):
@classmethod @classmethod
def load(cls, context, event_id, event=None, stack=None): def load(cls, context, event_id, event=None, stack=None):
'''Retrieve an Event from the database.''' '''Retrieve an Event from the database.'''
from heat.engine import parser from heat.engine import stack as parser
ev = event if event is not None else\ ev = event if event is not None else\
db_api.event_get(context, event_id) db_api.event_get(context, event_id)

View File

@ -34,10 +34,10 @@ from heat.engine import clients
from heat.engine import environment from heat.engine import environment
from heat.engine.event import Event from heat.engine.event import Event
from heat.engine import parameter_groups from heat.engine import parameter_groups
from heat.engine import parser
from heat.engine import properties from heat.engine import properties
from heat.engine import resource from heat.engine import resource
from heat.engine import resources from heat.engine import resources
from heat.engine import stack as parser
from heat.engine import stack_lock from heat.engine import stack_lock
from heat.engine import template as templatem from heat.engine import template as templatem
from heat.engine import watchrule from heat.engine import watchrule

View File

@ -17,9 +17,9 @@ from heat.common import environment_format
from heat.common import exception from heat.common import exception
from heat.engine import attributes from heat.engine import attributes
from heat.engine import environment from heat.engine import environment
from heat.engine import parser
from heat.engine import resource from heat.engine import resource
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import stack as parser
from heat.engine import template from heat.engine import template
from heat.openstack.common.gettextutils import _ from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging

View File

@ -16,7 +16,7 @@ import datetime
from heat.common import exception from heat.common import exception
from heat.db import api as db_api from heat.db import api as db_api
from heat.engine import parser from heat.engine import stack
from heat.engine import timestamp from heat.engine import timestamp
from heat.openstack.common.gettextutils import _ from heat.openstack.common.gettextutils import _
from heat.openstack.common import log as logging from heat.openstack.common import log as logging
@ -256,11 +256,11 @@ class WatchRule(object):
else: else:
s = db_api.stack_get(self.context, self.stack_id, s = db_api.stack_get(self.context, self.stack_id,
eager_load=True) eager_load=True)
stack = parser.Stack.load(self.context, stack=s) stk = stack.Stack.load(self.context, stack=s)
if (stack.action != stack.DELETE if (stk.action != stk.DELETE
and stack.status == stack.COMPLETE): and stk.status == stk.COMPLETE):
for refid in self.rule[self.ACTION_MAP[new_state]]: for refid in self.rule[self.ACTION_MAP[new_state]]:
actions.append(stack.resource_by_refid(refid).signal) actions.append(stk.resource_by_refid(refid).signal)
else: else:
LOG.warning(_("Could not process watch state %s for stack") LOG.warning(_("Could not process watch state %s for stack")
% new_state) % new_state)

View File

@ -36,11 +36,11 @@ from heat.engine.clients.os import keystone
from heat.engine.clients.os import nova from heat.engine.clients.os import nova
from heat.engine import dependencies from heat.engine import dependencies
from heat.engine import environment from heat.engine import environment
from heat.engine import parser
from heat.engine.properties import Properties from heat.engine.properties import Properties
from heat.engine import resource as res from heat.engine import resource as res
from heat.engine.resources import instance as instances from heat.engine.resources import instance as instances
from heat.engine import service from heat.engine import service
from heat.engine import stack as parser
from heat.engine import stack_lock from heat.engine import stack_lock
from heat.engine import template as templatem from heat.engine import template as templatem
from heat.engine import watchrule from heat.engine import watchrule

View File

@ -20,9 +20,9 @@ import mox
from heat.common import exception from heat.common import exception
from heat.common import template_format from heat.common import template_format
from heat.engine import environment from heat.engine import environment
from heat.engine import parser
from heat.engine import resource from heat.engine import resource
from heat.engine import scheduler from heat.engine import scheduler
from heat.engine import stack as parser
from heat.engine import stack_resource from heat.engine import stack_resource
from heat.engine import template as templatem from heat.engine import template as templatem
from heat.tests.common import HeatTestCase from heat.tests.common import HeatTestCase

View File

@ -22,8 +22,8 @@ import sqlalchemy
from heat.common import context from heat.common import context
from heat.db import api as db_api from heat.db import api as db_api
from heat.engine import environment from heat.engine import environment
from heat.engine import parser
from heat.engine import resource from heat.engine import resource
from heat.engine import stack
from heat.engine import template from heat.engine import template
get_engine = db_api.get_engine get_engine = db_api.get_engine
@ -87,12 +87,12 @@ def parse_stack(t, params=None, stack_name='test_stack', stack_id=None,
params = params or {} params = params or {}
ctx = dummy_context() ctx = dummy_context()
templ = template.Template(t) templ = template.Template(t)
stack = parser.Stack(ctx, stack_name, templ, stk = stack.Stack(ctx, stack_name, templ,
environment.Environment(params), stack_id, environment.Environment(params), stack_id,
timeout_mins=timeout_mins) timeout_mins=timeout_mins)
stack.store() stk.store()
return stack return stk
class PhysName(object): class PhysName(object):
@ -109,7 +109,7 @@ class PhysName(object):
def __eq__(self, physical_name): def __eq__(self, physical_name):
try: try:
stack, res, short_id = str(physical_name).rsplit('-', 2) stk, res, short_id = str(physical_name).rsplit('-', 2)
except ValueError: except ValueError:
return False return False