Merge "Passing in the path to known_hosts explicity"
This commit is contained in:
commit
81fa08ca2a
|
@ -14,6 +14,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import os.path
|
||||||
|
|
||||||
from rdomanager_oscplugin import utils
|
from rdomanager_oscplugin import utils
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
@ -325,8 +326,10 @@ class TestWaitForDiscovery(TestCase):
|
||||||
mock_exists.return_value = True
|
mock_exists.return_value = True
|
||||||
|
|
||||||
utils.remove_known_hosts('192.168.0.1')
|
utils.remove_known_hosts('192.168.0.1')
|
||||||
|
known_hosts = os.path.expanduser("~/.ssh/known_hosts")
|
||||||
|
|
||||||
mock_check_call.assert_called_with(['ssh-keygen', '-R', '192.168.0.1'])
|
mock_check_call.assert_called_with(
|
||||||
|
['ssh-keygen', '-R', '192.168.0.1', '-f', known_hosts])
|
||||||
|
|
||||||
@mock.patch('subprocess.check_call')
|
@mock.patch('subprocess.check_call')
|
||||||
@mock.patch('os.path.exists')
|
@mock.patch('os.path.exists')
|
||||||
|
|
|
@ -362,7 +362,7 @@ def remove_known_hosts(overcloud_ip):
|
||||||
known_hosts = os.path.expanduser("~/.ssh/known_hosts")
|
known_hosts = os.path.expanduser("~/.ssh/known_hosts")
|
||||||
|
|
||||||
if os.path.exists(known_hosts):
|
if os.path.exists(known_hosts):
|
||||||
command = ['ssh-keygen', '-R', overcloud_ip]
|
command = ['ssh-keygen', '-R', overcloud_ip, '-f', known_hosts]
|
||||||
subprocess.check_call(command)
|
subprocess.check_call(command)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue