AMBARI-13113. Ranger Hive Tests failing - deny operations (aonishuk)

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

Branch: refs/heads/branch-2.1
Commit: b726df76f4a795655a430a0730c42806495a1594
Parents: b2a83e0
Author: Andrew Onishuk <[email protected]>
Authored: Wed Sep 16 20:15:52 2015 +0300
Committer: Andrew Onishuk <[email protected]>
Committed: Wed Sep 16 20:15:52 2015 +0300

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 25 ++++++++++++--------
 .../stacks/HDP/2.1/services/stack_advisor.py    | 12 ++++++----
 2 files changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b726df76/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 52dcfbd..4d1ab23 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -154,43 +154,48 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
       services["forced-configurations"] = []
 
     if "HDFS" in servicesList:
+      hdfs_user = None
       if "hadoop-env" in services["configurations"] and "hdfs_user" in 
services["configurations"]["hadoop-env"]["properties"]:
         hdfs_user = 
services["configurations"]["hadoop-env"]["properties"]["hdfs_user"]
-        if not hdfs_user in users:
+        if not hdfs_user in users and hdfs_user is not None:
           users[hdfs_user] = {"propertyHosts" : "*","propertyGroups" : "*", 
"config" : "hadoop-env", "propertyName" : "hdfs_user"}
 
     if "OOZIE" in servicesList:
+      oozie_user = None
       if "oozie-env" in services["configurations"] and "oozie_user" in 
services["configurations"]["oozie-env"]["properties"]:
         oozie_user = 
services["configurations"]["oozie-env"]["properties"]["oozie_user"]
         oozieServerrHost = self.getHostWithComponent("OOZIE", "OOZIE_SERVER", 
services, hosts)
         if oozieServerrHost is not None:
           oozieServerHostName = oozieServerrHost["Hosts"]["public_host_name"]
-        if not oozie_user in users:
-          users[oozie_user] = {"propertyHosts" : 
oozieServerHostName,"propertyGroups" : "*", "config" : "oozie-env", 
"propertyName" : "oozie_user"}
+          if not oozie_user in users and oozie_user is not None:
+            users[oozie_user] = {"propertyHosts" : 
oozieServerHostName,"propertyGroups" : "*", "config" : "oozie-env", 
"propertyName" : "oozie_user"}
 
     if "HIVE" in servicesList:
-      print "HIVE INSIDE"
+      hive_user = None
+      webhcat_user = None
       if "hive-env" in services["configurations"] and "hive_user" in 
services["configurations"]["hive-env"]["properties"] \
               and "webhcat_user" in 
services["configurations"]["hive-env"]["properties"]:
-        print "HIVE INSIDE1"
         hive_user = 
services["configurations"]["hive-env"]["properties"]["hive_user"]
         webhcat_user = 
services["configurations"]["hive-env"]["properties"]["webhcat_user"]
+        proxy_user_group = None
         if "hadoop-env" in services["configurations"] and "proxyuser_group" in 
services["configurations"]["hadoop-env"]["properties"]:
           proxy_user_group = 
services["configurations"]["hadoop-env"]["properties"]["proxyuser_group"]
         hiveServerrHost = self.getHostWithComponent("HIVE", "HIVE_SERVER", 
services, hosts)
         if hiveServerrHost is not None:
           hiveServerHostName = hiveServerrHost["Hosts"]["public_host_name"]
-        if not hive_user in users:
-          users[hive_user] = {"propertyHosts" : 
hiveServerHostName,"propertyGroups" : "*", "config" : "hive-env", 
"propertyName" : "hive_user"}
-        if not webhcat_user in users:
-          users[webhcat_user] = {"propertyHosts" : 
hiveServerHostName,"propertyGroups" : proxy_user_group, "config" : "hive-env", 
"propertyName" : "webhcat_user"}
+          if not hive_user in users and hive_user is not None:
+            users[hive_user] = {"propertyHosts" : 
hiveServerHostName,"propertyGroups" : "*", "config" : "hive-env", 
"propertyName" : "hive_user"}
+          if not webhcat_user in users and not None in [webhcat_user , 
proxy_user_group]:
+            users[webhcat_user] = {"propertyHosts" : 
hiveServerHostName,"propertyGroups" : proxy_user_group, "config" : "hive-env", 
"propertyName" : "webhcat_user"}
 
     if "FALCON" in servicesList:
+      falconUser = None
       if "falcon-env" in services["configurations"] and "falcon_user" in 
services["configurations"]["falcon-env"]["properties"]:
         falconUser = 
services["configurations"]["falcon-env"]["properties"]["falcon_user"]
+        proxy_user_group = None
         if "hadoop-env" in services["configurations"] and "proxyuser_group" in 
services["configurations"]["hadoop-env"]["properties"]:
           proxy_user_group = 
services["configurations"]["hadoop-env"]["properties"]["proxyuser_group"]
-        if not falconUser in users:
+        if not falconUser in users and not None in [proxy_user_group, 
falconUser]:
           users[falconUser] = {"propertyHosts" : "*","propertyGroups" : 
proxy_user_group, "config" : "falcon-env", "propertyName" : "falcon_user"}
 
     putCoreSiteProperty = self.putProperty(configurations, "core-site", 
services)

http://git-wip-us.apache.org/repos/asf/ambari/blob/b726df76/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
index 4a06c1e..dedc77d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/services/stack_advisor.py
@@ -32,11 +32,12 @@ class HDP21StackAdvisor(HDP206StackAdvisor):
   def recommendOozieConfigurations(self, configurations, clusterData, 
services, hosts):
     if "FALCON_SERVER" in clusterData["components"]:
       putOozieSiteProperty = self.putProperty(configurations, "oozie-site", 
services)
-
+      falconUser = None
       if "falcon-env" in services["configurations"] and "falcon_user" in 
services["configurations"]["falcon-env"]["properties"]:
         falconUser = 
services["configurations"]["falcon-env"]["properties"]["falcon_user"]
-        
putOozieSiteProperty("oozie.service.ProxyUserService.proxyuser.{0}.groups".format(falconUser)
 , "*")
-        
putOozieSiteProperty("oozie.service.ProxyUserService.proxyuser.{0}.hosts".format(falconUser)
 , "*")
+        if falconUser is not None:
+          
putOozieSiteProperty("oozie.service.ProxyUserService.proxyuser.{0}.groups".format(falconUser)
 , "*")
+          
putOozieSiteProperty("oozie.service.ProxyUserService.proxyuser.{0}.hosts".format(falconUser)
 , "*")
         falconUserOldValue = getOldValue(self, services, "falcon-env", 
"falcon_user")
         if falconUserOldValue is not None:
           if 'forced-configurations' not in services:
@@ -46,8 +47,9 @@ class HDP21StackAdvisor(HDP206StackAdvisor):
           
putOozieSitePropertyAttribute("oozie.service.ProxyUserService.proxyuser.{0}.hosts".format(falconUserOldValue),
 'delete', 'true')
           services["forced-configurations"].append({"type" : "oozie-site", 
"name" : 
"oozie.service.ProxyUserService.proxyuser.{0}.hosts".format(falconUserOldValue)})
           services["forced-configurations"].append({"type" : "oozie-site", 
"name" : 
"oozie.service.ProxyUserService.proxyuser.{0}.groups".format(falconUserOldValue)})
-          services["forced-configurations"].append({"type" : "oozie-site", 
"name" : 
"oozie.service.ProxyUserService.proxyuser.{0}.hosts".format(falconUser)})
-          services["forced-configurations"].append({"type" : "oozie-site", 
"name" : 
"oozie.service.ProxyUserService.proxyuser.{0}.groups".format(falconUser)})
+          if falconUser is not None:
+            services["forced-configurations"].append({"type" : "oozie-site", 
"name" : 
"oozie.service.ProxyUserService.proxyuser.{0}.hosts".format(falconUser)})
+            services["forced-configurations"].append({"type" : "oozie-site", 
"name" : 
"oozie.service.ProxyUserService.proxyuser.{0}.groups".format(falconUser)})
 
       putMapredProperty = self.putProperty(configurations, "oozie-site")
       putMapredProperty("oozie.services.ext",

Reply via email to