Repository: ambari Updated Branches: refs/heads/branch-2.5 300333732 -> d54fab9ae
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/d54fab9a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d54fab9a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d54fab9a Branch: refs/heads/branch-2.5 Commit: d54fab9aee119428427bad38f5f5df011f0c3b48 Parents: 3003337 Author: Vishal Suvagia <[email protected]> Authored: Fri Jan 13 21:36:27 2017 +0530 Committer: Mugdha Varadkar <[email protected]> Committed: Tue Jan 17 09:48:27 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/d54fab9a/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 943bc4d..0e760d6 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 @@ -19,7 +19,7 @@ limitations under the License. from resource_management import Script, Logger, ComponentIsNotRunning, \ Execute from resource_management.libraries.functions import format - +from resource_management.core.exceptions import Fail class AtlasServiceCheck(Script): @@ -31,13 +31,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__":
