Skip to content

Commit

Permalink
Merge pull request #631 from cvaroqui/dblogcron
Browse files Browse the repository at this point in the history
Add a dblogcron kw
  • Loading branch information
cvaroqui committed Sep 22, 2023
2 parents 20866ec + 19ff38b commit c50d4d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion opensvc/core/node/nodedict.py
Expand Up @@ -420,7 +420,14 @@
"keyword": "dblog",
"convert": "boolean",
"default": True,
"text": "If true and dbopensvc is set, the objects action logs are reported to the collector. Set to false to disable log reporting to the collector, event if dbopensvc is set."
"text": "If true and dbopensvc is set, the objects action logs are reported to the collector. Set to false to disable log reporting to the collector, even if dbopensvc is set."
},
{
"section": "node",
"keyword": "dblogcron",
"convert": "boolean",
"default": True,
"text": "If true and dbopensvc is set, the objects croned action logs are reported to the collector. Set to false to disable croned actions log reporting to the collector."
},
{
"section": "node",
Expand Down
9 changes: 8 additions & 1 deletion opensvc/core/objects/svc.py
Expand Up @@ -1010,8 +1010,15 @@ def _action(self, action, options=None):
action.startswith("json_"):
return self.do_print_action(action, options)

if self.published_action(action, options):
def is_logged_action():
if self.options.cron and not self.node.oget("node", "dblogcron"):
return False
if self.node.oget("node", "dblog") and self.node.collector_env.dbopensvc and self.node.collector_env.uuid:
return True
return False

if self.published_action(action, options):
if is_logged_action():
err = self.do_logged_action(action, options)
else:
self.log_action_header(action, options)
Expand Down

0 comments on commit c50d4d3

Please sign in to comment.