Revision e8d61457 lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
1249 | 1249 |
|
1250 | 1250 |
""" |
1251 | 1251 |
master = self.cfg.GetMasterNode() |
1252 |
modify_ssh_setup = self.cfg.GetClusterInfo().modify_ssh_setup |
|
1253 | 1252 |
|
1254 | 1253 |
# Run post hooks on master node before it's removed |
1255 | 1254 |
hm = self.proc.hmclass(self.rpc.call_hooks_runner, self) |
... | ... | |
1262 | 1261 |
result = self.rpc.call_node_stop_master(master, False) |
1263 | 1262 |
result.Raise("Could not disable the master role") |
1264 | 1263 |
|
1265 |
if modify_ssh_setup: |
|
1266 |
priv_key, pub_key, _ = ssh.GetUserFiles(constants.GANETI_RUNAS) |
|
1267 |
utils.CreateBackup(priv_key) |
|
1268 |
utils.CreateBackup(pub_key) |
|
1269 |
|
|
1270 | 1264 |
return master |
1271 | 1265 |
|
1272 | 1266 |
|
... | ... | |
3828 | 3822 |
" node version %s" % |
3829 | 3823 |
(constants.PROTOCOL_VERSION, result.payload)) |
3830 | 3824 |
|
3831 |
# setup ssh on node |
|
3832 |
if self.cfg.GetClusterInfo().modify_ssh_setup: |
|
3833 |
logging.info("Copy ssh key to node %s", node) |
|
3834 |
priv_key, pub_key, _ = ssh.GetUserFiles(constants.GANETI_RUNAS) |
|
3835 |
keyarray = [] |
|
3836 |
keyfiles = [constants.SSH_HOST_DSA_PRIV, constants.SSH_HOST_DSA_PUB, |
|
3837 |
constants.SSH_HOST_RSA_PRIV, constants.SSH_HOST_RSA_PUB, |
|
3838 |
priv_key, pub_key] |
|
3839 |
|
|
3840 |
for i in keyfiles: |
|
3841 |
keyarray.append(utils.ReadFile(i)) |
|
3842 |
|
|
3843 |
result = self.rpc.call_node_add(node, keyarray[0], keyarray[1], |
|
3844 |
keyarray[2], keyarray[3], keyarray[4], |
|
3845 |
keyarray[5]) |
|
3846 |
result.Raise("Cannot transfer ssh keys to the new node") |
|
3847 |
|
|
3848 | 3825 |
# Add node to our /etc/hosts, and add key to known_hosts |
3849 | 3826 |
if self.cfg.GetClusterInfo().modify_etc_hosts: |
3850 | 3827 |
# FIXME: this should be done via an rpc call to node daemon |
Also available in: Unified diff