cmdlib: Don't sort list of nodes if names are given
authorMichael Hanselmann <hansmi@google.com>
Mon, 6 Dec 2010 18:46:55 +0000 (19:46 +0100)
committerMichael Hanselmann <hansmi@google.com>
Mon, 6 Dec 2010 21:22:30 +0000 (22:22 +0100)
This makes _GetWantedNodes consistent wit _GetWantedInstances.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Adeodato Simo <dato@google.com>

lib/cmdlib.py

index ab8cf39..f0b6dba 100644 (file)
@@ -577,12 +577,10 @@ def _GetWantedNodes(lu, nodes):
   @raise errors.ProgrammerError: if the nodes parameter is wrong type
 
   """
-  if not nodes:
-    raise errors.ProgrammerError("_GetWantedNodes should only be called with a"
-      " non-empty list of nodes whose name is to be expanded.")
+  if nodes:
+    return [_ExpandNodeName(lu.cfg, name) for name in nodes]
 
-  wanted = [_ExpandNodeName(lu.cfg, name) for name in nodes]
-  return utils.NiceSort(wanted)
+  return utils.NiceSort(lu.cfg.GetNodeList())
 
 
 def _GetWantedInstances(lu, instances):