Merge "Passing in the path to known_hosts explicity"

This commit is contained in:
Lennart Regebro 2015-09-03 15:18:42 +02:00 committed by Gerrit Code Review
commit 81fa08ca2a
2 changed files with 5 additions and 2 deletions

View File

@ -14,6 +14,7 @@
#
import mock
import os.path
from rdomanager_oscplugin import utils
from unittest import TestCase
@ -325,8 +326,10 @@ class TestWaitForDiscovery(TestCase):
mock_exists.return_value = True
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('os.path.exists')

View File

@ -362,7 +362,7 @@ def remove_known_hosts(overcloud_ip):
known_hosts = os.path.expanduser("~/.ssh/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)