You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2014/07/29 14:17:20 UTC
git commit: AMBARI-5956. DB connection check error if jdk_name does
not exist.(vbrodetskyi)
Repository: ambari
Updated Branches:
refs/heads/trunk 11336361f -> 5214ea465
AMBARI-5956. DB connection check error if jdk_name does not exist.(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5214ea46
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5214ea46
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5214ea46
Branch: refs/heads/trunk
Commit: 5214ea465eec7836ff92bb0af6cca3573bdd16d5
Parents: 1133636
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Tue Jul 29 13:52:24 2014 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Tue Jul 29 13:52:24 2014 +0300
----------------------------------------------------------------------
.../src/main/resources/custom_actions/check_host.py | 8 ++++----
ambari-server/src/test/python/TestCheckHost.py | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5214ea46/ambari-server/src/main/resources/custom_actions/check_host.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/check_host.py b/ambari-server/src/main/resources/custom_actions/check_host.py
index 7c6b299..3543f96 100644
--- a/ambari-server/src/main/resources/custom_actions/check_host.py
+++ b/ambari-server/src/main/resources/custom_actions/check_host.py
@@ -136,14 +136,13 @@ class CheckHost(Script):
environment = { "no_proxy": format("{ambari_server_hostname}") }
artifact_dir = "/tmp/HDP-artifacts/"
- jdk_name = config['commandParams']['jdk_name']
- jdk_curl_target = format("{artifact_dir}/{jdk_name}")
java_dir = os.path.dirname(java64_home)
- # download DBConnectionVerification.jar from ambari-server resources
-
+ # download and install java if it doesn't exists
if not os.path.isfile(java_exec):
try:
+ jdk_name = config['commandParams']['jdk_name']
+ jdk_curl_target = format("{artifact_dir}/{jdk_name}")
Execute(format("mkdir -p {artifact_dir} ; curl -kf "
"--retry 10 {jdk_location}/{jdk_name} -o {jdk_curl_target}"),
path = ["/bin","/usr/bin/"],
@@ -169,6 +168,7 @@ class CheckHost(Script):
db_connection_check_structured_output = {"exit_code" : 1, "message": message}
return db_connection_check_structured_output
+ # download DBConnectionVerification.jar from ambari-server resources
try:
cmd = format("/bin/sh -c 'cd /usr/lib/ambari-agent/ && curl -kf "
"--retry 5 {jdk_location}{check_db_connection_jar_name} "
http://git-wip-us.apache.org/repos/asf/ambari/blob/5214ea46/ambari-server/src/test/python/TestCheckHost.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestCheckHost.py b/ambari-server/src/test/python/TestCheckHost.py
index bf4281a..c20f428 100644
--- a/ambari-server/src/test/python/TestCheckHost.py
+++ b/ambari-server/src/test/python/TestCheckHost.py
@@ -83,10 +83,10 @@ class TestCheckHost(TestCase):
'DBConnectionVerification.jar from Ambari Server resources. Check network access to Ambari ' \
'Server.\ntest exception', 'exit_code': 1}})
- self.assertEquals(format_mock.call_args_list[2][0][0], "/bin/sh -c 'cd /usr/lib/ambari-agent/ && curl -kf " \
+ self.assertEquals(format_mock.call_args_list[1][0][0], "/bin/sh -c 'cd /usr/lib/ambari-agent/ && curl -kf " \
"--retry 5 {jdk_location}{check_db_connection_jar_name} -o {check_db_connection_jar_name}'")
- self.assertEquals(format_mock.call_args_list[3][0][0], "[ -f /usr/lib/ambari-agent/{check_db_connection_jar_name}]")
+ self.assertEquals(format_mock.call_args_list[2][0][0], "[ -f /usr/lib/ambari-agent/{check_db_connection_jar_name}]")
# test, download jdbc driver failed
mock_config.return_value = {"commandParams" : {"check_execute_list" : "db_connection_check",
@@ -111,10 +111,10 @@ class TestCheckHost(TestCase):
'Server host to make the JDBC driver available for download and to enable testing '
'the database connection.\n')
self.assertEquals(structured_out_mock.call_args[0][0]['db_connection_check']['exit_code'], 1)
- self.assertEquals(format_mock.call_args_list[4][0][0], "/bin/sh -c 'cd /usr/lib/ambari-agent/ && curl -kf " \
+ self.assertEquals(format_mock.call_args_list[3][0][0], "/bin/sh -c 'cd /usr/lib/ambari-agent/ && curl -kf " \
"--retry 5 {jdbc_url} -o {jdbc_name}'")
- self.assertEquals(format_mock.call_args_list[5][0][0], "[ -f /usr/lib/ambari-agent/{jdbc_name}]")
+ self.assertEquals(format_mock.call_args_list[4][0][0], "[ -f /usr/lib/ambari-agent/{jdbc_name}]")
# test, no connection to remote db
mock_config.return_value = {"commandParams" : {"check_execute_list" : "db_connection_check",