ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mug...@apache.org
Subject ambari git commit: AMBARI-20932: Ranger plugin setup should handle Nifi service (Vishal Suvagia via mugdha)
Date Mon, 08 May 2017 05:37:32 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 9536e6067 -> c7871903f


AMBARI-20932: Ranger plugin setup should handle Nifi service (Vishal Suvagia via mugdha)


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

Branch: refs/heads/branch-2.5
Commit: c7871903f26535ace07922dd7583159bb4705c08
Parents: 9536e60
Author: Vishal Suvagia <vsuvagia@hortonworks.com>
Authored: Sat May 6 23:47:46 2017 +0530
Committer: Mugdha Varadkar <mugdha@apache.org>
Committed: Mon May 8 11:06:36 2017 +0530

----------------------------------------------------------------------
 .../functions/setup_ranger_plugin_xml.py        | 26 ++++++++++++--------
 .../RANGER/0.7.0/configuration/ranger-env.xml   | 22 +++++++++++++++++
 .../RANGER/0.7.0/themes/theme_version_5.json    | 26 ++++++++++++++++++++
 3 files changed, 64 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c7871903/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
index c510dac..c80c577 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
@@ -49,7 +49,7 @@ def setup_ranger_plugin(component_select_name, service_name, previous_jdbc_jar,
                         xa_audit_db_password, ssl_truststore_password,
                         ssl_keystore_password, api_version=None, stack_version_override =
None, skip_if_rangeradmin_down = True,
                         is_security_enabled = False, is_stack_supports_ranger_kerberos =
False,
-                        component_user_principal = None, component_user_keytab = None):
+                        component_user_principal = None, component_user_keytab = None, cred_lib_path_override
= None, cred_setup_prefix_override = None):
 
   if audit_db_is_enabled and component_driver_curl_source is not None and not component_driver_curl_source.endswith("/None"):
     if previous_jdbc_jar and os.path.isfile(previous_jdbc_jar):
@@ -69,8 +69,10 @@ def setup_ranger_plugin(component_select_name, service_name, previous_jdbc_jar,
 
   if policymgr_mgr_url.endswith('/'):
     policymgr_mgr_url = policymgr_mgr_url.rstrip('/')
-  stack_version = get_stack_version(component_select_name)
-  if stack_version_override is not None:
+
+  if stack_version_override is None:
+    stack_version = get_stack_version(component_select_name)
+  else:
     stack_version = stack_version_override
 
   component_conf_dir = conf_dict
@@ -187,7 +189,7 @@ def setup_ranger_plugin(component_select_name, service_name, previous_jdbc_jar,
 
     setup_ranger_plugin_keystore(service_name, audit_db_is_enabled, stack_version, credential_file,
               xa_audit_db_password, ssl_truststore_password, ssl_keystore_password,
-              component_user, component_group, java_home)
+              component_user, component_group, java_home, cred_lib_path_override, cred_setup_prefix_override)
 
   else:
     File(format('{component_conf_dir}/ranger-security.xml'),
@@ -207,16 +209,20 @@ def setup_ranger_plugin_jar_symblink(stack_version, service_name, component_list
       sudo=True)
 
 def setup_ranger_plugin_keystore(service_name, audit_db_is_enabled, stack_version, credential_file,
xa_audit_db_password,
-                                ssl_truststore_password, ssl_keystore_password, component_user,
component_group, java_home):
+                                ssl_truststore_password, ssl_keystore_password, component_user,
component_group, java_home, cred_lib_path_override = None, cred_setup_prefix_override = None):
 
   stack_root = Script.get_stack_root()
   service_name = str(service_name).lower()
-  cred_lib_path = format('{stack_root}/{stack_version}/ranger-{service_name}-plugin/install/lib/*')
-  cred_setup_prefix = (format('{stack_root}/{stack_version}/ranger-{service_name}-plugin/ranger_credential_helper.py'),
'-l', cred_lib_path)
 
-  if service_name == 'nifi':
-    cred_lib_path = format('{stack_root}/{stack_version}/{service_name}/ext/ranger/install/lib/*')
-    cred_setup_prefix = (format('{stack_root}/{stack_version}/{service_name}/ext/ranger/scripts/ranger_credential_helper.py'),
'-l', cred_lib_path)
+  if cred_lib_path_override is not None:
+    cred_lib_path = cred_lib_path_override
+  else:
+    cred_lib_path = format('{stack_root}/{stack_version}/ranger-{service_name}-plugin/install/lib/*')
+
+  if cred_setup_prefix_override is not None:
+    cred_setup_prefix = cred_setup_prefix_override
+  else:
+    cred_setup_prefix = (format('{stack_root}/{stack_version}/ranger-{service_name}-plugin/ranger_credential_helper.py'),
'-l', cred_lib_path)
 
   if audit_db_is_enabled:
     cred_setup = cred_setup_prefix + ('-f', credential_file, '-k', 'auditDBCred', '-v', PasswordString(xa_audit_db_password),
'-c', '1')

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7871903/ambari-server/src/main/resources/common-services/RANGER/0.7.0/configuration/ranger-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.7.0/configuration/ranger-env.xml
b/ambari-server/src/main/resources/common-services/RANGER/0.7.0/configuration/ranger-env.xml
index 661089a..627216e 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.7.0/configuration/ranger-env.xml
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.7.0/configuration/ranger-env.xml
@@ -25,4 +25,26 @@
     <deleted>true</deleted>
     <on-ambari-upgrade add="false"/>
   </property>
+  <property>
+    <name>ranger-nifi-plugin-enabled</name>
+    <value>No</value>
+    <display-name>NIFI Ranger Plugin</display-name>
+    <description>Enable NIFI Ranger plugin</description>
+    <value-attributes>
+      <overridable>false</overridable>
+      <type>value-list</type>
+      <entries>
+        <entry>
+          <value>Yes</value>
+          <label>ON</label>
+        </entry>
+        <entry>
+          <value>No</value>
+          <label>OFF</label>
+        </entry>
+      </entries>
+      <selection-cardinality>1</selection-cardinality>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
 </configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7871903/ambari-server/src/main/resources/common-services/RANGER/0.7.0/themes/theme_version_5.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.7.0/themes/theme_version_5.json
b/ambari-server/src/main/resources/common-services/RANGER/0.7.0/themes/theme_version_5.json
index 87fccbe..8068a38 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.7.0/themes/theme_version_5.json
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.7.0/themes/theme_version_5.json
@@ -7,6 +7,26 @@
           "config": "ranger-ugsync-site/ranger.usersync.ldap.deltasync",
           "subsection-name": "subsection-ranger-user-row2-col1",
           "subsection-tab-name": "ldap-common-configs"
+        },
+        {
+          "config": "ranger-env/ranger-nifi-plugin-enabled",
+          "subsection-name": "section-ranger-plugin-row1-col1",
+          "depends-on": [
+            {
+              "resource": "service",
+              "if": "NIFI",
+              "then": {
+                "property_value_attributes": {
+                  "visible": true
+                }
+              },
+              "else": {
+                "property_value_attributes": {
+                  "visible": false
+                }
+              }
+            }
+          ]
         }
       ]
     },
@@ -16,6 +36,12 @@
         "widget": {
           "type": "toggle"
         }
+      },
+      {
+        "config": "ranger-env/ranger-nifi-plugin-enabled",
+        "widget": {
+          "type": "toggle"
+        }
       }
     ]
   }


Mime
View raw message