Updated Branches:
  refs/heads/trunk 548710247 -> d58802e97

AMBARI-3453. Yarn smoke test failed with SSL enabled for hadoop daemons. 
(Oleksandr Diachenko via swagle)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/d58802e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/d58802e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/d58802e9

Branch: refs/heads/trunk
Commit: d58802e974b8663524c6b7d31ff89949c60ec236
Parents: 5487102
Author: Siddharth Wagle <[email protected]>
Authored: Thu Oct 3 17:28:38 2013 -0700
Committer: Siddharth Wagle <[email protected]>
Committed: Thu Oct 3 17:28:38 2013 -0700

----------------------------------------------------------------------
 .../modules/hdp-hadoop/manifests/params.pp      |  2 ++
 .../files/validateYarnComponentStatus.py        | 25 +++++++++++++-------
 .../puppet/modules/hdp-yarn/manifests/params.pp |  1 +
 .../modules/hdp-yarn/manifests/smoketest.pp     | 11 +++++++--
 4 files changed, 28 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d58802e9/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
----------------------------------------------------------------------
diff --git 
a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp 
b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
index 5b3d75e..2a477e8 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-hadoop/manifests/params.pp
@@ -123,6 +123,8 @@ class hdp-hadoop::params(
   $proxyuser_group = hdp_default("core-site/proxyuser.group","users")
   
   $hadoop_tmp_dir = 
hdp_default("core-site/hadoop.tmp.dir","/tmp/hadoop-$hdfs_user")
+  
+  $hadoop_ssl_enabled = hdp_default("core-site/hadoop.ssl.enabled","false")
 
   ### hdfs-site
   $datanode_du_reserved = 
hdp_default("hdfs-site/datanode.du.reserved",1073741824)

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d58802e9/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
----------------------------------------------------------------------
diff --git 
a/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
 
b/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
index 531113c..5186f21 100644
--- 
a/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
+++ 
b/ambari-agent/src/main/puppet/modules/hdp-yarn/files/validateYarnComponentStatus.py
@@ -30,13 +30,18 @@ STARTED_STATE = 'STARTED'
 RUNNING_STATE = 'RUNNING'
 
 #Return reponse for given path and address
-def getResponse(path, address):
+def getResponse(path, address, ssl_enabled):
 
   command = "curl"
   httpGssnegotiate = "--negotiate"
   userpswd = "-u:"
-  url = 'http://' + address + path
-  command_with_flags = [command,httpGssnegotiate,userpswd,url]
+  insecure = "-k"# This is smoke test, no need to check CA of server
+  if ssl_enabled:
+    url = 'https://' + address + path
+  else:
+    url = 'http://' + address + path
+      
+  command_with_flags = [command,httpGssnegotiate,userpswd,insecure,url]
   try:
     proc = subprocess.Popen(command_with_flags, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
     (stdout, stderr) = proc.communicate()
@@ -50,10 +55,10 @@ def getResponse(path, address):
     exit(1)
 
 #Verify that REST api is available for given component
-def validateAvailability(component, path, address):
+def validateAvailability(component, path, address, ssl_enabled):
 
   try:
-    response = getResponse(path, address)
+    response = getResponse(path, address, ssl_enabled)
     is_valid = validateAvailabilityResponse(component, response)
     if not is_valid:
       exit(1)
@@ -91,10 +96,10 @@ def validateAvailabilityResponse(component, response):
     return False
 
 #Verify that component has required resources to work
-def validateAbility(component, path, address):
+def validateAbility(component, path, address, ssl_enabled):
 
   try:
-    response = getResponse(path, address)
+    response = getResponse(path, address, ssl_enabled)
     is_valid = validateAbilityResponse(component, response)
     if not is_valid:
       exit(1)
@@ -133,12 +138,14 @@ def validateAbilityResponse(component, response):
 def main():
   parser = optparse.OptionParser(usage="usage: %prog [options] component ")
   parser.add_option("-p", "--port", dest="address", help="Host:Port for REST 
API of a desired component")
+  parser.add_option("-s", "--ssl", dest="ssl_enabled", help="Is SSL enabled 
for UI of component")
 
   (options, args) = parser.parse_args()
 
   component = args[0]
   
   address = options.address
+  ssl_enabled = (options.ssl_enabled) in 'true'
   if component == RESOURCEMANAGER:
     path = '/ws/v1/cluster/info'
   elif component == NODEMANAGER:
@@ -148,11 +155,11 @@ def main():
   else:
     parser.error("Invalid component")
 
-  validateAvailability(component, path, address)
+  validateAvailability(component, path, address, ssl_enabled)
 
   if component == RESOURCEMANAGER:
     path = '/ws/v1/cluster/nodes'
-    validateAbility(component, path, address)
+    validateAbility(component, path, address, ssl_enabled)
 
 if __name__ == "__main__":
   main()

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d58802e9/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp 
b/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp
index f34cf87..637b515 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/params.pp
@@ -42,6 +42,7 @@ class hdp-yarn::params(
   
   ## yarn-site
   $rm_webui_address = 
hdp_default("yarn-site/yarn.resourcemanager.webapp.address", "0.0.0.0:8088")
+  $rm_webui_https_address = 
hdp_default("yarn-site/yarn.resourcemanager.webapp.https.address", 
"0.0.0.0:8090")
   $nm_webui_address = hdp_default("yarn-site/yarn.nodemanager.webapp.address", 
"0.0.0.0:8042")
   $hs_webui_address = 
hdp_default("mapred-site/mapreduce.jobhistory.webapp.address", "0.0.0.0:19888")
   

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/d58802e9/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp
----------------------------------------------------------------------
diff --git 
a/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp 
b/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp
index f7e3459..e2faef4 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp
+++ b/ambari-agent/src/main/puppet/modules/hdp-yarn/manifests/smoketest.pp
@@ -23,12 +23,19 @@ define hdp-yarn::smoketest(
 )
 {
   $rm_webui_address = $hdp-yarn::params::rm_webui_address
+  $rm_webui_https_address = $hdp-yarn::params::rm_webui_https_address
   $nm_webui_address = $hdp-yarn::params::nm_webui_address
   $hs_webui_address = $hdp-yarn::params::hs_webui_address
+  
+  $hadoop_ssl_enabled = $hdp-hadoop::params::hadoop_ssl_enabled
 
   if ($component_name == 'resourcemanager') {
     $component_type = 'rm'
-    $component_address = $rm_webui_address
+    if ($hadoop_ssl_enabled == "true") {
+      $component_address = $rm_webui_https_address
+    } else {
+      $component_address = $rm_webui_address
+    }
   } elsif ($component_name == 'nodemanager') {
     $component_type = 'nm'
     $component_address = $nm_webui_address
@@ -48,7 +55,7 @@ define hdp-yarn::smoketest(
   $validateStatusFileName = "validateYarnComponentStatus.py"
   $validateStatusFilePath = "/tmp/$validateStatusFileName"
 
-  $validateStatusCmd = "$validateStatusFilePath $component_type -p 
$component_address"
+  $validateStatusCmd = "$validateStatusFilePath $component_type -p 
$component_address -s $hadoop_ssl_enabled"
 
     if ($security_enabled == true) {
          $smoke_cmd = "${kinit_cmd}  $validateStatusCmd"

Reply via email to