From bcd35e090c6a1daa4b8a750db4c98063d5281940 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dato=20Sim=C3=B3?= <dato@google.com>
Date: Mon, 5 Nov 2012 17:54:59 +0000
Subject: [PATCH] cli.py: use None as name for tag operations on the cluster
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This change is mostly cosmetic. Previously, the literal "cluster" was
used for the 'name' field of tag operations on the cluster (as opposed
to a node or an instance). Since this field has a type of TMaybeString
specifically for the case of the cluster, it seems more correct to use
None, rather than an arbitrary string (that is not used by the callee).

Additionally: note in opcodes.py that groups also expect a name; the
previous comment only referred to nodes and instances.

Signed-off-by: Dato SimΓ³ <dato@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cli.py     | 2 +-
 lib/opcodes.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index c1b3e2453..dae3bf7e5 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -412,7 +412,7 @@ def _ExtractTagsObject(opts, args):
     raise errors.ProgrammerError("tag_type not passed to _ExtractTagsObject")
   kind = opts.tag_type
   if kind == constants.TAG_CLUSTER:
-    retval = kind, kind
+    retval = kind, None
   elif kind in (constants.TAG_NODEGROUP,
                 constants.TAG_NODE,
                 constants.TAG_INSTANCE):
diff --git a/lib/opcodes.py b/lib/opcodes.py
index 2da68ce06..5bdf85e95 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -1815,7 +1815,7 @@ class OpTagsSet(OpCode):
   OP_PARAMS = [
     _PTagKind,
     _PTags,
-    # Name is only meaningful for nodes and instances
+    # Name is only meaningful for groups, nodes and instances
     ("name", ht.NoDefault, ht.TMaybeString,
      "Name of object where tag(s) should be added"),
     ]
@@ -1827,7 +1827,7 @@ class OpTagsDel(OpCode):
   OP_PARAMS = [
     _PTagKind,
     _PTags,
-    # Name is only meaningful for nodes and instances
+    # Name is only meaningful for groups, nodes and instances
     ("name", ht.NoDefault, ht.TMaybeString,
      "Name of object where tag(s) should be deleted"),
     ]
-- 
GitLab