ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-13655. Hostname test hangs some times.(vbrodetskyi)
Date Fri, 30 Oct 2015 12:33:13 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 491a3284e -> b2abf50ea


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/b2abf50e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b2abf50e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b2abf50e

Branch: refs/heads/trunk
Commit: b2abf50ea94c7f5896704a62aca2de7e86bfe436
Parents: 491a328
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Fri Oct 30 14:33:04 2015 +0200
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Fri Oct 30 14:33:04 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/b2abf50e/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/b2abf50e/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 be8d80e..569732b 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -8180,6 +8180,7 @@ class TestAmbariServer(TestCase):
 
 
   @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")
@@ -8194,7 +8195,7 @@ class TestAmbariServer(TestCase):
   @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")
 
@@ -8207,6 +8208,7 @@ class TestAmbariServer(TestCase):
     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)
 


Mime
View raw message