peacewong commented on a change in pull request #1153:
URL: https://github.com/apache/incubator-linkis/pull/1153#discussion_r761711528
##########
File path:
linkis-computation-governance/linkis-manager/linkis-resource-manager/src/main/scala/org/apache/linkis/resourcemanager/external/yarn/YarnResourceRequester.scala
##########
@@ -212,20 +212,32 @@ class YarnResourceRequester extends
ExternalResourceRequester with Logging {
private def getResponseByUrl(url: String, rmWebAddress: String) = {
val httpGet = new HttpGet(rmWebAddress + "/ws/v1/cluster/" + url)
httpGet.addHeader("Accept", "application/json")
- if (this.provider.getConfigMap.get("authorEnable").asInstanceOf[Boolean])
- httpGet.addHeader(HttpHeaders.AUTHORIZATION, "Basic " +
getAuthorizationStr)
+ val authorEnable=this.provider.getConfigMap.get("authorEnable");
var httpResponse: HttpResponse = null
- if(this.provider.getConfigMap.get("kerberosEnable") != null
- &&
this.provider.getConfigMap.get("kerberosEnable").asInstanceOf[Boolean]){
- val principalName =
this.provider.getConfigMap.get("principalName").asInstanceOf[String]
- val keytabPath =
this.provider.getConfigMap.get("keytabPath").asInstanceOf[String]
- val krb5Path =
this.provider.getConfigMap.get("krb5Path").asInstanceOf[String]
- val requestKuu = new
RequestKerberosUrlUtils(principalName,keytabPath,krb5Path,false)
- val response = requestKuu.callRestUrl(rmWebAddress + "/ws/v1/cluster/" +
url,principalName)
- httpResponse = response
- }else {
- val response = YarnResourceRequester.httpClient.execute(httpGet)
- httpResponse = response
+ authorEnable match {
+ case Boolean =>
+ if(authorEnable.asInstanceOf[Boolean]){
+ httpGet.addHeader(HttpHeaders.AUTHORIZATION, "Basic " +
getAuthorizationStr)
+ }
+ case _ =>
+ }
+ val kerberosEnable =this.provider.getConfigMap.get("kerberosEnable");
+ kerberosEnable match {
+ case Boolean =>
Review comment:
It is recommended to adjust the match case to "enabled: Boolean =>"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]