Repository: ambari Updated Branches: refs/heads/trunk ded8ee71c -> badf9f7bb
AMBARI-19529 : Atlas service check should fail only if all metadata servers are down (Vishal Suvagia via mugdha) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/badf9f7b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/badf9f7b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/badf9f7b Branch: refs/heads/trunk Commit: badf9f7bb7037597e0887614ce68bfb800f7b705 Parents: ded8ee7 Author: Vishal Suvagia <[email protected]> Authored: Fri Jan 13 21:32:52 2017 +0530 Committer: Mugdha Varadkar <[email protected]> Committed: Tue Jan 17 09:55:37 2017 +0530 ---------------------------------------------------------------------- .../ATLAS/0.1.0.2.3/package/scripts/service_check.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/badf9f7b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/service_check.py index 3525f3e..cada8c3 100644 --- a/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/service_check.py +++ b/ambari-server/src/main/resources/common-services/ATLAS/0.1.0.2.3/package/scripts/service_check.py @@ -22,7 +22,7 @@ from resource_management.libraries.functions.format import format from resource_management.core.logger import Logger from resource_management.core.resources.system import Execute from resource_management.core.exceptions import ComponentIsNotRunning - +from resource_management.core.exceptions import Fail class AtlasServiceCheck(Script): @@ -34,13 +34,21 @@ class AtlasServiceCheck(Script): if params.security_enabled: Execute(format("{kinit_path_local} -kt {smokeuser_keytab} {smokeuser_principal}"), user=params.smoke_test_user) + atlas_host_call_count = 0 + for atlas_host in params.atlas_hosts: if params.security_enabled: smoke_cmd = format('curl -k --negotiate -u : -b ~/cookiejar.txt -c ~/cookiejar.txt -s -o /dev/null -w "%{{http_code}}" {metadata_protocol}://{atlas_host}:{metadata_port}/') else: smoke_cmd = format('curl -k -s -o /dev/null -w "%{{http_code}}" {metadata_protocol}://{atlas_host}:{metadata_port}/') - Execute(smoke_cmd , user=params.smoke_test_user, tries = 5, - try_sleep = 10) + try: + Execute(smoke_cmd , user=params.smoke_test_user, tries = 5, + try_sleep = 10) + except Exception, err: + atlas_host_call_count = atlas_host_call_count + 1 + Logger.error("ATLAS service check failed for host {0} with error {1}".format(atlas_host,err)) + if atlas_host_call_count == len(params.atlas_hosts): + raise Fail("All instances of ATLAS METADATA SERVER are down.") if __name__ == "__main__":
