You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ga...@apache.org on 2016/06/22 04:52:34 UTC

[2/2] ambari git commit: AMBARI-17165. Handle Java patches execution during Ranger upgrade(Mugdha Varadkar via gautam)

AMBARI-17165. Handle Java patches execution during Ranger upgrade(Mugdha Varadkar via gautam)


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

Branch: refs/heads/branch-2.4
Commit: 8d023a2017fcf76facf70d70121d34bd9fce7922
Parents: f814c5f
Author: Gautam Borad <ga...@apache.org>
Authored: Tue Jun 21 17:34:51 2016 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Wed Jun 22 10:22:21 2016 +0530

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/params.py      |  2 ++
 .../0.4.0/package/scripts/ranger_admin.py       | 20 ++++++++++--
 .../0.4.0/package/scripts/setup_ranger_xml.py   |  7 +++++
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.3.xml | 20 +++++++-----
 .../HDP/2.2/upgrades/nonrolling-upgrade-2.4.xml | 21 ++++++++-----
 .../stacks/HDP/2.2/upgrades/upgrade-2.3.xml     | 27 +++++++++++-----
 .../stacks/HDP/2.2/upgrades/upgrade-2.4.xml     | 27 +++++++++++-----
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml | 29 +++++++----------
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml | 29 +++++++----------
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml | 29 +++++++----------
 .../stacks/HDP/2.3/upgrades/upgrade-2.3.xml     | 33 +++++++++-----------
 .../stacks/HDP/2.3/upgrades/upgrade-2.4.xml     | 33 +++++++++-----------
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     | 33 +++++++++-----------
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml | 29 +++++++----------
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml | 29 +++++++----------
 .../stacks/HDP/2.4/upgrades/upgrade-2.4.xml     | 33 +++++++++-----------
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     | 33 +++++++++-----------
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml | 29 +++++++----------
 .../stacks/HDP/2.5/upgrades/upgrade-2.5.xml     | 33 +++++++++-----------
 19 files changed, 248 insertions(+), 248 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/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 9e0fb7c..44fe3e3 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
@@ -312,3 +312,5 @@ if stack_supports_ranger_kerberos and not has_namenode:
 
     core_site_auth_to_local_property = core_site_auth_to_local_property + 'DEFAULT'
     core_site_property['hadoop.security.auth_to_local'] = core_site_auth_to_local_property
+
+restart_type = default("/commandParams/restart_type", "")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/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 cedb3f9..0d9ce5f 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
@@ -18,6 +18,8 @@ limitations under the License.
 
 """
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import conf_select
+from resource_management.libraries.functions.constants import Direction
 from resource_management.libraries.script import Script
 from resource_management.core.resources.system import Execute
 from resource_management.core.exceptions import ComponentIsNotRunning
@@ -133,7 +135,7 @@ class RangerAdmin(Script):
 
     stack_version = upgrade_stack[1]
 
-    if params.xml_configurations_supported:
+    if params.xml_configurations_supported and params.upgrade_direction == Direction.UPGRADE:
       Logger.info(format('Setting Ranger database schema, using version {stack_version}'))
 
       from setup_ranger_xml import setup_ranger_db
@@ -149,12 +151,26 @@ class RangerAdmin(Script):
 
     stack_version = upgrade_stack[1]
 
-    if params.xml_configurations_supported:
+    if params.xml_configurations_supported and params.upgrade_direction == Direction.UPGRADE:
       Logger.info(format('Applying Ranger java patches, using version {stack_version}'))
 
       from setup_ranger_xml import setup_java_patch
       setup_java_patch(stack_version=stack_version)
 
+  def set_pre_start(self, env):
+    import params
+    env.set_params(params)
+
+    upgrade_stack = stack_select._get_upgrade_stack()
+    if upgrade_stack is None:
+      raise Fail('Unable to determine the stack and stack version')
+
+    stack_name = upgrade_stack[0]
+    stack_version = upgrade_stack[1]
+
+    stack_select.select("ranger-admin", stack_version)
+    conf_select.select(stack_name, "ranger-admin", stack_version)
+
   def get_log_folder(self):
     import params
     return params.admin_log_dir

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/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 4db9f10..ad0ac60 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
@@ -32,6 +32,7 @@ from resource_management.libraries.functions.is_empty import is_empty
 from resource_management.core.utils import PasswordString
 from resource_management.core.shell import as_sudo
 from resource_management.libraries.functions import solr_cloud_util
+from ambari_commons.constants import UPGRADE_TYPE_NON_ROLLING, UPGRADE_TYPE_ROLLING
 
 # This file contains functions used for setup/configure of Ranger Admin and Ranger Usersync.
 # The design is to mimic what is done by the setup.sh script bundled by Ranger component currently.
@@ -52,6 +53,12 @@ def ranger(name=None, upgrade_type=None):
 def setup_ranger_admin(upgrade_type=None):
   import params
 
+  if upgrade_type is None:
+    if params.restart_type.lower() == "rolling_upgrade":
+      upgrade_type = UPGRADE_TYPE_ROLLING
+    elif params.restart_type.lower() == "nonrolling_upgrade":
+      upgrade_type = UPGRADE_TYPE_NON_ROLLING
+
   ranger_home = params.ranger_home
   ranger_conf = params.ranger_conf
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/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 4fd5801..d0f7f83 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
@@ -875,22 +875,28 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
+            <script>scripts/ranger_admin.py</script>
+            <function>set_pre_start</function>
+          </task>
+
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
+
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
+            <script>scripts/ranger_admin.py</script>
+            <function>setup_ranger_java_patches</function>
+          </task>
         </pre-upgrade>
 
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-upgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/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 272a3cc..91a18b9 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
@@ -939,22 +939,29 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+
+          <task xsi:type="execute" hosts="all">
+            <script>scripts/ranger_admin.py</script>
+            <function>set_pre_start</function>
+          </task>
+
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
+
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
+            <script>scripts/ranger_admin.py</script>
+            <function>setup_ranger_java_patches</function>
+          </task>
         </pre-upgrade>
 
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-upgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/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 41d3510..ea9a274 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
@@ -445,6 +445,11 @@
       <component name="RANGER_ADMIN">
         <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <pre-upgrade>
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
+            <script>scripts/ranger_admin.py</script>
+            <function>stop</function>
+          </task>
+
           <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"/>
 
@@ -464,22 +469,28 @@
 
           <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_admin_db_audit"/>
 
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
+            <script>scripts/ranger_admin.py</script>
+            <function>set_pre_start</function>
+          </task>
+
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
+
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
+            <script>scripts/ranger_admin.py</script>
+            <function>setup_ranger_java_patches</function>
+          </task>
         </pre-upgrade>
-      
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-upgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/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 daf0831..03b1e05 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
@@ -450,6 +450,11 @@
       <component name="RANGER_ADMIN">
         <pre-downgrade/> <!--  no-op to prevent config changes on downgrade -->
         <pre-upgrade>
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
+            <script>scripts/ranger_admin.py</script>
+            <function>stop</function>
+          </task>
+
           <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"/>
 
@@ -469,22 +474,28 @@
 
           <task xsi:type="configure" id="hdp_2_3_0_0_update_ranger_admin_db_audit"/>
 
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
+            <script>scripts/ranger_admin.py</script>
+            <function>set_pre_start</function>
+          </task>
+
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
+
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
+            <script>scripts/ranger_admin.py</script>
+            <function>setup_ranger_java_patches</function>
+          </task>
         </pre-upgrade>
-      
+
         <upgrade>
           <task xsi:type="restart-task"/>
         </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-upgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
index 111b432..432657f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.3.xml
@@ -665,36 +665,29 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
index 9365646..d5c4108 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.4.xml
@@ -699,36 +699,29 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index 42c4979..5163079 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -777,36 +777,29 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
index c4539ac..30175ab 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.3.xml
@@ -456,36 +456,33 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>stop</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-downgrade>
-
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
+            <function>setup_ranger_database</function>
           </task>
-        </post-upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-downgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
+
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
index 5284d7a..54aec3f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.4.xml
@@ -480,36 +480,33 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>stop</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-downgrade>
-
-        <upgrade>
-          <task xsi:type="restart-task" />
-        </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
+            <function>setup_ranger_database</function>
           </task>
-        </post-upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-downgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
+
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
index f03e21c..48eebd3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
@@ -487,6 +487,11 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
+            <script>scripts/ranger_admin.py</script>
+            <function>stop</function>
+          </task>
+
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_audit_db_flag" />
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_audit_db_admin_properties" />
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_audit_db_ranger_admin_site" />
@@ -494,36 +499,28 @@
 
           <task xsi:type="server_action" summary="Calculating Ranger Properties" class="org.apache.ambari.server.serveraction.upgrades.RangerKerberosConfigCalculation"/>
 
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task" />
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
index e83b54b..5b2860a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.4.xml
@@ -660,36 +660,29 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index b1c2468d..97662e2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -738,36 +738,29 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
index e08cbd4..ea4cf17 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.4.xml
@@ -454,36 +454,33 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>stop</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-downgrade>
-
-        <upgrade>
-          <task xsi:type="restart-task" />
-        </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
+            <function>setup_ranger_database</function>
           </task>
-        </post-upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-downgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
+
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
index 1193c06..dc81564 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
@@ -482,6 +482,11 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
+            <script>scripts/ranger_admin.py</script>
+            <function>stop</function>
+          </task>
+
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_audit_db_flag" />
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_audit_db_admin_properties" />
           <task xsi:type="configure" id="hdp_2_5_0_0_remove_audit_db_ranger_admin_site" />
@@ -489,36 +494,28 @@
 
           <task xsi:type="server_action" summary="Calculating Ranger Properties" class="org.apache.ambari.server.serveraction.upgrades.RangerKerberosConfigCalculation"/>
 
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task" />
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
index 460e6b3..0a9a1f0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml
@@ -661,36 +661,29 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_database</function>
           </task>
-        </pre-downgrade>
 
-        <upgrade>
-          <task xsi:type="restart-task"/>
-        </upgrade>
+          <task xsi:type="configure_function" hosts="all" />
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-upgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
-            <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
-          </task>
-        </post-downgrade>
       </component>
 
       <component name="RANGER_USERSYNC">

http://git-wip-us.apache.org/repos/asf/ambari/blob/8d023a20/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
index 1d91730..ae87268 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml
@@ -457,36 +457,33 @@
     <service name="RANGER">
       <component name="RANGER_ADMIN">
         <pre-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Upgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all" summary="Stop Ranger Admin">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>stop</function>
           </task>
-        </pre-upgrade>
 
-        <pre-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Downgrading Ranger database schema">
+          <task xsi:type="execute" hosts="all">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_database</function>
+            <function>set_pre_start</function>
           </task>
-        </pre-downgrade>
-
-        <upgrade>
-          <task xsi:type="restart-task" />
-        </upgrade>
 
-        <post-upgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="execute" hosts="any" summary="Upgrading Ranger database schema">
             <script>scripts/ranger_admin.py</script>
-            <function>setup_ranger_java_patches</function>
+            <function>setup_ranger_database</function>
           </task>
-        </post-upgrade>
 
-        <post-downgrade>
-          <task xsi:type="execute" hosts="any" sequential="true" summary="Applying Ranger java patches">
+          <task xsi:type="configure_function" hosts="all" />
+
+          <task xsi:type="execute" hosts="any" summary="Applying Ranger java patches">
             <script>scripts/ranger_admin.py</script>
             <function>setup_ranger_java_patches</function>
           </task>
-        </post-downgrade>
+        </pre-upgrade>
+
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
+
       </component>
 
       <component name="RANGER_USERSYNC">