root / qa / qa_other.py @ 973d7867
History | View | Annotate | Download (1.3 kB)
1 |
# Copyright (C) 2007 Google Inc.
|
---|---|
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
4 |
# it under the terms of the GNU General Public License as published by
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
6 |
# (at your option) any later version.
|
7 |
#
|
8 |
# This program is distributed in the hope that it will be useful, but
|
9 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11 |
# General Public License for more details.
|
12 |
#
|
13 |
# You should have received a copy of the GNU General Public License
|
14 |
# along with this program; if not, write to the Free Software
|
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
16 |
# 02110-1301, USA.
|
17 |
|
18 |
|
19 |
from ganeti import utils |
20 |
from ganeti import constants |
21 |
|
22 |
import qa_config |
23 |
import qa_utils |
24 |
|
25 |
from qa_utils import AssertEqual, StartSSH |
26 |
|
27 |
|
28 |
def UploadKnownHostsFile(localpath): |
29 |
"""Uploading known_hosts file.
|
30 |
|
31 |
"""
|
32 |
master = qa_config.GetMasterNode() |
33 |
|
34 |
tmpfile = qa_utils.UploadFile(master['primary'], localpath)
|
35 |
try:
|
36 |
cmd = ['mv', tmpfile, constants.SSH_KNOWN_HOSTS_FILE]
|
37 |
AssertEqual(StartSSH(master['primary'],
|
38 |
utils.ShellQuoteArgs(cmd)).wait(), 0)
|
39 |
except:
|
40 |
cmd = ['rm', '-f', tmpfile] |
41 |
AssertEqual(StartSSH(master['primary'],
|
42 |
utils.ShellQuoteArgs(cmd)).wait(), 0)
|
43 |
raise
|