ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject ambari git commit: AMBARI-17945 - Ranger UserSync restart failed during EU from 2.2.9 to 2.4.2 (Mugdha Varadkar via jonathanhurley)
Date Fri, 29 Jul 2016 23:28:21 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 42e65aa80 -> c6cdafd20


AMBARI-17945 - Ranger UserSync restart failed during EU from 2.2.9 to 2.4.2 (Mugdha Varadkar
via jonathanhurley)


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

Branch: refs/heads/branch-2.4
Commit: c6cdafd20b35e82bdccb15583b4ac4e6e0aec7a8
Parents: 42e65aa
Author: Jonathan Hurley <jhurley@hortonworks.com>
Authored: Fri Jul 29 19:26:29 2016 -0400
Committer: Jonathan Hurley <jhurley@hortonworks.com>
Committed: Fri Jul 29 19:28:14 2016 -0400

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/ranger_admin.py    | 11 ++++++++++-
 .../RANGER/0.4.0/package/scripts/ranger_usersync.py | 16 +++++++++++++++-
 .../0.5.0.2.3/package/scripts/kms_server.py         |  4 ++--
 .../0.5.0.2.3/package/scripts/kms_service.py        | 13 +++++++++++--
 .../RANGER_KMS/0.5.0.2.3/package/scripts/params.py  |  1 +
 .../stacks/HDP/2.2/upgrades/config-upgrade.xml      |  5 +++++
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml     |  4 ++++
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml     |  4 ++++
 .../stacks/HDP/2.2/upgrades/upgrade-2.3.xml         |  2 ++
 .../stacks/HDP/2.2/upgrades/upgrade-2.4.xml         |  1 +
 10 files changed, 55 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/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 fd6899f..a9656c7 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
@@ -31,6 +31,8 @@ from resource_management.core import shell
 from ranger_service import ranger_service
 from setup_ranger_xml import setup_ranger_audit_solr, setup_ranger_admin_passwd_change
 from resource_management.libraries.functions import solr_cloud_util
+from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING
+from resource_management.libraries.functions.constants import Direction
 import upgrade
 import os, errno
 
@@ -58,8 +60,15 @@ class RangerAdmin(Script):
 
   def stop(self, env, upgrade_type=None):
     import params
-
     env.set_params(params)
+
+    if upgrade_type == UPGRADE_TYPE_NON_ROLLING and params.upgrade_direction == Direction.UPGRADE:
+      if params.stack_supports_rolling_upgrade and not params.stack_supports_config_versioning
and os.path.isfile(format('{ranger_home}/ews/stop-ranger-admin.sh')):
+        File(format('{ranger_home}/ews/stop-ranger-admin.sh'),
+          owner=params.unix_user,
+          group = params.unix_group
+        )
+
     Execute(format('{params.ranger_stop}'), environment={'JAVA_HOME': params.java_home},
user=params.unix_user)
     if params.stack_supports_pid:
       File(params.ranger_admin_pid_file,

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
index 5ce0617..b9366f6 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
@@ -25,7 +25,10 @@ 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 ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING
+from resource_management.libraries.functions.constants import Direction
 import upgrade
+import os
 
 class RangerUsersync(Script):
   
@@ -67,7 +70,18 @@ class RangerUsersync(Script):
   def stop(self, env, upgrade_type=None):
     import params
     env.set_params(params)
-    
+
+    if upgrade_type == UPGRADE_TYPE_NON_ROLLING and params.upgrade_direction == Direction.UPGRADE:
+      if params.stack_supports_usersync_non_root and os.path.isfile(params.usersync_services_file):
+        File(params.usersync_services_file,
+          mode = 0755
+        )
+        Execute(('ln','-sf', format('{usersync_services_file}'),'/usr/bin/ranger-usersync'),
+          not_if=format("ls /usr/bin/ranger-usersync"),
+          only_if=format("ls {usersync_services_file}"),
+          sudo=True
+        )
+
     Execute((params.usersync_stop,), environment={'JAVA_HOME': params.java_home}, sudo=True)
     if params.stack_supports_pid:
       File(params.ranger_usersync_pid_file,

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/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 cbdcc8c..44d61da 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
@@ -49,7 +49,7 @@ class KmsServer(Script):
     import params
 
     env.set_params(params)
-    kms_service(action = 'stop')
+    kms_service(action = 'stop', upgrade_type=upgrade_type)
     if params.stack_supports_pid:
       File(params.ranger_kms_pid_file,
         action = "delete"
@@ -62,7 +62,7 @@ class KmsServer(Script):
     self.configure(env)
     enable_kms_plugin()
     setup_kms_jce()
-    kms_service(action = 'start')
+    kms_service(action = 'start', upgrade_type=upgrade_type)
 
   def status(self, env):
     import status_params

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_service.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_service.py
index 55c0486..2ff48c3 100644
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_service.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_service.py
@@ -18,14 +18,17 @@ limitations under the License.
 
 """
 
-from resource_management.core.resources.system import Execute
+from resource_management.core.resources.system import Execute, File
 from resource_management.core import shell
 from resource_management.libraries.functions.format import format
 from resource_management.core.exceptions import ComponentIsNotRunning
 from resource_management.core.logger import Logger
 from resource_management.libraries.functions.show_logs import show_logs
+from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING
+from resource_management.libraries.functions.constants import Direction
+import os
 
-def kms_service(action='start'):
+def kms_service(action='start', upgrade_type=None):
   import params
 
   env_dict = {'JAVA_HOME': params.java_home}
@@ -41,6 +44,12 @@ def kms_service(action='start'):
       show_logs(params.kms_log_dir, params.kms_user)
       raise
   elif action == 'stop':
+    if upgrade_type == UPGRADE_TYPE_NON_ROLLING and params.upgrade_direction == Direction.UPGRADE:
+      if os.path.isfile(format('{kms_home}/ranger-kms')):
+        File(format('{kms_home}/ranger-kms'),
+          owner=params.kms_user,
+          group = params.kms_group
+        )
     cmd = format('{kms_home}/ranger-kms stop')
     try:
       Execute(cmd, environment=env_dict, user=format('{kms_user}'))

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
index 4888aa6..c20bdde 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
@@ -35,6 +35,7 @@ stack_root = Script.get_stack_root()
 
 stack_name = default("/hostLevelParams/stack_name", None)
 version = default("/commandParams/version", None)
+upgrade_direction = default("/commandParams/upgrade_direction", None)
 
 stack_version_unformatted = config['hostLevelParams']['stack_version']
 stack_version_formatted = format_stack_version(stack_version_unformatted)

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml
index 95310d5..402e349 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/config-upgrade.xml
@@ -656,6 +656,11 @@
             <set key="xasecure.audit.destination.solr" value="false"/>
           </definition>
 
+           <definition xsi:type="configure" id="hdp_2_3_0_0_set_ranger_admin_ssl_flag">
+            <type>ranger-admin-site</type>
+            <set key="ranger.service.https.attrib.ssl.enabled" value="true" if-type="ranger-site"
if-key="http.enabled" if-value="false" />
+          </definition>
+
           <definition xsi:type="configure" id="hdp_2_3_0_0_update_ranger_admin" summary="Updating
Ranger Admin">
             <type>ranger-admin-site</type>
             <transfer operation="copy" from-type="ranger-site" from-key="https.attrib.clientAuth"

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
index 6e7e272..a8ecc46 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml
@@ -260,6 +260,10 @@
       </execute-stage>
 
       <execute-stage service="RANGER" component="RANGER_ADMIN" title="Apply config changes
for Ranger">
+        <task xsi:type="configure" id="hdp_2_3_0_0_set_ranger_admin_ssl_flag"/>
+      </execute-stage>
+
+      <execute-stage service="RANGER" component="RANGER_ADMIN" title="Apply config changes
for Ranger">
         <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_admin"/>
       </execute-stage>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
index b368db3..98601c9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml
@@ -290,6 +290,10 @@
       </execute-stage>
 
       <execute-stage service="RANGER" component="RANGER_ADMIN" title="Apply config changes
for Ranger">
+        <task xsi:type="configure" id="hdp_2_3_0_0_set_ranger_admin_ssl_flag"/>
+      </execute-stage>
+
+      <execute-stage service="RANGER" component="RANGER_ADMIN" title="Apply config changes
for Ranger">
         <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_admin"/>
       </execute-stage>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
index 9eb4a44..03849e9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.3.xml
@@ -451,6 +451,8 @@
             <function>stop</function>
           </task>
 
+          <task xsi:type="configure" id="hdp_2_3_0_0_set_ranger_admin_ssl_flag"/>
+
           <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_env"/>
           <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_admin"/>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c6cdafd2/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
index e67b82c..2059fa7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/upgrades/upgrade-2.4.xml
@@ -455,6 +455,7 @@
             <script>scripts/ranger_admin.py</script>
             <function>stop</function>
           </task>
+          <task xsi:type="configure" id="hdp_2_3_0_0_set_ranger_admin_ssl_flag"/>
 
           <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_env"/>
           <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_admin"/>


Mime
View raw message