From 5d60b3bd4b31ada6c00d845d659d4938049b8635 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 6 Apr 2009 08:20:40 +0000
Subject: [PATCH] Add a new ssconf file with the cluster tags

Since the cluster tags are/should be more-or-less static, add them as an
ssconf key, so that querying them is possible without creating a
job/requiring the masterd to be running.

Reviewed-by: imsnah
---
 lib/config.py    | 2 ++
 lib/constants.py | 1 +
 lib/ssconf.py    | 1 +
 3 files changed, 4 insertions(+)

diff --git a/lib/config.py b/lib/config.py
index ee305d686..8917f4db8 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -1128,8 +1128,10 @@ class ConfigWriter:
     node_data = fn(node_names)
 
     cluster = self._config_data.cluster
+    cluster_tags = fn(cluster.GetTags())
     return {
       constants.SS_CLUSTER_NAME: cluster.cluster_name,
+      constants.SS_CLUSTER_TAGS: cluster_tags,
       constants.SS_FILE_STORAGE_DIR: cluster.file_storage_dir,
       constants.SS_MASTER_CANDIDATES: mc_data,
       constants.SS_MASTER_IP: cluster.master_ip,
diff --git a/lib/constants.py b/lib/constants.py
index a77544d0e..058f2dd62 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -458,6 +458,7 @@ MAX_DISKS = 16
 
 # SSCONF keys
 SS_CLUSTER_NAME = "cluster_name"
+SS_CLUSTER_TAGS = "cluster_tags"
 SS_FILE_STORAGE_DIR = "file_storage_dir"
 SS_MASTER_CANDIDATES = "master_candidates"
 SS_MASTER_IP = "master_ip"
diff --git a/lib/ssconf.py b/lib/ssconf.py
index a8a8968ff..cce1141f0 100644
--- a/lib/ssconf.py
+++ b/lib/ssconf.py
@@ -126,6 +126,7 @@ class SimpleStore(object):
   _SS_FILEPREFIX = "ssconf_"
   _VALID_KEYS = (
     constants.SS_CLUSTER_NAME,
+    constants.SS_CLUSTER_TAGS,
     constants.SS_FILE_STORAGE_DIR,
     constants.SS_MASTER_CANDIDATES,
     constants.SS_MASTER_IP,
-- 
GitLab