Explorar el Código

AMBARI-19087. Clean up how dfs.cluster.administrators is handled wrt user/group creation (aonishuk)

Andrew Onishuk hace 8 años
padre
commit
eb04efb237

+ 1 - 1
ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/configuration/hdfs-site.xml

@@ -395,7 +395,7 @@
   <property>
   <property>
     <name>dfs.cluster.administrators</name>
     <name>dfs.cluster.administrators</name>
     <value> hdfs</value>
     <value> hdfs</value>
-    <description>ACL for who all can view the default servlets in the HDFS</description>
+    <description>ACL for the admins, this configuration is used to control who can access the default servlets in the namenode, etc. The value should be a comma separated list of users and groups. The user list comes first and is separated by a space followed by the group list, e.g. "user1,user2 group1,group2". Both users and groups are optional, so "user1", " group1", "", "user1 group1", "user1,user2 group1,group2" are all valid (note the leading space in " group1"). '*' grants access to all users and groups, e.g. '*', '* ' and ' *' are all valid.</description>
     <on-ambari-upgrade add="true"/>
     <on-ambari-upgrade add="true"/>
   </property>
   </property>
   <property>
   <property>

+ 5 - 1
ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py

@@ -105,13 +105,17 @@ def create_users_and_groups(user_and_groups):
 
 
   import params
   import params
 
 
-  parts = re.split('\s', user_and_groups)
+  parts = re.split('\s+', user_and_groups)
   if len(parts) == 1:
   if len(parts) == 1:
     parts.append("")
     parts.append("")
 
 
   users_list = parts[0].split(",") if parts[0] else []
   users_list = parts[0].split(",") if parts[0] else []
   groups_list = parts[1].split(",") if parts[1] else []
   groups_list = parts[1].split(",") if parts[1] else []
 
 
+  # skip creating groups and users if * is provided as value.
+  users_list = filter(lambda x: x != '*' , users_list)
+  groups_list = filter(lambda x: x != '*' , groups_list)
+
   if users_list:
   if users_list:
     User(users_list,
     User(users_list,
           fetch_nonlocal_groups = params.fetch_nonlocal_groups
           fetch_nonlocal_groups = params.fetch_nonlocal_groups