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