You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2014/02/24 12:44:42 UTC
git commit: AMBARI-4799. RMF. Lazy failing on wrong configuration
access is broken (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/trunk a2a34fa8a -> a83ebae7c
AMBARI-4799. RMF. Lazy failing on wrong configuration access is broken
(aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a83ebae7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a83ebae7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a83ebae7
Branch: refs/heads/trunk
Commit: a83ebae7c115e0219ead99f6c950188c538b293e
Parents: a2a34fa
Author: Andrew Onischuk <ao...@hortonworks.com>
Authored: Mon Feb 24 03:44:01 2014 -0800
Committer: Andrew Onischuk <ao...@hortonworks.com>
Committed: Mon Feb 24 03:44:01 2014 -0800
----------------------------------------------------------------------
.../libraries/script/config_dictionary.py | 4 +---
.../src/test/python/stacks/utils/RMFTestCase.py | 12 ++++++++----
2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a83ebae7/ambari-agent/src/main/python/resource_management/libraries/script/config_dictionary.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/script/config_dictionary.py b/ambari-agent/src/main/python/resource_management/libraries/script/config_dictionary.py
index ab94d60..453c546 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/script/config_dictionary.py
+++ b/ambari-agent/src/main/python/resource_management/libraries/script/config_dictionary.py
@@ -72,9 +72,7 @@ class UnknownConfiguration():
self.name = name
def __getattr__(self, name):
-# raise Fail("Configuration parameter '"+self.name+"' was not found in
-# configurations dictionary!")
- pass
+ raise Fail("Configuration parameter '"+self.name+"' was not found in configurations dictionary!")
def __getitem__(self, name):
"""
http://git-wip-us.apache.org/repos/asf/ambari/blob/a83ebae7/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
index 2bc7430..b5adcbd 100644
--- a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
+++ b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
@@ -134,10 +134,11 @@ class RMFTestCase(TestCase):
print
def assertResourceCalled(self, resource_type, name, **kwargs):
- resource = RMFTestCase.env.resource_list.pop(0)
- self.assertEquals(resource_type, resource.__class__.__name__)
- self.assertEquals(name, resource.name)
- self.assertEquals(kwargs, resource.arguments)
+ with patch.object(UnknownConfiguration, '__getattr__', return_value=lambda: "UnknownConfiguration()"):
+ resource = RMFTestCase.env.resource_list.pop(0)
+ self.assertEquals(resource_type, resource.__class__.__name__)
+ self.assertEquals(name, resource.name)
+ self.assertEquals(kwargs, resource.arguments)
def assertNoMoreResources(self):
self.assertEquals(len(RMFTestCase.env.resource_list), 0, "There was other resources executed!")
@@ -170,4 +171,7 @@ class UnknownConfigurationMock():
def __ne__(self, other):
return not self.__eq__(other)
+
+ def __repr__(self):
+ return "UnknownConfigurationMock()"