summaryrefslogtreecommitdiffstats
path: root/snaps/domain
diff options
context:
space:
mode:
authorSteven Pisarski <s.pisarski@cablelabs.com>2017-11-06 15:04:22 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-11-06 15:04:22 +0000
commit15b7270542288263189abebcfa4f89c0245aaf8b (patch)
treeaa1514f2d958747ff637218c97f775a3590f8b51 /snaps/domain
parent092d58de391b9f8523e87142ffc60e040796607d (diff)
parent76c96d0c7095978e5d51ead79f1a85eff46b4143 (diff)
Merge "Added logging when a heat stack fails."
Diffstat (limited to 'snaps/domain')
-rw-r--r--snaps/domain/stack.py11
-rw-r--r--snaps/domain/test/stack_tests.py12
2 files changed, 19 insertions, 4 deletions
diff --git a/snaps/domain/stack.py b/snaps/domain/stack.py
index 543c78b..080ab17 100644
--- a/snaps/domain/stack.py
+++ b/snaps/domain/stack.py
@@ -37,14 +37,21 @@ class Resource:
"""
SNAPS domain object for a resource created by a heat template
"""
- def __init__(self, resource_type, resource_id):
+ def __init__(self, name, resource_type, resource_id, status,
+ status_reason):
"""
Constructor
- :param resource_type: the type
+ :param name: the resource's name
+ :param resource_type: the resource's type
:param resource_id: the ID attached to the resource of the given type
+ :param status: the resource's status code
+ :param status_reason: the resource's status code reason
"""
+ self.name = name
self.type = resource_type
self.id = resource_id
+ self.status = status
+ self.status_reason = status_reason
class Output:
diff --git a/snaps/domain/test/stack_tests.py b/snaps/domain/test/stack_tests.py
index f816ef8..21e31d2 100644
--- a/snaps/domain/test/stack_tests.py
+++ b/snaps/domain/test/stack_tests.py
@@ -39,14 +39,22 @@ class ResourceDomainObjectTests(unittest.TestCase):
"""
def test_construction_positional(self):
- resource = Resource('foo', 'bar')
+ resource = Resource('res_name', 'foo', 'bar', 'status', 'reason')
+ self.assertEqual('res_name', resource.name)
self.assertEqual('foo', resource.type)
self.assertEqual('bar', resource.id)
+ self.assertEqual('status', resource.status)
+ self.assertEqual('reason', resource.status_reason)
def test_construction_named(self):
- resource = Resource(resource_id='bar', resource_type='foo')
+ resource = Resource(
+ status_reason=None, status=None, resource_id='bar',
+ resource_type='foo', name='res_name')
+ self.assertEqual('res_name', resource.name)
self.assertEqual('foo', resource.type)
self.assertEqual('bar', resource.id)
+ self.assertIsNone(resource.status)
+ self.assertIsNone(resource.status_reason)
class OutputDomainObjectTests(unittest.TestCase):