Ver código fonte

AMBARI-11712. Having wire encryption + NN HA enabled hdfs directories will fail to create (aonishuk)

Andrew Onishuk 10 anos atrás
pai
commit
13225f9de5

+ 8 - 5
ambari-common/src/main/python/resource_management/libraries/functions/namenode_ha_utils.py

@@ -29,7 +29,7 @@ HDFS_NN_STATE_STANDBY = 'standby'
 
 NAMENODE_HTTP_FRAGMENT = 'dfs.namenode.http-address.{0}.{1}'
 NAMENODE_HTTPS_FRAGMENT = 'dfs.namenode.https-address.{0}.{1}'
-JMX_URI_FRAGMENT = "http://{0}/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"
+JMX_URI_FRAGMENT = "{0}://{1}/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"
   
 def get_namenode_states(hdfs_site, security_enabled, run_user):
   """
@@ -47,18 +47,21 @@ def get_namenode_states(hdfs_site, security_enabled, run_user):
   # ie dfs.namenode.http-address.hacluster.nn1
   nn_unique_ids = hdfs_site[nn_unique_ids_key].split(',')
   for nn_unique_id in nn_unique_ids:
-    is_https_enabled = hdfs_site['dfs.https.enabled'] if not is_empty(hdfs_site['dfs.https.enabled']) else False
+    is_https_enabled = hdfs_site['dfs.https.enable'] if not is_empty(hdfs_site['dfs.https.enable']) else False
     
     if not is_https_enabled:
       key = NAMENODE_HTTP_FRAGMENT.format(name_service,nn_unique_id)
+      protocol = "http"
     else:
-      key = "https://" + NAMENODE_HTTPS_FRAGMENT.format(name_service,nn_unique_id)
-
+      key = NAMENODE_HTTPS_FRAGMENT.format(name_service,nn_unique_id)
+      protocol = "https"
+    
     if key in hdfs_site:
       # use str() to ensure that unicode strings do not have the u' in them
       value = str(hdfs_site[key])
 
-      jmx_uri = JMX_URI_FRAGMENT.format(value)
+      jmx_uri = JMX_URI_FRAGMENT.format(protocol, value)
+      
       state = get_value_from_jmx(jmx_uri, 'State', security_enabled, run_user, is_https_enabled)
       
       if state == HDFS_NN_STATE_ACTIVE:

+ 2 - 2
ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/params_linux.py

@@ -385,8 +385,8 @@ policy_user = config['configurations']['ranger-hdfs-plugin-properties']['policy_
 jdk_location = config['hostLevelParams']['jdk_location']
 java_share_dir = '/usr/share/java'
 
-is_https_enabled = config['configurations']['hdfs-site']['dfs.https.enabled'] if \
-  not is_empty(config['configurations']['hdfs-site']['dfs.https.enabled']) else False
+is_https_enabled = config['configurations']['hdfs-site']['dfs.https.enable'] if \
+  not is_empty(config['configurations']['hdfs-site']['dfs.https.enable']) else False
 
 if has_ranger_admin:
   enable_ranger_hdfs = (config['configurations']['ranger-hdfs-plugin-properties']['ranger-hdfs-plugin-enabled'].lower() == 'yes')