From 6915bc28fe053e92aa16cf2d974d205f1140219c Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Fri, 9 Oct 2009 14:31:27 +0100
Subject: [PATCH] Get rid of utils.CommaJoin

- We never remember to use it (5 uses vs 21 " ,".join())
- It's longer to write than " ,".join()
- The added value of the apostrophe in the string is not very much

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cmdlib.py             |  3 +--
 lib/hypervisor/hv_base.py |  2 +-
 lib/utils.py              | 10 ----------
 scripts/gnt-node          |  3 +--
 test/docs_unittest.py     |  4 ++--
 5 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 98c00bd90..0023cac61 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -1935,8 +1935,7 @@ class LUSetClusterParams(LogicalUnit):
       invalid_hvs = set(self.hv_list) - constants.HYPER_TYPES
       if invalid_hvs:
         raise errors.OpPrereqError("Enabled hypervisors contains invalid"
-                                   " entries: %s" %
-                                   utils.CommaJoin(invalid_hvs))
+                                   " entries: %s" % " ,".join(invalid_hvs))
     else:
       self.hv_list = cluster.enabled_hypervisors
 
diff --git a/lib/hypervisor/hv_base.py b/lib/hypervisor/hv_base.py
index 3b06da6e5..4eaade63f 100644
--- a/lib/hypervisor/hv_base.py
+++ b/lib/hypervisor/hv_base.py
@@ -80,7 +80,7 @@ def ParamInSet(required, my_set):
 
   """
   fn = lambda x: x in my_set
-  err = ("The value must be one of: %s" % utils.CommaJoin(my_set))
+  err = ("The value must be one of: %s" % " ,".join(my_set))
   return (required, fn, err, None, None)
 
 
diff --git a/lib/utils.py b/lib/utils.py
index 186f14ee3..56d01087d 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -1859,16 +1859,6 @@ def SafeEncode(text):
   return resu
 
 
-def CommaJoin(names):
-  """Nicely join a set of identifiers.
-
-  @param names: set, list or tuple
-  @return: a string with the formatted results
-
-  """
-  return ", ".join(["'%s'" % val for val in names])
-
-
 def BytesToMebibyte(value):
   """Converts bytes to mebibytes.
 
diff --git a/scripts/gnt-node b/scripts/gnt-node
index a7334dbeb..3c801ed63 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -72,8 +72,7 @@ _STORAGE_TYPE_OPT = \
              choices=_USER_STORAGE_TYPE.keys(),
              default=None,
              metavar="STORAGE_TYPE",
-             help=("Storage type (%s)" %
-                   utils.CommaJoin(_USER_STORAGE_TYPE.keys())))
+             help=("Storage type (%s)" % " ,".join(_USER_STORAGE_TYPE.keys())))
 
 _REPAIRABLE_STORAGE_TYPES = \
   [st for st, so in constants.VALID_STORAGE_OPERATIONS.iteritems()
diff --git a/test/docs_unittest.py b/test/docs_unittest.py
index d69066f4a..6e66748c7 100755
--- a/test/docs_unittest.py
+++ b/test/docs_unittest.py
@@ -114,7 +114,7 @@ class TestDocs(unittest.TestCase):
 
     self.failIf(undocumented,
                 msg=("Missing RAPI resource documentation for %s" %
-                     utils.CommaJoin(undocumented)))
+                     " ,".join(undocumented)))
 
 
 class TestManpages(unittest.TestCase):
@@ -145,7 +145,7 @@ class TestManpages(unittest.TestCase):
 
     self.failIf(missing,
                 msg=("Manpage for '%s' missing documentation for %s" %
-                     (script, utils.CommaJoin(missing))))
+                     (script, " ,".join(missing))))
 
 
 if __name__ == "__main__":
-- 
GitLab