This is an automated email from the ASF dual-hosted git repository. ncole pushed a commit to branch branch-feature-AMBARI-21674 in repository https://gitbox.apache.org/repos/asf/ambari.git
commit ab48f44d1dc3422845d1e366de2f94530ed7e918 Author: Sandor Molnar <[email protected]> AuthorDate: Sun Jan 21 22:27:11 2018 +0100 AMBARI-22797. Removing 'is_root' check from setup-ldap (according to R. Levas this is irrelevant) --- .../src/main/python/ambari_server/setupSecurity.py | 5 ---- ambari-server/src/test/python/TestAmbariServer.py | 27 +++------------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/ambari-server/src/main/python/ambari_server/setupSecurity.py b/ambari-server/src/main/python/ambari_server/setupSecurity.py index bdf6993..ac803c5 100644 --- a/ambari-server/src/main/python/ambari_server/setupSecurity.py +++ b/ambari-server/src/main/python/ambari_server/setupSecurity.py @@ -658,11 +658,6 @@ def update_ldap_configuration(properties, ldap_property_value_map): def setup_ldap(options): logger.info("Setup LDAP.") - if not is_root(): - err = 'Ambari-server setup-ldap should be run with ' \ - 'root-level privileges' - raise FatalException(4, err) - properties = get_ambari_properties() server_status, pid = is_server_runing() diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index e1d0b3c..d5755b3 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -7238,10 +7238,9 @@ class TestAmbariServer(TestCase): @patch("ambari_server.setupSecurity.update_properties_2") @patch("ambari_server.setupSecurity.search_file") @patch("ambari_server.setupSecurity.get_ambari_properties") - @patch("ambari_server.setupSecurity.is_root") @patch("ambari_server.setupSecurity.logger") @patch("ambari_server.setupSecurity.is_server_runing") - def test_setup_ldap_invalid_input(self, is_server_runing_method, logger_mock, is_root_method, get_ambari_properties_method, + def test_setup_ldap_invalid_input(self, is_server_runing_method, logger_mock, get_ambari_properties_method, search_file_message, update_properties_method, get_YN_input_method, @@ -7249,7 +7248,6 @@ class TestAmbariServer(TestCase): get_password_mock, raw_input_mock, urlopen_mock): out = StringIO.StringIO() sys.stdout = out - is_root_method.return_value = True is_server_runing_method.return_value = (True, 0) search_file_message.return_value = "filepath" @@ -7325,27 +7323,10 @@ class TestAmbariServer(TestCase): sys.stdout = sys.__stdout__ pass - @patch("ambari_server.setupSecurity.is_root") - def test_setup_ldap_should_fail_if_executed_by_not_root_user(self, is_root_mock): - out = StringIO.StringIO() - sys.stdout = out - is_root_mock.return_value = False - try: - setup_ldap(self._create_empty_options_mock()) - self.fail("Should throw exception") - except FatalException as fe: - self.assertTrue("root-level" in fe.reason) - pass - - sys.stdout = sys.__stdout__ - pass - @patch("ambari_server.setupSecurity.is_server_runing") - @patch("ambari_server.setupSecurity.is_root") - def test_setup_ldap_should_fail_if_ambari_server_is_not_running(self, is_root_mock, is_server_runing_mock): + def test_setup_ldap_should_fail_if_ambari_server_is_not_running(self, is_server_runing_mock): out = StringIO.StringIO() sys.stdout = out - is_root_mock.return_value = True is_server_runing_mock.return_value = (False, 0) try: setup_ldap(self._create_empty_options_mock()) @@ -7420,12 +7401,11 @@ class TestAmbariServer(TestCase): @patch("ambari_server.setupSecurity.get_validated_string_input") @patch("ambari_server.serverConfiguration.search_file") @patch("ambari_server.setupSecurity.get_ambari_properties") - @patch("ambari_server.setupSecurity.is_root") @patch("ambari_server.setupSecurity.read_password") @patch("os.path.exists") @patch("ambari_server.setupSecurity.logger") @patch("ambari_server.setupSecurity.is_server_runing") - def test_setup_ldap(self, is_server_runing_method, logger_mock, exists_method, read_password_method, is_root_method, get_ambari_properties_method, + def test_setup_ldap(self, is_server_runing_method, logger_mock, exists_method, read_password_method, get_ambari_properties_method, search_file_message, get_validated_string_input_method, configure_ldap_password_method, update_properties_method, @@ -7435,7 +7415,6 @@ class TestAmbariServer(TestCase): sys.stdout = out options = self._create_empty_options_mock() - is_root_method.return_value = True is_server_runing_method.return_value = (True, 0) search_file_message.return_value = "filepath" -- To stop receiving notification emails like this one, please contact [email protected].
