]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #44205 from k0ste/wip-53488-pacific
authorYuri Weinstein <yweinste@redhat.com>
Wed, 2 Feb 2022 00:03:32 +0000 (16:03 -0800)
committerGitHub <noreply@github.com>
Wed, 2 Feb 2022 00:03:32 +0000 (16:03 -0800)
pacific: mgr/prometheus: define module options for standby

Reviewed-by: Adam King adking@redhat.com
1  2 
src/pybind/mgr/prometheus/module.py

index f8573b61cbaf3470b1cbb66eb7ebf7f49ecfe279,6e37037d51996b3db43e84b7d84fde8a9cd3bd07..83fe551a5350b27c6bf5b477acdd1f044dea20bd
@@@ -1622,39 -1420,11 +1622,42 @@@ class Module(MgrModule)
          self.log.info('Stopping engine...')
          self.shutdown_event.set()
  
 +    @CLIReadCommand('healthcheck history ls')
 +    def _list_healthchecks(self, format: Format = Format.plain) -> HandleCommandResult:
 +        """List all the healthchecks being tracked
 +
 +        The format options are parsed in ceph_argparse, before they get evaluated here so
 +        we can safely assume that what we have to process is valid. ceph_argparse will throw
 +        a ValueError if the cast to our Format class fails.
 +
 +        Args:
 +            format (Format, optional): output format. Defaults to Format.plain.
 +
 +        Returns:
 +            HandleCommandResult: return code, stdout and stderr returned to the caller
 +        """
 +
 +        out = ""
 +        if format == Format.plain:
 +            out = str(self.health_history)
 +        elif format == Format.yaml:
 +            out = self.health_history.as_yaml()
 +        else:
 +            out = self.health_history.as_json(format == Format.json_pretty)
 +
 +        return HandleCommandResult(retval=0, stdout=out)
 +
 +    @CLIWriteCommand('healthcheck history clear')
 +    def _clear_healthchecks(self) -> HandleCommandResult:
 +        """Clear the healthcheck history"""
 +        self.health_history.reset()
 +        return HandleCommandResult(retval=0, stdout="healthcheck history cleared")
 +
  
  class StandbyModule(MgrStandbyModule):
+     MODULE_OPTIONS = Module.MODULE_OPTIONS
      def __init__(self, *args: Any, **kwargs: Any) -> None:
          super(StandbyModule, self).__init__(*args, **kwargs)
          self.shutdown_event = threading.Event()