From 2029fe3faefaa39953bbd3ea298b1c3e7d1ad489 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 5 Feb 2013 16:22:42 +0100
Subject: [PATCH] QA: Support entity objects in qa_utils._GetName

This is a temporary solution until nodes and instances are converted to
objects with attributes.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
---
 qa/qa_utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qa/qa_utils.py b/qa/qa_utils.py
index baacdebdc..0b3854d2e 100644
--- a/qa/qa_utils.py
+++ b/qa/qa_utils.py
@@ -139,7 +139,7 @@ def _GetName(entity, key):
   """
   if isinstance(entity, basestring):
     result = entity
-  elif isinstance(entity, dict):
+  elif isinstance(entity, dict) or hasattr(entity, "__getitem__"):
     result = entity[key]
   else:
     raise qa_error.Error("Expected string or dictionary, got %s: %s" %
-- 
GitLab