From 9e5cba2ed26434edb70bfda69d9cb44ca4039bcc Mon Sep 17 00:00:00 2001 From: Cosmin Poieana Date: Wed, 24 Jun 2015 23:47:06 +0300 Subject: [PATCH] Remove unused parameter in setuserpassword plugin Remove dead code from `_get_password` method. Change-Id: I3d3700cdde8bbaa528639cd71cbc288d35a40173 --- cloudbaseinit/plugins/common/setuserpassword.py | 4 ++-- cloudbaseinit/tests/plugins/common/test_setuserpassword.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cloudbaseinit/plugins/common/setuserpassword.py b/cloudbaseinit/plugins/common/setuserpassword.py index 5ac62aa0..3a5edbe8 100644 --- a/cloudbaseinit/plugins/common/setuserpassword.py +++ b/cloudbaseinit/plugins/common/setuserpassword.py @@ -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() diff --git a/cloudbaseinit/tests/plugins/common/test_setuserpassword.py b/cloudbaseinit/tests/plugins/common/test_setuserpassword.py index 47803b82..54d4cd66 100644 --- a/cloudbaseinit/tests/plugins/common/test_setuserpassword.py +++ b/cloudbaseinit/tests/plugins/common/test_setuserpassword.py @@ -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)