Skip to content

Commit

Permalink
Merge pull request #618 from cvaroqui/enh-collector-tag
Browse files Browse the repository at this point in the history
Enh collector tag
  • Loading branch information
cvaroqui committed Jun 7, 2023
2 parents 1e34ada + 5f5afa4 commit bee354c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions opensvc/commands/node/parser.py
Expand Up @@ -294,6 +294,10 @@
"--tag", default=None,
action="store", dest="tag",
help="The tag name, as shown by :cmd:`om node collector list tags`."),
"tag_attach_data": Option(
"--tag-attach-data", default=None,
action="store", dest="tag_attach_data",
help="The data stored with the tag attachment. Typed tags, like <name>::<type> expect a particular data structure."),
"target": Option(
"--target", default=None, action="store", dest="target",
help="Specify a target to scan for new block devices. Example: "
Expand Down Expand Up @@ -985,6 +989,7 @@
"msg": "Set a node tag (pointed by --tag).",
"options": [
OPT.tag,
OPT.tag_attach_data,
],
},
"collector_untag": {
Expand Down
5 changes: 5 additions & 0 deletions opensvc/core/collector/actions.py
Expand Up @@ -225,17 +225,22 @@ def collector_untag(self):
raise ex.Error("xmlrpc unknown failure")
if d['ret'] != 0:
raise ex.Error(d['msg'])
elif d.get("msg"):
print(d.get("msg"))

def collector_tag(self):
opts = {}
opts['tag_name'] = self.options.tag
opts['tag_attach_data'] = self.options.tag_attach_data
if self.path:
opts['svcname'] = self.path
d = self.collector.call('collector_tag', opts)
if d is None:
raise ex.Error("xmlrpc unknown failure")
if d['ret'] != 0:
raise ex.Error(d['msg'])
elif d.get("msg"):
print(d.get("msg"))

def collector_create_tag(self):
opts = {}
Expand Down
2 changes: 2 additions & 0 deletions opensvc/core/extconfig.py
Expand Up @@ -628,6 +628,8 @@ def handle_reference(self, ref, scope=False, impersonate=None, cd=None,
val = self.node.cluster_name
else:
val = self.cluster_name
elif _ref == "dns_janitor_major":
val = "1"
elif _ref == "fqdn":
if has_node:
ns = "root" if self.namespace is None else self.namespace
Expand Down

0 comments on commit bee354c

Please sign in to comment.