Currently, RAPI uses queries (as in QueryNode with field tags) for
getting the tags, whereas the CLI uses the QueryTags Luxi
command. Since this discrepancy is not good, let's switch RAPI to use
the same method as the CLI.
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
raise http.HttpBadRequest("Missing name on tag request")
cl = self.GetClient()
- if kind == constants.TAG_INSTANCE:
- fn = cl.QueryInstances
- elif kind == constants.TAG_NODEGROUP:
- fn = cl.QueryGroups
- else:
- fn = cl.QueryNodes
- result = fn(names=[self.name], fields=["tags"], use_locking=False)
- if not result or not result[0]:
- raise http.HttpBadGateway("Invalid response from tag query")
- tags = result[0][0]
+ tags = list(cl.QueryTags(kind, self.name))
elif kind == constants.TAG_CLUSTER:
assert not self.name