Commit 6915bc28 authored by Guido Trotter's avatar Guido Trotter
Browse files

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: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 691dfed9
......@@ -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
......
......@@ -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)
......
......@@ -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.
......
......@@ -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()
......
......@@ -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__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment