|
@@ -21,7 +21,8 @@ from resource_management import *
|
|
|
from resource_management.core.shell import as_user
|
|
|
from ambari_commons.os_family_impl import OsFamilyImpl
|
|
|
from ambari_commons import OSConst
|
|
|
-
|
|
|
+from resource_management.libraries.functions.curl_krb_request import curl_krb_request
|
|
|
+from resource_management.core.logger import Logger
|
|
|
|
|
|
class HdfsServiceCheck(Script):
|
|
|
pass
|
|
@@ -68,21 +69,34 @@ class HdfsServiceCheckDefault(HdfsServiceCheck):
|
|
|
params.HdfsResource(None, action="execute")
|
|
|
|
|
|
if params.has_journalnode_hosts:
|
|
|
- journalnode_port = params.journalnode_port
|
|
|
- checkWebUIFileName = "checkWebUI.py"
|
|
|
- checkWebUIFilePath = format("{tmp_dir}/{checkWebUIFileName}")
|
|
|
- comma_sep_jn_hosts = ",".join(params.journalnode_hosts)
|
|
|
- checkWebUICmd = format("python {checkWebUIFilePath} -m {comma_sep_jn_hosts} -p {journalnode_port} -s {https_only}")
|
|
|
- File(checkWebUIFilePath,
|
|
|
- content=StaticFile(checkWebUIFileName),
|
|
|
- mode=0775)
|
|
|
-
|
|
|
- Execute(checkWebUICmd,
|
|
|
- logoutput=True,
|
|
|
- try_sleep=3,
|
|
|
- tries=5,
|
|
|
- user=params.smoke_user
|
|
|
- )
|
|
|
+ if params.security_enabled:
|
|
|
+ for host in params.journalnode_hosts:
|
|
|
+ if params.https_only:
|
|
|
+ uri = format("https://{host}:{journalnode_port}")
|
|
|
+ else:
|
|
|
+ uri = format("http://{host}:{journalnode_port}")
|
|
|
+ response, errmsg, time_millis = curl_krb_request(params.tmp_dir, params.smoke_user_keytab,
|
|
|
+ params.smokeuser_principal, uri, "jn_service_check",
|
|
|
+ params.kinit_path_local, False, None, params.smoke_user)
|
|
|
+ if not response:
|
|
|
+ Logger.error("Cannot access WEB UI on: {0}. Error : {1}", uri, errmsg)
|
|
|
+ return 1
|
|
|
+ else:
|
|
|
+ journalnode_port = params.journalnode_port
|
|
|
+ checkWebUIFileName = "checkWebUI.py"
|
|
|
+ checkWebUIFilePath = format("{tmp_dir}/{checkWebUIFileName}")
|
|
|
+ comma_sep_jn_hosts = ",".join(params.journalnode_hosts)
|
|
|
+ checkWebUICmd = format("python {checkWebUIFilePath} -m {comma_sep_jn_hosts} -p {journalnode_port} -s {https_only}")
|
|
|
+ File(checkWebUIFilePath,
|
|
|
+ content=StaticFile(checkWebUIFileName),
|
|
|
+ mode=0775)
|
|
|
+
|
|
|
+ Execute(checkWebUICmd,
|
|
|
+ logoutput=True,
|
|
|
+ try_sleep=3,
|
|
|
+ tries=5,
|
|
|
+ user=params.smoke_user
|
|
|
+ )
|
|
|
|
|
|
if params.is_namenode_master:
|
|
|
if params.has_zkfc_hosts:
|