ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gau...@apache.org
Subject ambari git commit: AMBARI-13273. Ambari stack changes to allow Ranger Usersync to be installed on separate host (gautam)
Date Fri, 09 Oct 2015 07:07:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 e1bb12518 -> d6645794e


AMBARI-13273. Ambari stack changes to allow Ranger Usersync to be
installed on separate host (gautam)


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

Branch: refs/heads/branch-2.1
Commit: d6645794e74b75705a4ef58c43614f7da78fced9
Parents: e1bb125
Author: Gautam Borad <gautam@apache.com>
Authored: Thu Oct 8 18:28:20 2015 +0530
Committer: Gautam Borad <gautam@apache.com>
Committed: Fri Oct 9 12:37:22 2015 +0530

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/params.py       |  5 +++++
 .../0.4.0/package/scripts/service_check.py       | 19 ++++++-------------
 .../0.4.0/package/scripts/setup_ranger_xml.py    | 10 ++++------
 .../RANGER/configuration/ranger-admin-site.xml   |  2 +-
 .../2.0.6/configs/ranger-namenode-start.json     |  3 +++
 .../stacks/2.2/configs/ranger-admin-default.json |  3 +++
 .../stacks/2.2/configs/ranger-admin-secured.json |  3 +++
 .../stacks/2.2/configs/ranger-admin-upgrade.json |  5 ++++-
 .../2.2/configs/ranger-usersync-upgrade.json     |  5 ++++-
 9 files changed, 33 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
index 7c69e57..ca77837 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
@@ -22,6 +22,7 @@ from resource_management.libraries.script import Script
 from resource_management.libraries.functions.version import format_hdp_stack_version
 from resource_management.libraries.functions.format import format
 from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.is_empty import is_empty
 
 # a map of the Ambari role to the component name
 # for use with /usr/hdp/current/<component>
@@ -85,6 +86,10 @@ ambari_server_hostname = config['clusterHostInfo']['ambari_server_host'][0]
 db_flavor =  (config['configurations']['admin-properties']['DB_FLAVOR']).lower()
 usersync_exturl =  config['configurations']['admin-properties']['policymgr_external_url']
 ranger_host = config['clusterHostInfo']['ranger_admin_hosts'][0]
+ugsync_host = 'localhost'
+usersync_host_info = config['clusterHostInfo']['ranger_usersync_hosts']
+if not is_empty(usersync_host_info) and len(usersync_host_info) > 0:
+  ugsync_host = config['clusterHostInfo']['ranger_usersync_hosts'][0]
 ranger_external_url = config['configurations']['admin-properties']['policymgr_external_url']
 ranger_db_name = config['configurations']['admin-properties']['db_name']
 ranger_auditdb_name = config['configurations']['admin-properties']['audit_db_name']

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/service_check.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/service_check.py
index 85ac6f5..c7a89fa 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/service_check.py
@@ -17,7 +17,11 @@ limitations under the License.
 
 """
 
-from resource_management import *
+from resource_management.libraries.script import Script
+from resource_management.core.resources.system import Execute
+from resource_management.core.exceptions import ComponentIsNotRunning
+from resource_management.libraries.functions.format import format
+from resource_management.core.logger import Logger
 import os
 
 
@@ -30,8 +34,6 @@ class RangerServiceCheck(Script):
 
     env.set_params(params)
     self.check_ranger_admin_service(params.ranger_external_url)
-    if not params.is_ranger_ha_enabled:
-      self.check_ranger_usersync_service()
 
   def check_ranger_admin_service(self, ranger_external_url):
     if (self.is_ru_rangeradmin_in_progress()):
@@ -40,16 +42,7 @@ class RangerServiceCheck(Script):
       Execute(format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k {ranger_external_url}/login.jsp
| grep 200"),
         tries = 10,
         try_sleep=3,
-        logoutput=True)              
-
-  def check_ranger_usersync_service(self):
-    cmd = 'ps -ef | grep proc_rangerusersync | grep -v grep'
-    code, output = shell.call(cmd, timeout=20)
-    if code == 0:
-      Logger.info('Ranger usersync process up and running')
-    else:
-      Logger.debug('Ranger usersync process not running')
-      raise ComponentIsNotRunning()
+        logoutput=True)
 
   def is_ru_rangeradmin_in_progress(self):
     return os.path.isfile(RangerServiceCheck.upgrade_marker_file)

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
index 77e487f..f41fb4d 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py
@@ -275,12 +275,10 @@ def setup_usersync(rolling_upgrade=False):
   import params
 
   usersync_home = params.usersync_home
-  ranger_home = params.ranger_home
   ranger_ugsync_conf = params.ranger_ugsync_conf
 
   if rolling_upgrade:
     usersync_home = format("/usr/hdp/{version}/ranger-usersync")
-    ranger_home = format("/usr/hdp/{version}/ranger-admin")
     ranger_ugsync_conf = format("/usr/hdp/{version}/ranger-usersync/conf")
 
   Directory(params.ranger_pid_dir,
@@ -325,16 +323,16 @@ def setup_usersync(rolling_upgrade=False):
     File(params.cred_validator_file, group=params.unix_group, mode=04555)
 
   cred_lib = os.path.join(usersync_home,"lib","*")
-  cred_setup_prefix = (format('{ranger_home}/ranger_credential_helper.py'), '-l', cred_lib)
+  cred_setup_prefix = (format('{usersync_home}/ranger_credential_helper.py'), '-l', cred_lib)
 
   cred_setup = cred_setup_prefix + ('-f', params.ugsync_jceks_path, '-k', 'usersync.ssl.key.password',
'-v', PasswordString(params.ranger_usersync_keystore_password), '-c', '1')
-  Execute(cred_setup, environment={'RANGER_ADMIN_HOME':ranger_home, 'JAVA_HOME': params.java_home},
logoutput=True, sudo=True)
+  Execute(cred_setup, environment={'JAVA_HOME': params.java_home}, logoutput=True, sudo=True)
 
   cred_setup = cred_setup_prefix + ('-f', params.ugsync_jceks_path, '-k', 'ranger.usersync.ldap.bindalias',
'-v', PasswordString(params.ranger_usersync_ldap_ldapbindpassword), '-c', '1')
-  Execute(cred_setup, environment={'RANGER_ADMIN_HOME':ranger_home, 'JAVA_HOME': params.java_home},
logoutput=True, sudo=True)
+  Execute(cred_setup, environment={'JAVA_HOME': params.java_home}, logoutput=True, sudo=True)
 
   cred_setup = cred_setup_prefix + ('-f', params.ugsync_jceks_path, '-k', 'usersync.ssl.truststore.password',
'-v', PasswordString(params.ranger_usersync_truststore_password), '-c', '1')
-  Execute(cred_setup, environment={'RANGER_ADMIN_HOME':ranger_home, 'JAVA_HOME': params.java_home},
logoutput=True, sudo=True)
+  Execute(cred_setup, environment={'JAVA_HOME': params.java_home}, logoutput=True, sudo=True)
 
   File(params.ugsync_jceks_path,
        owner = params.unix_user,

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
index 96d6147..49813d8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER/configuration/ranger-admin-site.xml
@@ -389,7 +389,7 @@
 
   <property>
     <name>ranger.unixauth.service.hostname</name>
-    <value>localhost</value>
+    <value>{{ugsync_host}}</value>
     <description>Host where unix authentication service is running - only used if Authentication
method is UNIX</description>
     <value-attributes>
       <overridable>false</overridable>

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/test/python/stacks/2.0.6/configs/ranger-namenode-start.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/ranger-namenode-start.json
b/ambari-server/src/test/python/stacks/2.0.6/configs/ranger-namenode-start.json
index 2a40a46..f90f516 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/configs/ranger-namenode-start.json
+++ b/ambari-server/src/test/python/stacks/2.0.6/configs/ranger-namenode-start.json
@@ -307,6 +307,9 @@
         "ranger_admin_hosts": [
             "c6402.ambari.apache.org"
         ],
+        "ranger_usersync_hosts" : [
+            "c6408.ambari.apache.org"
+        ],
         "ambari_server_host": [
             "hw10897.ix"
         ],

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-default.json b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-default.json
index f39df97..a13f50e 100644
--- a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-default.json
+++ b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-default.json
@@ -299,6 +299,9 @@
         ],
        "ranger_admin_hosts": [
          "c6401.ambari.apache.org"
+        ],
+        "ranger_usersync_hosts" : [
+            "c6408.ambari.apache.org"
         ]
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-secured.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-secured.json b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-secured.json
index 9bb1833..d40a804 100644
--- a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-secured.json
+++ b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-secured.json
@@ -172,6 +172,9 @@
         "ranger_admin_hosts" : [
             "c6401.ambari.apache.org"
         ],
+        "ranger_usersync_hosts" : [
+            "c6408.ambari.apache.org"
+        ],
         "all_hosts": [
             "c6401.ambari.apache.org",
             "c6402.ambari.apache.org"

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json
index c04bdd1..61a7cdc 100644
--- a/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json
+++ b/ambari-server/src/test/python/stacks/2.2/configs/ranger-admin-upgrade.json
@@ -952,7 +952,10 @@
         ], 
         "ranger_admin_hosts": [
             "c6408.ambari.apache.org"
-        ], 
+        ],
+        "ranger_usersync_hosts" : [
+            "c6408.ambari.apache.org"
+        ],
         "journalnode_hosts": [
             "c6408.ambari.apache.org", 
             "c6407.ambari.apache.org", 

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6645794/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json
b/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json
index 977749c..bba7542 100644
--- a/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json
+++ b/ambari-server/src/test/python/stacks/2.2/configs/ranger-usersync-upgrade.json
@@ -951,7 +951,10 @@
         ], 
         "ranger_admin_hosts": [
             "c6408.ambari.apache.org"
-        ], 
+        ],
+        "ranger_usersync_hosts" : [
+            "c6408.ambari.apache.org"
+        ],
         "journalnode_hosts": [
             "c6408.ambari.apache.org", 
             "c6407.ambari.apache.org", 


Mime
View raw message