1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 """C{testssh}
19
20 Determines if ssh connectivity to a cluster is working.
21 Can only be run against a cluster, e.g. C{osh @mycluster [ testssh ] $}.
22
23 ssh is configured correctly if each node name is printed, along with the output
24 from the test command, C{hello}, for example::
25
26 ('115', 'hello')
27 ('116', 'hello')
28 ('117', 'hello')
29
30 If your ssh agent is set up properly, then you may see some additional
31 output the first time you contact a cluster, e.g.
32 C{Warning: Permanently added '192.168.140.115' (RSA) to the list of known hosts.}
33 """
34
35 import os
36
37 import osh.args
38 import osh.core
39 from osh.util import ssh, remove_crlf
40 from osh.error import stderr_handler
41
42
45
46
48 """Determines if ssh connectivity to a cluster is working.
49 Can only be run against a cluster, e.g. C{osh(remote('mycluster', testssh()), out())}.
50 ssh is configured correctly if each node name is printed, along with the output
51 from the test command, C{hello}, e.g. C{('115', 'hello'), ('116', 'hello'),
52 ('117', 'hello')}.
53 If your ssh agent is set up properly, then you may see some additional
54 output the first time you contact a cluster, e.g. C{Warning:
55 Permanently added '192.168.140.115' (RSA) to the list of known hosts.}
56 """
57 return _TestSSH().process_args()
58
60
61
62
65
66
67
70
73
74
75
77 host = self.thread_state
78 output, errors = ssh(host.user, host.identity, host.address, 'echo hello')
79 for line in output:
80 self.send(remove_crlf(line))
81 for line in errors:
82 stderr_handler(line, self, None)
83