Repository: ambari Updated Branches: refs/heads/branch-2.1 603013590 -> d1c068e3f
AMBARI-13655. Hostname test hangs some times.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d1c068e3 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d1c068e3 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d1c068e3 Branch: refs/heads/branch-2.1 Commit: d1c068e3f803e483754c870317349c4f534db043 Parents: 6030135 Author: Vitaly Brodetskyi <[email protected]> Authored: Fri Oct 30 14:31:42 2015 +0200 Committer: Vitaly Brodetskyi <[email protected]> Committed: Fri Oct 30 14:31:42 2015 +0200 ---------------------------------------------------------------------- ambari-server/src/main/python/ambari_server/hostUpdate.py | 10 ++++++---- ambari-server/src/test/python/TestAmbariServer.py | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d1c068e3/ambari-server/src/main/python/ambari_server/hostUpdate.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/hostUpdate.py b/ambari-server/src/main/python/ambari_server/hostUpdate.py index 8acd27a..d5ab22a 100644 --- a/ambari-server/src/main/python/ambari_server/hostUpdate.py +++ b/ambari-server/src/main/python/ambari_server/hostUpdate.py @@ -26,6 +26,8 @@ from ambari_server import serverConfiguration from ambari_server import dbConfiguration from ambari_server import setupSecurity from ambari_commons import os_utils +from ambari_server import userInput +from ambari_server import serverUtils from ambari_server.serverConfiguration import configDefaults, get_java_exe_path, get_ambari_properties, read_ambari_user, \ parse_properties_file, JDBC_DATABASE_PROPERTY from ambari_commons.logging_utils import print_info_msg, print_warning_msg, print_error_msg @@ -41,22 +43,22 @@ HOST_UPDATE_HELPER_CMD = "{0} -cp {1} " + \ " > " + configDefaults.SERVER_OUT_FILE + " 2>&1" def update_host_names(args, options): - services_stopped = get_YN_input("Please, confirm Ambari services are stopped [y/n] (n)? ", False) + services_stopped = userInput.get_YN_input("Please, confirm Ambari services are stopped [y/n] (n)? ", False) if not services_stopped: print 'Exiting...' sys.exit(1) - pending_commands = get_YN_input("Please, confirm there are no pending commands on cluster [y/n] (n)? ", False) + pending_commands = userInput.get_YN_input("Please, confirm there are no pending commands on cluster [y/n] (n)? ", False) if not pending_commands: print 'Exiting...' sys.exit(1) - db_backup_done = get_YN_input("Please, confirm you have made backup of the Ambari db [y/n] (n)? ", False) + db_backup_done = userInput.get_YN_input("Please, confirm you have made backup of the Ambari db [y/n] (n)? ", False) if not db_backup_done: print 'Exiting...' sys.exit(1) - status, pid = is_server_runing() + status, pid = serverUtils.is_server_runing() if status: raise FatalException(1, "Ambari Server should be stopped") http://git-wip-us.apache.org/repos/asf/ambari/blob/d1c068e3/ambari-server/src/test/python/TestAmbariServer.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/TestAmbariServer.py b/ambari-server/src/test/python/TestAmbariServer.py index ebbd7de..301d91b 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -6771,6 +6771,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV @patch.object(ServerClassPath, "get_full_ambari_classpath_escaped_for_shell", new = MagicMock(return_value = 'test' + os.pathsep + 'path12')) + @patch("ambari_server.serverUtils.is_server_runing") @patch("ambari_commons.os_utils.run_os_command") @patch("ambari_server.setupSecurity.generate_env") @patch("ambari_server.setupSecurity.ensure_can_start_under_current_user") @@ -6785,7 +6786,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV @patch("ambari_server.userInput.get_YN_input") def test_update_host_names(self, getYNInput_mock, sysExitMock, isFileMock, osAccessMock, getJavaExePathMock, getAmbariPropertiesMock, parsePropertiesFileMock, ensureDriverInstalledMock, readAmbariUserMock, - ensureCanStartUnderCurrentUserMock, generateEnvMock, runOSCommandMock): + ensureCanStartUnderCurrentUserMock, generateEnvMock, runOSCommandMock, isServerRunningMock): properties = Properties() properties.process_pair("server.jdbc.database", "embedded") @@ -6798,6 +6799,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV ensureCanStartUnderCurrentUserMock.return_value = "test_user" generateEnvMock.return_value = {} runOSCommandMock.return_value = (0, "", "") + isServerRunningMock.return_value = (False, 1) update_host_names(["update-host-names", "/testFileWithChanges"], properties)
