Remove unused parameter in setuserpassword plugin
Remove dead code from `_get_password` method. Change-Id: I3d3700cdde8bbaa528639cd71cbc288d35a40173
This commit is contained in:
@@ -49,7 +49,7 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
||||
if public_keys:
|
||||
return list(public_keys)[0]
|
||||
|
||||
def _get_password(self, service, osutils, shared_data):
|
||||
def _get_password(self, service, shared_data):
|
||||
if CONF.inject_user_password:
|
||||
password = service.get_admin_password()
|
||||
else:
|
||||
@@ -93,7 +93,7 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
||||
LOG.info('Updating password is not required.')
|
||||
return None
|
||||
|
||||
password = self._get_password(service, osutils, shared_data)
|
||||
password = self._get_password(service, shared_data)
|
||||
if not password:
|
||||
LOG.debug('Generating a random user password')
|
||||
maximum_length = osutils.get_maximum_password_length()
|
||||
|
||||
@@ -81,12 +81,10 @@ class SetUserPasswordPluginTests(unittest.TestCase):
|
||||
mock.sentinel.create_user_password)
|
||||
|
||||
mock_service = mock.MagicMock()
|
||||
mock_osutils = mock.MagicMock()
|
||||
mock_service.get_admin_password.return_value = expected_password
|
||||
|
||||
with testutils.ConfPatcher('inject_user_password', inject_password):
|
||||
response = self._setpassword_plugin._get_password(mock_service,
|
||||
mock_osutils,
|
||||
shared_data)
|
||||
if inject_password:
|
||||
mock_service.get_admin_password.assert_called_with()
|
||||
@@ -188,7 +186,7 @@ class SetUserPasswordPluginTests(unittest.TestCase):
|
||||
|
||||
if not can_update_password or is_password_changed:
|
||||
mock_get_password.assert_called_once_with(
|
||||
mock_service, mock_osutils, mock.sentinel.shared_data)
|
||||
mock_service, mock.sentinel.shared_data)
|
||||
|
||||
self.assertEqual(expected_password, response)
|
||||
self.assertEqual(expected_logging, snatcher.output)
|
||||
|
||||
Reference in New Issue
Block a user