ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject ambari git commit: AMBARI-17000. Allow ranger admin credentials to be specified during cluster creation (Mugdha Varadkar via sirmanth)
Date Thu, 07 Jul 2016 20:36:20 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 ef6d93cfe -> bc9bc1580


AMBARI-17000. Allow ranger admin credentials to be specified during cluster creation (Mugdha
Varadkar via sirmanth)


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

Branch: refs/heads/branch-2.4
Commit: bc9bc15807215a194c0080b5841d21322fe28851
Parents: ef6d93c
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Thu Jul 7 13:34:21 2016 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Thu Jul 7 13:36:02 2016 -0700

----------------------------------------------------------------------
 .../resource_management/libraries/functions/constants.py     | 1 +
 .../common-services/RANGER/0.4.0/package/scripts/params.py   | 8 +++++++-
 .../RANGER/0.4.0/package/scripts/ranger_admin.py             | 5 ++++-
 .../RANGER/0.4.0/package/scripts/setup_ranger_xml.py         | 8 ++++++++
 .../stacks/HDP/2.0.6/properties/stack_features.json          | 5 +++++
 5 files changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bc9bc158/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
index 85e04e7..cd73049 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
@@ -92,3 +92,4 @@ class StackFeature:
   ATLAS_UPGRADE_SUPPORT = "atlas_upgrade_support"
   RANGER_PID_SUPPORT = "ranger_pid_support"
   RANGER_KMS_PID_SUPPORT = "ranger_kms_pid_support"
+  RANGER_ADMIN_PASSWD_CHANGE = "ranger_admin_password_change"

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc9bc158/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 a85bde0..fad4b9b 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
@@ -66,6 +66,7 @@ stack_supports_ranger_kerberos = stack_version_formatted and check_stack_feature
 stack_supports_usersync_passwd = stack_version_formatted and check_stack_feature(StackFeature.RANGER_USERSYNC_PASSWORD_JCEKS,
stack_version_formatted)
 stack_supports_logsearch_client = stack_version_formatted and check_stack_feature(StackFeature.RANGER_INSTALL_LOGSEARCH_CLIENT,
stack_version_formatted)
 stack_supports_pid = stack_version_formatted and check_stack_feature(StackFeature.RANGER_PID_SUPPORT,
stack_version_formatted)
+stack_supports_ranger_admin_password_change = stack_version_formatted and check_stack_feature(StackFeature.RANGER_ADMIN_PASSWD_CHANGE,
stack_version_formatted)
 
 downgrade_from_version = default("/commandParams/downgrade_from_version", None)
 upgrade_direction = default("/commandParams/upgrade_direction", None)
@@ -349,4 +350,9 @@ restart_type = default("/commandParams/restart_type", "")
 # ranger service pid
 user_group = config['configurations']['cluster-env']['user_group']
 ranger_admin_pid_file = format('{ranger_pid_dir}/rangeradmin.pid')
-ranger_usersync_pid_file = format('{ranger_pid_dir}/usersync.pid')
\ No newline at end of file
+ranger_usersync_pid_file = format('{ranger_pid_dir}/usersync.pid')
+
+# admin credential
+admin_username = config['configurations']['ranger-env']['admin_username']
+admin_password = config['configurations']['ranger-env']['admin_password']
+default_admin_password = 'admin'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc9bc158/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
index c6e5b70..529ac8c 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_admin.py
@@ -29,7 +29,7 @@ from resource_management.libraries.functions.format import format
 from resource_management.core.logger import Logger
 from resource_management.core import shell
 from ranger_service import ranger_service
-from setup_ranger_xml import setup_ranger_audit_solr
+from setup_ranger_xml import setup_ranger_audit_solr, setup_ranger_admin_passwd_change
 from resource_management.libraries.functions import solr_cloud_util
 import upgrade
 import os, errno
@@ -53,6 +53,9 @@ class RangerAdmin(Script):
       from setup_ranger_xml import setup_java_patch
       setup_java_patch()
 
+    if params.stack_supports_ranger_admin_password_change:
+      setup_ranger_admin_passwd_change()
+
   def stop(self, env, upgrade_type=None):
     import params
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc9bc158/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 5e675e6..eac4aee 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
@@ -584,3 +584,11 @@ def setup_ranger_audit_solr():
     shards = params.ranger_solr_shards,
     replication_factor = int(params.replication_factor),
     jaas_file = params.solr_jaas_file)
+
+def setup_ranger_admin_passwd_change():
+  import params
+
+  if params.admin_password != params.default_admin_password:
+    cmd = format('ambari-python-wrap {ranger_home}/db_setup.py -changepassword {admin_username}
{default_admin_password!p} {admin_password!p}')
+    Logger.info('Updating admin password')
+    Execute(cmd, environment={'JAVA_HOME': params.java_home, 'RANGER_ADMIN_HOME': params.ranger_home},
user=params.unix_user)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc9bc158/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
index ca000d1..7f85ad3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_features.json
@@ -260,6 +260,11 @@
       "name": "ranger_kms_pid_support",
       "description": "Ranger KMS Service support pid generation",
       "min_version": "2.5.0.0"
+    },
+    {
+      "name": "ranger_admin_password_change",
+      "description": "Allow ranger admin credentials to be specified during cluster creation
(AMBARI-17000)",
+      "min_version": "2.5.0.0"
     }
   ]
 }


Mime
View raw message