Skip to content

Commit 4019288

Browse files
authored
Merge pull request #1396 from liangxin1300/20240421_check_quick
Fix: healthcheck: Missing 'id_' prefix while checking the ssh key existence
2 parents 8c7f5ae + c924425 commit 4019288

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crmsh/healthcheck.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
import typing
88

9+
import crmsh.constants
910
import crmsh.parallax
1011
import crmsh.utils
1112

@@ -120,8 +121,8 @@ def __str__(self):
120121
def check_quick(self) -> bool:
121122
for key_type in self.KEY_TYPES:
122123
try:
123-
os.stat('{}/{}'.format(self.SSH_DIR, key_type))
124-
os.stat('{}/{}.pub'.format(self.SSH_DIR, key_type))
124+
os.stat('{}/id_{}'.format(self.SSH_DIR, key_type))
125+
os.stat('{}/id_{}.pub'.format(self.SSH_DIR, key_type))
125126
return True
126127
except FileNotFoundError:
127128
pass
@@ -131,7 +132,7 @@ def check_local(self, nodes: typing.Iterable[str]) -> bool:
131132
try:
132133
for node in nodes:
133134
subprocess.check_call(
134-
['sudo', 'su', '-', 'hacluster', '-c', 'ssh hacluster@{} true'.format(node)],
135+
['sudo', 'su', '-', 'hacluster', '-c', 'ssh {} hacluster@{} true'.format(crmsh.constants.SSH_OPTION, node)],
135136
stdin=subprocess.DEVNULL,
136137
stdout=subprocess.DEVNULL,
137138
stderr=subprocess.DEVNULL,

0 commit comments

Comments
 (0)