From 47aa6ec97e74c952b20236a5567683aa58961de2 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Wed, 6 Feb 2013 12:40:52 +0100
Subject: [PATCH] QA: Add validation for cluster name

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
---
 qa/qa_config.py                  | 3 +++
 test/py/qa.qa_config_unittest.py | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/qa/qa_config.py b/qa/qa_config.py
index 1ff1dd115..d879d2df3 100644
--- a/qa/qa_config.py
+++ b/qa/qa_config.py
@@ -245,6 +245,9 @@ class _QaConfig(object):
     """Validates loaded configuration data.
 
     """
+    if not self.get("name"):
+      raise qa_error.Error("Cluster name is required")
+
     if not self.get("nodes"):
       raise qa_error.Error("Need at least one node")
 
diff --git a/test/py/qa.qa_config_unittest.py b/test/py/qa.qa_config_unittest.py
index 70b59659e..b3e4b58c3 100755
--- a/test/py/qa.qa_config_unittest.py
+++ b/test/py/qa.qa_config_unittest.py
@@ -174,6 +174,11 @@ class TestQaConfigLoad(unittest.TestCase):
 
     check_fn = compat.partial(self._CheckLoadError, filename, testconfig)
 
+    # No cluster name
+    check_fn("Cluster name is required")
+
+    testconfig["name"] = "cluster.example.com"
+
     # No nodes
     check_fn("Need at least one node")
 
-- 
GitLab