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-22669 Ranger stack script changes to fix missing directory failure for blueprint installation (mugdha)
Date Tue, 26 Dec 2017 04:47:41 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk cfed3fb9d -> 9c7f1b7aa


AMBARI-22669 Ranger stack script changes to fix missing directory failure for blueprint installation
(mugdha)


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

Branch: refs/heads/trunk
Commit: 9c7f1b7aa9d04bea2f7e68a64fd242f20c86b521
Parents: cfed3fb
Author: Mugdha Varadkar <mugdha@apache.org>
Authored: Tue Dec 19 15:42:46 2017 +0530
Committer: Mugdha Varadkar <mugdha@apache.org>
Committed: Tue Dec 26 10:16:52 2017 +0530

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/params.py       |  4 ++--
 .../RANGER/0.4.0/package/scripts/ranger_admin.py | 10 ++++++----
 .../0.4.0/package/scripts/setup_ranger_xml.py    | 19 ++++++-------------
 .../RANGER_KMS/0.5.0.2.3/package/scripts/kms.py  | 13 ++++---------
 .../0.5.0.2.3/package/scripts/kms_server.py      |  6 ++++--
 .../stacks/2.6/RANGER/test_ranger_admin.py       | 10 +++++-----
 6 files changed, 27 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9c7f1b7a/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 5731e6c..aac94f3 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
@@ -94,11 +94,11 @@ ranger_tagsync_truststore_password = config['configurations']['ranger-tagsync-po
 atlas_tagsync_keystore_password = config['configurations']['atlas-tagsync-ssl']['xasecure.policymgr.clientssl.keystore.password']
 atlas_tagsync_truststore_password = config['configurations']['atlas-tagsync-ssl']['xasecure.policymgr.clientssl.truststore.password']
 
-if upgrade_direction == Direction.DOWNGRADE and version and not check_stack_feature(StackFeature.CONFIG_VERSIONING,
version):
+if upgrade_direction == Direction.DOWNGRADE and not check_stack_feature(StackFeature.CONFIG_VERSIONING,
version_for_stack_feature_checks):
   stack_supports_rolling_upgrade = True
   stack_supports_config_versioning = False
 
-if upgrade_direction == Direction.DOWNGRADE and version and not check_stack_feature(StackFeature.RANGER_USERSYNC_NON_ROOT,
version):
+if upgrade_direction == Direction.DOWNGRADE and not check_stack_feature(StackFeature.RANGER_USERSYNC_NON_ROOT,
version_for_stack_feature_checks):
   stack_supports_usersync_non_root = False
 
 if stack_supports_rolling_upgrade:

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c7f1b7a/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 d0a725a..2dd13ba 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
@@ -175,10 +175,11 @@ class RangerAdmin(Script):
     stack_version = upgrade_stack[1]
 
     if params.xml_configurations_supported and params.upgrade_direction == Direction.UPGRADE:
-      Logger.info(format('Setting Ranger database schema, using version {stack_version}'))
+      target_version = upgrade_summary.get_target_version("RANGER", default_version = stack_version)
+      Logger.info(format('Setting Ranger database schema, using version {target_version}'))
 
       from setup_ranger_xml import setup_ranger_db
-      setup_ranger_db(stack_version=stack_version)
+      setup_ranger_db(stack_version = target_version)
 
   def setup_ranger_java_patches(self, env):
     import params
@@ -191,10 +192,11 @@ class RangerAdmin(Script):
     stack_version = upgrade_stack[1]
 
     if params.xml_configurations_supported and params.upgrade_direction == Direction.UPGRADE:
-      Logger.info(format('Applying Ranger java patches, using version {stack_version}'))
+      target_version = upgrade_summary.get_target_version("RANGER", default_version = stack_version)
+      Logger.info(format('Applying Ranger java patches, using version {target_version}'))
 
       from setup_ranger_xml import setup_java_patch
-      setup_java_patch(stack_version=stack_version)
+      setup_java_patch(stack_version = target_version)
 
   def set_pre_start(self, env):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c7f1b7a/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 9b1f6e2..ff41cdd 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
@@ -68,7 +68,7 @@ def setup_ranger_admin(upgrade_type=None):
     create_parents = True
   )
 
-  copy_jdbc_connector()
+  copy_jdbc_connector(ranger_home)
 
   File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"),
     content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")),
@@ -256,12 +256,11 @@ def setup_ranger_db(stack_version=None):
   import params
   
   ranger_home = params.ranger_home
-  version = params.version
+
   if stack_version is not None:
     ranger_home = format("{stack_root}/{stack_version}/ranger-admin")
-    version = stack_version
 
-  copy_jdbc_connector(stack_version=version)
+  copy_jdbc_connector(ranger_home)
 
   ModifyPropertiesFile(format("{ranger_home}/install.properties"),
     properties = {'audit_store': params.ranger_audit_source_type},
@@ -291,11 +290,11 @@ def setup_ranger_db(stack_version=None):
           user=params.unix_user,
   )
 
-
 def setup_java_patch(stack_version=None):
   import params
 
   ranger_home = params.ranger_home
+
   if stack_version is not None:
     ranger_home = format("{stack_root}/{stack_version}/ranger-admin")
 
@@ -310,7 +309,6 @@ def setup_java_patch(stack_version=None):
           user=params.unix_user,
   )
 
-
 def do_keystore_setup(upgrade_type=None):
   import params
 
@@ -382,7 +380,7 @@ def password_validation(password):
   else:
     Logger.info("password validated")
 
-def copy_jdbc_connector(stack_version=None):
+def copy_jdbc_connector(ranger_home):
   import params
 
   if params.jdbc_jar_name is None and params.driver_curl_source.endswith("/None"):
@@ -398,10 +396,6 @@ def copy_jdbc_connector(stack_version=None):
     mode = 0644
   )
 
-  ranger_home = params.ranger_home
-  if stack_version is not None:
-    ranger_home = format("{stack_root}/{stack_version}/ranger-admin")
-
   driver_curl_target = format("{ranger_home}/ews/lib/{jdbc_jar_name}")
 
   if params.db_flavor.lower() == 'sqla':
@@ -441,7 +435,7 @@ def copy_jdbc_connector(stack_version=None):
       properties = {'SQL_CONNECTOR_JAR': format('{driver_curl_target}')},
        owner = params.unix_user,
     )
- 
+
 def setup_usersync(upgrade_type=None):
   import params
 
@@ -803,7 +797,6 @@ def get_ranger_plugin_principals(services_defaults_tuple_list):
     user_principals.append(user_principal)
   return user_principals
 
-
 def setup_tagsync_ssl_configs():
   import params
   Directory(params.security_store_path,

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c7f1b7a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
index bbc438b..58c9669 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms.py
@@ -57,14 +57,13 @@ def setup_kms_db(stack_version=None):
   if params.has_ranger_admin:
 
     kms_home = params.kms_home
-    version = params.version
+
     if stack_version is not None:
       kms_home = format("{stack_root}/{stack_version}/ranger-kms")
-      version = stack_version
 
     password_validation(params.kms_master_key_password, 'KMS master key')
 
-    copy_jdbc_connector(stack_version=version)
+    copy_jdbc_connector(kms_home)
 
     env_dict = {'RANGER_KMS_HOME':kms_home, 'JAVA_HOME': params.java_home}
     if params.db_flavor.lower() == 'sqla':
@@ -150,7 +149,7 @@ def kms(upgrade_type=None):
       cd_access = "a"
     )
 
-    copy_jdbc_connector()
+    copy_jdbc_connector(params.kms_home)
 
     File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"),
       content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")),
@@ -345,7 +344,7 @@ def kms(upgrade_type=None):
     else:
       File(format('{kms_conf_dir}/core-site.xml'), action="delete")
 
-def copy_jdbc_connector(stack_version=None):
+def copy_jdbc_connector(kms_home):
   import params
 
   if params.jdbc_jar_name is None and params.driver_curl_source.endswith("/None"):
@@ -357,10 +356,6 @@ def copy_jdbc_connector(stack_version=None):
     if params.previous_jdbc_jar and os.path.isfile(params.previous_jdbc_jar):
       File(params.previous_jdbc_jar, action='delete')
 
-  kms_home = params.kms_home
-  if stack_version is not None:
-    kms_home = format("{stack_root}/{stack_version}/ranger-kms")
-
   driver_curl_target = format("{kms_home}/ews/webapp/lib/{jdbc_jar_name}")
 
   File(params.downloaded_custom_connector,

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c7f1b7a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
index 0b37489..6b0ab7a 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
@@ -20,6 +20,7 @@ limitations under the License.
 from resource_management.core.exceptions import Fail
 from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import upgrade_summary
 from resource_management.libraries.script import Script
 from resource_management.core.resources.system import Execute, File
 from resource_management.core.exceptions import ComponentIsNotRunning
@@ -107,8 +108,9 @@ class KmsServer(Script):
       raise Fail('Unable to determine the stack and stack version')
 
     stack_version = upgrade_stack[1]
-    Logger.info(format('Setting Ranger KMS database schema, using version {stack_version}'))
-    kms.setup_kms_db(stack_version=stack_version)
+    target_version = upgrade_summary.get_target_version("RANGER_KMS", default_version = stack_version)
+    Logger.info(format('Setting Ranger KMS database schema, using version {target_version}'))
+    kms.setup_kms_db(stack_version = target_version)
     
   def get_log_folder(self):
     import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/9c7f1b7a/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py b/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
index e8bacbd..6e9b899 100644
--- a/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
+++ b/ambari-server/src/test/python/stacks/2.6/RANGER/test_ranger_admin.py
@@ -198,24 +198,24 @@ class TestRangerAdmin(RMFTestCase):
                               )
 
     self.assertResourceCalled('Execute', ('cp', '--remove-destination', '/tmp/mysql-connector-java.jar',
-                                          '/usr/hdp/2.6.0.0-801/ranger-admin/ews/lib'),
+                                          '/usr/hdp/current/ranger-admin/ews/lib'),
                               sudo = True,
                               path = ['/bin', '/usr/bin/']
                               )
 
-    self.assertResourceCalled('File', '/usr/hdp/2.6.0.0-801/ranger-admin/ews/lib/mysql-connector-java.jar',
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java.jar',
                               mode = 0644
                               )
 
-    self.assertResourceCalled('ModifyPropertiesFile', '/usr/hdp/2.6.0.0-801/ranger-admin/install.properties',
+    self.assertResourceCalled('ModifyPropertiesFile', '/usr/hdp/current/ranger-admin/install.properties',
                               properties = self.getConfig()['configurations']['admin-properties'],
                               owner = 'ranger'
                               )
 
-    self.assertResourceCalled('ModifyPropertiesFile', '/usr/hdp/2.6.0.0-801/ranger-admin/install.properties',
+    self.assertResourceCalled('ModifyPropertiesFile', '/usr/hdp/current/ranger-admin/install.properties',
                               owner = 'ranger',
                               properties = {'SQL_CONNECTOR_JAR':
-                                              '/usr/hdp/2.6.0.0-801/ranger-admin/ews/lib/mysql-connector-java.jar'}
+                                              '/usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java.jar'}
                               )
     self.assertResourceCalled('ModifyPropertiesFile', '/usr/hdp/current/ranger-admin/install.properties',
                               owner = 'ranger',


Mime
View raw message