(
self,
args: List[str],
timeout: int = 10,
stdin: Optional[bytes] = None
)
| 1992 | self._ceph_send_command(result, svc_type, svc_id, command, tag, inbuf, one_shot=one_shot) |
| 1993 | |
| 1994 | def tool_exec( |
| 1995 | self, |
| 1996 | args: List[str], |
| 1997 | timeout: int = 10, |
| 1998 | stdin: Optional[bytes] = None |
| 1999 | ) -> Tuple[int, str, str]: |
| 2000 | try: |
| 2001 | tool = args.pop(0) |
| 2002 | cmd = [ |
| 2003 | tool, |
| 2004 | '-k', str(self.get_ceph_option('keyring')), |
| 2005 | '-n', f'mgr.{self.get_mgr_id()}', |
| 2006 | ] + args |
| 2007 | self.log.debug('exec: ' + ' '.join(cmd)) |
| 2008 | p = subprocess.run( |
| 2009 | cmd, |
| 2010 | input=stdin, |
| 2011 | stdout=subprocess.PIPE, |
| 2012 | stderr=subprocess.PIPE, |
| 2013 | timeout=timeout, |
| 2014 | ) |
| 2015 | except subprocess.TimeoutExpired as ex: |
| 2016 | self.log.error(ex) |
| 2017 | return -errno.ETIMEDOUT, '', str(ex) |
| 2018 | if p.returncode: |
| 2019 | self.log.error(f'Non-zero return from {cmd}: {p.stderr.decode()}') |
| 2020 | return p.returncode, p.stdout.decode(), p.stderr.decode() |
| 2021 | |
| 2022 | def set_health_checks(self, checks: HealthChecksT) -> None: |
| 2023 | """ |
nothing calls this directly
no test coverage detected