summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2023-03-07 05:01:54 +0000
committerGerrit Code Review <review@openstack.org>2023-03-07 05:01:54 +0000
commit9063bd7121d1d6993077f2c5e46b9a444bf8ca2a (patch)
tree39220bef429ebeca62aace660732d722f5ab8103
parentac53891e85d76851ed628a541b414acd43fb0c7b (diff)
parentc253b38e210a82f3c1f0e4f0e07ac135ff0071e2 (diff)
downloadheat-9063bd7121d1d6993077f2c5e46b9a444bf8ca2a.tar.gz
Merge "Move CircularDependencyException to common"
-rw-r--r--heat/common/exception.py4
-rw-r--r--heat/engine/dependencies.py7
-rw-r--r--heat/tests/engine/test_dependencies.py12
-rw-r--r--heat/tests/engine/test_scheduler.py3
-rw-r--r--heat/tests/test_validate.py3
5 files changed, 14 insertions, 15 deletions
diff --git a/heat/common/exception.py b/heat/common/exception.py
index ecb809eb5..c4184a69b 100644
--- a/heat/common/exception.py
+++ b/heat/common/exception.py
@@ -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")
diff --git a/heat/engine/dependencies.py b/heat/engine/dependencies.py
index b61dd578c..f4d085f93 100644
--- a/heat/engine/dependencies.py
+++ b/heat/engine/dependencies.py
@@ -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):
diff --git a/heat/tests/engine/test_dependencies.py b/heat/tests/engine/test_dependencies.py
index 7643232d4..588cc96e8 100644
--- a/heat/tests/engine/test_dependencies.py
+++ b/heat/tests/engine/test_dependencies.py
@@ -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))
diff --git a/heat/tests/engine/test_scheduler.py b/heat/tests/engine/test_scheduler.py
index 112d810a1..894c43263 100644
--- a/heat/tests/engine/test_scheduler.py
+++ b/heat/tests/engine/test_scheduler.py
@@ -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):
diff --git a/heat/tests/test_validate.py b/heat/tests/test_validate.py
index a5521e435..f7a429cce 100644
--- a/heat/tests/test_validate.py
+++ b/heat/tests/test_validate.py
@@ -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):