Adding flags to ssh cmd to bypass host checking
* Moved the ssh command to a central spot fixes bug 1100001 Change-Id: Ic055fe065a5d6ca8023bd15c4ef2a17e25970e50
This commit is contained in:
parent
3ddfd656d5
commit
e200bcbaab
@ -2,3 +2,4 @@ DBAAS_API = "dbaas.api"
|
|||||||
PRE_INSTANCES = "dbaas.api.pre_instances"
|
PRE_INSTANCES = "dbaas.api.pre_instances"
|
||||||
INSTANCES = "dbaas.api.instances"
|
INSTANCES = "dbaas.api.instances"
|
||||||
POST_INSTANCES = "dbaas.api.post_instances"
|
POST_INSTANCES = "dbaas.api.post_instances"
|
||||||
|
SSH_CMD = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
|
||||||
|
@ -216,18 +216,20 @@ class RebootTestBase(ActionTestBase):
|
|||||||
def mess_up_mysql(self):
|
def mess_up_mysql(self):
|
||||||
"""Ruin MySQL's ability to restart."""
|
"""Ruin MySQL's ability to restart."""
|
||||||
self.fix_mysql() # kill files
|
self.fix_mysql() # kill files
|
||||||
cmd = """ssh %s 'sudo cp /dev/null /var/lib/mysql/ib_logfile%d'"""
|
cmd = """%s %s 'sudo cp /dev/null /var/lib/mysql/ib_logfile%d'"""
|
||||||
for index in range(2):
|
for index in range(2):
|
||||||
full_cmd = cmd % (self.instance_address, index)
|
full_cmd = cmd % (tests.SSH_CMD, self.instance_address, index)
|
||||||
print("RUNNING COMMAND: %s" % full_cmd)
|
print("RUNNING COMMAND: %s" % full_cmd)
|
||||||
util.process(full_cmd)
|
util.process(full_cmd)
|
||||||
|
|
||||||
def fix_mysql(self):
|
def fix_mysql(self):
|
||||||
"""Fix MySQL's ability to restart."""
|
"""Fix MySQL's ability to restart."""
|
||||||
if not FAKE_MODE:
|
if not FAKE_MODE:
|
||||||
cmd = "ssh %s 'sudo rm /var/lib/mysql/ib_logfile%d'"
|
cmd = "%s %s 'sudo rm /var/lib/mysql/ib_logfile%d'"
|
||||||
for index in range(2):
|
for index in range(2):
|
||||||
util.process(cmd % (self.instance_address, index))
|
util.process(cmd % (tests.SSH_CMD,
|
||||||
|
self.instance_address,
|
||||||
|
index))
|
||||||
|
|
||||||
def wait_for_failure_status(self):
|
def wait_for_failure_status(self):
|
||||||
"""Wait until status becomes running."""
|
"""Wait until status becomes running."""
|
||||||
|
@ -55,6 +55,7 @@ from proboscis.asserts import ASSERTION_ERROR
|
|||||||
from proboscis import SkipTest
|
from proboscis import SkipTest
|
||||||
from reddwarfclient import Dbaas
|
from reddwarfclient import Dbaas
|
||||||
from reddwarfclient.client import ReddwarfHTTPClient
|
from reddwarfclient.client import ReddwarfHTTPClient
|
||||||
|
from reddwarf import tests
|
||||||
from reddwarf.tests.util import test_config as CONFIG
|
from reddwarf.tests.util import test_config as CONFIG
|
||||||
from reddwarf.tests.util.client import TestClient as TestClient
|
from reddwarf.tests.util.client import TestClient as TestClient
|
||||||
from reddwarf.tests.util.users import Requirements
|
from reddwarf.tests.util.users import Requirements
|
||||||
@ -232,8 +233,8 @@ def mysql_connection():
|
|||||||
|
|
||||||
def find_mysql_procid_on_instance(ip_address):
|
def find_mysql_procid_on_instance(ip_address):
|
||||||
"""Returns the process id of MySql on an instance if running, or None."""
|
"""Returns the process id of MySql on an instance if running, or None."""
|
||||||
cmd = "ssh %s ps aux | grep /usr/sbin/mysqld " \
|
cmd = "%s %s ps aux | grep /usr/sbin/mysqld " \
|
||||||
"| awk '{print $2}'" % ip_address
|
"| awk '{print $2}'" % (tests.SSH_CMD, ip_address)
|
||||||
stdout, stderr = process(cmd)
|
stdout, stderr = process(cmd)
|
||||||
try:
|
try:
|
||||||
return int(stdout)
|
return int(stdout)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import pexpect
|
import pexpect
|
||||||
import re
|
import re
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
|
from reddwarf import tests
|
||||||
from reddwarf.tests.config import CONFIG
|
from reddwarf.tests.config import CONFIG
|
||||||
from sqlalchemy.exc import OperationalError
|
from sqlalchemy.exc import OperationalError
|
||||||
try:
|
try:
|
||||||
@ -105,7 +106,7 @@ class PexpectMySqlConnection(object):
|
|||||||
self.host = host
|
self.host = host
|
||||||
self.user = user
|
self.user = user
|
||||||
self.password = password
|
self.password = password
|
||||||
cmd = 'ssh %s' % ssh_args
|
cmd = '%s %s' % (tests.SSH_CMD, ssh_args)
|
||||||
self.proc = pexpect.spawn(cmd)
|
self.proc = pexpect.spawn(cmd)
|
||||||
print(cmd)
|
print(cmd)
|
||||||
self.proc.expect(":~\$", timeout=self.TIME_OUT)
|
self.proc.expect(":~\$", timeout=self.TIME_OUT)
|
||||||
|
Loading…
Reference in New Issue
Block a user