Merge "Move CircularDependencyException to common"
This commit is contained in:
commit
9063bd7121
@ -568,3 +568,7 @@ class InvalidTemplateVersions(HeatException):
|
||||
|
||||
class UnableToAutoAllocateNetwork(HeatException):
|
||||
msg_fmt = _('Unable to automatically allocate a network: %(message)s')
|
||||
|
||||
|
||||
class CircularDependencyException(HeatException):
|
||||
msg_fmt = _("Circular Dependency Found: %(cycle)s")
|
||||
|
@ -15,11 +15,6 @@ import collections
|
||||
import itertools
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
||||
|
||||
class CircularDependencyException(exception.HeatException):
|
||||
msg_fmt = _("Circular Dependency Found: %(cycle)s")
|
||||
|
||||
|
||||
class Node(object):
|
||||
@ -163,7 +158,7 @@ class Graph(collections.defaultdict):
|
||||
else:
|
||||
# There are nodes remaining, but none without
|
||||
# dependencies: a cycle
|
||||
raise CircularDependencyException(cycle=str(graph))
|
||||
raise exception.CircularDependencyException(cycle=str(graph))
|
||||
|
||||
|
||||
class Dependencies(object):
|
||||
|
@ -11,7 +11,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine import dependencies
|
||||
from heat.tests import common
|
||||
|
||||
@ -124,7 +124,7 @@ class dependenciesTest(common.HeatTestCase):
|
||||
d = dependencies.Dependencies([('first', 'second'),
|
||||
('second', 'third'),
|
||||
('third', 'first')])
|
||||
self.assertRaises(dependencies.CircularDependencyException,
|
||||
self.assertRaises(exception.CircularDependencyException,
|
||||
list,
|
||||
iter(d))
|
||||
|
||||
@ -132,13 +132,13 @@ class dependenciesTest(common.HeatTestCase):
|
||||
d = dependencies.Dependencies([('first', 'second'),
|
||||
('second', 'third'),
|
||||
('third', 'first')])
|
||||
self.assertRaises(dependencies.CircularDependencyException,
|
||||
self.assertRaises(exception.CircularDependencyException,
|
||||
list,
|
||||
reversed(d))
|
||||
|
||||
def test_self_ref(self):
|
||||
d = dependencies.Dependencies([('node', 'node')])
|
||||
self.assertRaises(dependencies.CircularDependencyException,
|
||||
self.assertRaises(exception.CircularDependencyException,
|
||||
list,
|
||||
iter(d))
|
||||
|
||||
@ -147,7 +147,7 @@ class dependenciesTest(common.HeatTestCase):
|
||||
('last', 'mid2'), ('mid1', 'e2'),
|
||||
('mid1', 'mid3'), ('mid2', 'mid3'),
|
||||
('mid3', 'e3'), ('e3', 'mid1')])
|
||||
self.assertRaises(dependencies.CircularDependencyException,
|
||||
self.assertRaises(exception.CircularDependencyException,
|
||||
list,
|
||||
iter(d))
|
||||
|
||||
@ -156,7 +156,7 @@ class dependenciesTest(common.HeatTestCase):
|
||||
('last', 'mid2'), ('mid1', 'e2'),
|
||||
('mid1', 'mid3'), ('mid2', 'mid3'),
|
||||
('mid3', 'e3'), ('e3', 'mid1')])
|
||||
self.assertRaises(dependencies.CircularDependencyException,
|
||||
self.assertRaises(exception.CircularDependencyException,
|
||||
list,
|
||||
reversed(d))
|
||||
|
||||
|
@ -17,6 +17,7 @@ from unittest import mock
|
||||
|
||||
import eventlet
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import timeutils
|
||||
from heat.engine import dependencies
|
||||
from heat.engine import scheduler
|
||||
@ -259,7 +260,7 @@ class DependencyTaskGroupTest(common.HeatTestCase):
|
||||
d = dependencies.Dependencies([('first', 'second'),
|
||||
('second', 'third'),
|
||||
('third', 'first')])
|
||||
self.assertRaises(dependencies.CircularDependencyException,
|
||||
self.assertRaises(exception.CircularDependencyException,
|
||||
scheduler.DependencyTaskGroup, d)
|
||||
|
||||
def test_aggregate_exceptions_raises_all_at_the_end(self):
|
||||
|
@ -21,7 +21,6 @@ from heat.common.i18n import _
|
||||
from heat.common import template_format
|
||||
from heat.common import urlfetch
|
||||
from heat.engine.clients.os import glance
|
||||
from heat.engine import dependencies
|
||||
from heat.engine import environment
|
||||
from heat.engine.hot import template as hot_tmpl
|
||||
from heat.engine import resources
|
||||
@ -2001,7 +2000,7 @@ parameter_groups:
|
||||
exc = self.assertRaises(dispatcher.ExpectedException,
|
||||
self.engine.validate_template,
|
||||
self.ctx, t, {})
|
||||
self.assertEqual(dependencies.CircularDependencyException,
|
||||
self.assertEqual(exception.CircularDependencyException,
|
||||
exc.exc_info[0])
|
||||
|
||||
def test_validate_hot_parameter_tags_older(self):
|
||||
|
Loading…
Reference in New Issue
Block a user