Updated Branches: refs/heads/trunk cedc67afb -> 0c42fd853
AMBARI-3365. Ambari-Client 'index out of range' when trying to get configs, while they are not present. (Andrew Onischuk via mahadev) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/0c42fd85 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/0c42fd85 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/0c42fd85 Branch: refs/heads/trunk Commit: 0c42fd8538048b45ed7318c1102ac9b3485cd3f0 Parents: cedc67a Author: Mahadev Konar <[email protected]> Authored: Thu Oct 3 22:17:48 2013 -0700 Committer: Mahadev Konar <[email protected]> Committed: Thu Oct 3 22:17:48 2013 -0700 ---------------------------------------------------------------------- .../src/main/python/ambari_client/model/configuration.py | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0c42fd85/ambari-client/src/main/python/ambari_client/model/configuration.py ---------------------------------------------------------------------- diff --git a/ambari-client/src/main/python/ambari_client/model/configuration.py b/ambari-client/src/main/python/ambari_client/model/configuration.py index 222ce5c..fcdcca1 100755 --- a/ambari-client/src/main/python/ambari_client/model/configuration.py +++ b/ambari-client/src/main/python/ambari_client/model/configuration.py @@ -31,6 +31,10 @@ def _get_configuration(resource_root, cluster_name , type , tag="version1"): @return: A ConfigModel object """ dic = resource_root.get(paths.CONFIGURATION_PATH % (cluster_name, type, tag)) + + if len(dic["items"]) == 0: + return None + config_model = utils.ModelUtils.create_model(ConfigModel , dic["items"][0], resource_root, "NO_KEY") ref_clss = utils.getREF_class_name("cluster_name") config_model._setattr(ref_clss, dic["items"][0]['Config']['cluster_name'])
