mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 08:21:05 -06:00
ipa-replica-conncheck: handle ssh not installed
When ipa-replica-conncheck is run but ssh is not installed, the tool exits with a stack trace. Properly handle the error by raising an Exception in the SshExec constructor, and catch the exception in order to ignore the error and skip ssh test. The tool will exit with the following output: [...] Check RPC connection to remote master trying https://master.domain.com/ipa/session/json Forwarding 'schema' to json server 'https://master.domain.com/ipa/session/json' Retrying using SSH... WARNING: ssh not installed, skipping ssh test https://pagure.io/freeipa/issue/6935 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
parent
7eb02a49ed
commit
f960450820
@ -59,12 +59,11 @@ class SshExec(object):
|
|||||||
self.user = user
|
self.user = user
|
||||||
self.addr = addr
|
self.addr = addr
|
||||||
self.cmd = distutils.spawn.find_executable('ssh')
|
self.cmd = distutils.spawn.find_executable('ssh')
|
||||||
|
|
||||||
def __call__(self, command, verbose=False):
|
|
||||||
# Bail if ssh is not installed
|
# Bail if ssh is not installed
|
||||||
if self.cmd is None:
|
if self.cmd is None:
|
||||||
root_logger.warning("WARNING: ssh not installed, skipping ssh test")
|
raise RuntimeError("ssh not installed")
|
||||||
return ('', '', 0)
|
|
||||||
|
def __call__(self, command, verbose=False):
|
||||||
|
|
||||||
tmpf = tempfile.NamedTemporaryFile()
|
tmpf = tempfile.NamedTemporaryFile()
|
||||||
cmd = [
|
cmd = [
|
||||||
@ -596,7 +595,11 @@ def main():
|
|||||||
|
|
||||||
# Ticket 5812 Always qualify requests for admin
|
# Ticket 5812 Always qualify requests for admin
|
||||||
user = principal
|
user = principal
|
||||||
|
try:
|
||||||
ssh = SshExec(user, options.master)
|
ssh = SshExec(user, options.master)
|
||||||
|
except RuntimeError as e:
|
||||||
|
root_logger.warning("WARNING: %s, skipping ssh test" % e)
|
||||||
|
return 0
|
||||||
|
|
||||||
root_logger.info("Check SSH connection to remote master")
|
root_logger.info("Check SSH connection to remote master")
|
||||||
result = ssh('echo OK', verbose=True)
|
result = ssh('echo OK', verbose=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user