Revision 7688d0d3 lib/ssh.py
b/lib/ssh.py | ||
---|---|---|
30 | 30 |
from ganeti import utils |
31 | 31 |
from ganeti import errors |
32 | 32 |
from ganeti import constants |
33 |
from ganeti import ssconf |
|
34 | 33 |
|
35 | 34 |
|
36 | 35 |
def GetUserFiles(user, mkdir=False): |
... | ... | |
72 | 71 |
"""Wrapper for SSH commands. |
73 | 72 |
|
74 | 73 |
""" |
75 |
def __init__(self, sstore=None): |
|
76 |
if sstore is None: |
|
77 |
self.sstore = ssconf.SimpleStore() |
|
78 |
else: |
|
79 |
self.sstore = sstore |
|
74 |
def __init__(self, cfg): |
|
75 |
self.cfg = cfg |
|
80 | 76 |
|
81 | 77 |
def _BuildSshOptions(self, batch, ask_key, use_cluster_key, |
82 | 78 |
strict_host_check): |
... | ... | |
88 | 84 |
] |
89 | 85 |
|
90 | 86 |
if use_cluster_key: |
91 |
options.append("-oHostKeyAlias=%s" % self.sstore.GetClusterName())
|
|
87 |
options.append("-oHostKeyAlias=%s" % self.cfg.GetClusterName())
|
|
92 | 88 |
|
93 | 89 |
# TODO: Too many boolean options, maybe convert them to more descriptive |
94 | 90 |
# constants. |
... | ... | |
224 | 220 |
return True, "host matches" |
225 | 221 |
|
226 | 222 |
|
227 |
def WriteKnownHostsFile(cfg, sstore, file_name):
|
|
223 |
def WriteKnownHostsFile(cfg, file_name): |
|
228 | 224 |
"""Writes the cluster-wide equally known_hosts file. |
229 | 225 |
|
230 | 226 |
""" |
231 | 227 |
utils.WriteFile(file_name, mode=0700, |
232 |
data="%s ssh-rsa %s\n" % (sstore.GetClusterName(),
|
|
228 |
data="%s ssh-rsa %s\n" % (cfg.GetClusterName(),
|
|
233 | 229 |
cfg.GetHostKey())) |
Also available in: Unified diff