ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject [3/3] ambari git commit: AMBARI-16756. Update code for Ranger Service to use PID file for status and stop call (Mugdha Varadkar via srimanth)
Date Mon, 27 Jun 2016 20:27:14 GMT
AMBARI-16756. Update code for Ranger Service to use PID file for status and stop call (Mugdha
Varadkar via srimanth)


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

Branch: refs/heads/branch-2.4
Commit: ad23a68e0c074639b59548b7ebad27b49d52cef5
Parents: 33f1597
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Mon Jun 27 13:26:24 2016 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Mon Jun 27 13:27:03 2016 -0700

----------------------------------------------------------------------
 .../libraries/functions/constants.py            |   2 +
 .../RANGER/0.4.0/configuration/ranger-env.xml   |   5 +
 .../RANGER/0.4.0/package/scripts/params.py      |   8 +-
 .../0.4.0/package/scripts/ranger_admin.py       |  14 +-
 .../0.4.0/package/scripts/ranger_usersync.py    |  12 +
 .../0.4.0/package/scripts/setup_ranger_xml.py   |  20 +-
 .../0.4.0/package/scripts/status_params.py      |  10 +-
 .../RANGER_KMS/0.5.0.2.3/package/scripts/kms.py |   8 +
 .../0.5.0.2.3/package/scripts/kms_server.py     |  17 +-
 .../0.5.0.2.3/package/scripts/params.py         |   6 +
 .../0.5.0.2.3/package/scripts/status_params.py  |  36 +
 .../HDP/2.0.6/properties/stack_features.json    |  10 +
 .../RANGER_KMS/configuration/kms-env.xml        |  11 +
 .../stacks/2.5/RANGER/test_ranger_admin.py      | 232 ++++++
 .../stacks/2.5/RANGER/test_ranger_tagsync.py    | 157 ++++
 .../stacks/2.5/RANGER/test_ranger_usersync.py   | 196 +++++
 .../2.5/configs/ranger-admin-default.json       | 661 +++++++++++++++++
 .../2.5/configs/ranger-admin-secured.json       | 729 +++++++++++++++++++
 18 files changed, 2123 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 be2a4c8..c46309e 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
@@ -90,3 +90,5 @@ class StackFeature:
   HBASE_HOME_DIRECTORY = "hbase_home_directory"
   ATLAS_RANGER_PLUGIN_SUPPORT = "atlas_ranger_plugin_support"
   ATLAS_UPGRADE_SUPPORT = "atlas_upgrade_support"
+  RANGER_PID_SUPPORT = "ranger_pid_support"
+  RANGER_KMS_PID_SUPPORT = "ranger_kms_pid_support"

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-env.xml
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-env.xml
index 3187971..cc62c8b 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-env.xml
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/configuration/ranger-env.xml
@@ -118,6 +118,11 @@
     <name>ranger_pid_dir</name>
     <value>/var/run/ranger</value>
     <description/>
+    <value-attributes>
+      <type>directory</type>
+      <overridable>false</overridable>
+      <editable-only-at-install>true</editable-only-at-install>
+    </value-attributes>
     <on-ambari-upgrade add="true"/>
   </property>
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 ab5be74..817d3f7 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
@@ -65,6 +65,7 @@ stack_supports_ranger_log4j =  stack_version_formatted and check_stack_feature(S
 stack_supports_ranger_kerberos = stack_version_formatted and check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT,
stack_version_formatted)
 stack_supports_usersync_passwd = stack_version_formatted and check_stack_feature(StackFeature.RANGER_USERSYNC_PASSWORD_JCEKS,
stack_version_formatted)
 stack_supports_logsearch = stack_version_formatted and check_stack_feature(StackFeature.LOGSEARCH_SUPPORT,
stack_version_formatted)
+stack_supports_pid = stack_version_formatted and check_stack_feature(StackFeature.RANGER_PID_SUPPORT,
stack_version_formatted)
 
 downgrade_from_version = default("/commandParams/downgrade_from_version", None)
 upgrade_direction = default("/commandParams/upgrade_direction", None)
@@ -318,4 +319,9 @@ 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
+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

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 0d9ce5f..f48720c 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
@@ -17,11 +17,13 @@ See the License for the specific language governing permissions and
 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 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.resources.system import Execute, File
 from resource_management.core.exceptions import ComponentIsNotRunning
 from resource_management.libraries.functions.format import format
 from resource_management.core.logger import Logger
@@ -55,7 +57,10 @@ class RangerAdmin(Script):
 
     env.set_params(params)
     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,
+        action = "delete"
+      )
 
   def pre_upgrade_restart(self, env, upgrade_type=None):
     import params
@@ -86,6 +91,11 @@ class RangerAdmin(Script):
     import status_params
 
     env.set_params(status_params)
+
+    if status_params.stack_supports_pid:
+      check_process_status(status_params.ranger_admin_pid_file)
+      return
+
     cmd = 'ps -ef | grep proc_rangeradmin | grep -v grep'
     code, output = shell.call(cmd, timeout=20)
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 8313b18..5ce0617 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
@@ -17,6 +17,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 
 """
+from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.libraries.script import Script
 from resource_management.core.resources.system import Execute, File
 from resource_management.core.exceptions import ComponentIsNotRunning
@@ -68,8 +69,19 @@ class RangerUsersync(Script):
     env.set_params(params)
     
     Execute((params.usersync_stop,), environment={'JAVA_HOME': params.java_home}, sudo=True)
+    if params.stack_supports_pid:
+      File(params.ranger_usersync_pid_file,
+        action = "delete"
+      )
     
   def status(self, env):
+    import status_params
+    env.set_params(status_params)
+
+    if status_params.stack_supports_pid:
+      check_process_status(status_params.ranger_usersync_pid_file)
+      return
+
     cmd = 'ps -ef | grep proc_rangerusersync | grep -v grep'
     code, output = shell.call(cmd, timeout=20)
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 ad0ac60..e1b5bc5 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
@@ -112,6 +112,14 @@ def setup_ranger_admin(upgrade_type=None):
             recursive_ownership = True,
   )
 
+  Directory(params.ranger_pid_dir,
+    mode=0755,
+    owner = params.unix_user,
+    group = params.user_group,
+    cd_access = "a",
+    create_parents=True
+  )
+
   Directory(params.admin_log_dir,
     owner = params.unix_user,
     group = params.unix_group,
@@ -342,10 +350,12 @@ def setup_usersync(upgrade_type=None):
     password_validation(params.ranger_usersync_ldap_ldapbindpassword)
 
   Directory(params.ranger_pid_dir,
-    mode=0750,
+    mode=0755,
     owner = params.unix_user,
-    group = params.unix_group
-  )  
+    group = params.user_group,
+    cd_access = "a",
+    create_parents=True
+  )
 
   Directory(params.usersync_log_dir,
     owner = params.unix_user,
@@ -454,10 +464,10 @@ def setup_tagsync(upgrade_type=None):
   )
 
   Directory(params.ranger_pid_dir,
-    mode=0750,
+    mode=0755,
     create_parents=True,
     owner = params.unix_user,
-    group = params.unix_group,
+    group = params.user_group,
     cd_access = "a",
   )
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/status_params.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/status_params.py
index 6cb69fb..842430b 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/status_params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/status_params.py
@@ -21,6 +21,9 @@ limitations under the License.
 from resource_management.libraries.script import Script
 from resource_management.libraries.functions.format import format
 from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.version import format_stack_version
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
 
 config  = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -28,4 +31,9 @@ tmp_dir = Script.get_tmp_dir()
 upgrade_marker_file = format("{tmp_dir}/rangeradmin_ru.inprogress")
 ranger_pid_dir = config['configurations']['ranger-env']['ranger_pid_dir']
 tagsync_pid_file = format('{ranger_pid_dir}/tagsync.pid')
-stack_name = default("/hostLevelParams/stack_name", None)
\ No newline at end of file
+stack_name = default("/hostLevelParams/stack_name", None)
+stack_version_unformatted = config['hostLevelParams']['stack_version']
+stack_version_formatted = format_stack_version(stack_version_unformatted)
+ranger_admin_pid_file = format('{ranger_pid_dir}/rangeradmin.pid')
+ranger_usersync_pid_file = format('{ranger_pid_dir}/usersync.pid')
+stack_supports_pid = stack_version_formatted and check_stack_feature(StackFeature.RANGER_PID_SUPPORT,
stack_version_formatted)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 5847984..a4a38c1 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
@@ -207,6 +207,14 @@ def kms(upgrade_type=None):
               recursive_ownership = True,
     )
 
+    Directory(params.ranger_kms_pid_dir,
+      mode=0755,
+      owner = params.kms_user,
+      group = params.user_group,
+      cd_access = "a",
+      create_parents=True
+    )
+
     Directory(params.kms_log_dir,
       owner = params.kms_user,
       group = params.kms_group,

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 9360e70..cbdcc8c 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
@@ -17,9 +17,11 @@ See the License for the specific language governing permissions and
 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.script import Script
-from resource_management.core.resources.system import Execute
+from resource_management.core.resources.system import Execute, File
 from resource_management.core.exceptions import ComponentIsNotRunning
 from resource_management.libraries.functions.format import format
 from resource_management.core.logger import Logger
@@ -48,6 +50,10 @@ class KmsServer(Script):
 
     env.set_params(params)
     kms_service(action = 'stop')
+    if params.stack_supports_pid:
+      File(params.ranger_kms_pid_file,
+        action = "delete"
+      )
 
   def start(self, env, upgrade_type=None):
     import params
@@ -58,7 +64,14 @@ class KmsServer(Script):
     setup_kms_jce()
     kms_service(action = 'start')
 
-  def status(self, env):    
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+
+    if status_params.stack_supports_pid:
+      check_process_status(status_params.ranger_kms_pid_file)
+      return
+
     cmd = 'ps -ef | grep proc_rangerkms | grep -v grep'
     code, output = shell.call(cmd, timeout=20)
     if code != 0:

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 452be86..26e9c8b 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
@@ -39,6 +39,7 @@ stack_version_formatted = format_stack_version(stack_version_unformatted)
 stack_supports_config_versioning =  stack_version_formatted and check_stack_feature(StackFeature.CONFIG_VERSIONING,
stack_version_formatted)
 stack_support_kms_hsm = stack_version_formatted and check_stack_feature(StackFeature.RANGER_KMS_HSM_SUPPORT,
stack_version_formatted)
 stack_supports_ranger_kerberos = stack_version_formatted and check_stack_feature(StackFeature.RANGER_KERBEROS_SUPPORT,
stack_version_formatted)
+stack_supports_pid = stack_version_formatted and check_stack_feature(StackFeature.RANGER_KMS_PID_SUPPORT,
stack_version_formatted)
 hadoop_conf_dir = conf_select.get_hadoop_conf_dir()
 security_enabled = config['configurations']['cluster-env']['security_enabled']
 
@@ -244,3 +245,8 @@ if stack_supports_ranger_kerberos and security_enabled:
   rangerkms_principal = default("/configurations/dbks-site/ranger.ks.kerberos.principal",
None)
   if rangerkms_principal is not None:
     rangerkms_principal = rangerkms_principal.replace('_HOST', kms_host.lower())
+
+# ranger kms pid
+user_group = config['configurations']['cluster-env']['user_group']
+ranger_kms_pid_dir = default("/configurations/kms-env/ranger_kms_pid_dir", "/var/run/ranger_kms")
+ranger_kms_pid_file = format('{ranger_kms_pid_dir}/rangerkms.pid')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/status_params.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/status_params.py
new file mode 100644
index 0000000..34d0082
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/status_params.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management.libraries.script import Script
+from resource_management.libraries.functions.format import format
+from resource_management.libraries.functions.default import default
+from resource_management.libraries.functions.version import format_stack_version
+from resource_management.libraries.functions.stack_features import check_stack_feature
+from resource_management.libraries.functions import StackFeature
+
+config  = Script.get_config()
+tmp_dir = Script.get_tmp_dir()
+
+stack_name = default("/hostLevelParams/stack_name", None)
+stack_version_unformatted = config['hostLevelParams']['stack_version']
+stack_version_formatted = format_stack_version(stack_version_unformatted)
+stack_supports_pid = stack_version_formatted and check_stack_feature(StackFeature.RANGER_KMS_PID_SUPPORT,
stack_version_formatted)
+ranger_kms_pid_dir = default("/configurations/kms-env/ranger_kms_pid_dir", "/var/run/ranger_kms")
+ranger_kms_pid_file = format('{ranger_kms_pid_dir}/rangerkms.pid')
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/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 574264e..789c5ba 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
@@ -250,6 +250,16 @@
       "name": "atlas_upgrade_support",
       "description": "Atlas supports express and rolling upgrades",
       "min_version": "2.5.0.0"
+    },
+    {
+      "name": "ranger_pid_support",
+      "description": "Ranger Service support pid generation AMBARI-16756",
+      "min_version": "2.5.0.0"
+    },
+    {
+      "name": "ranger_kms_pid_support",
+      "description": "Ranger KMS Service support pid generation",
+      "min_version": "2.5.0.0"
     }
   ]
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER_KMS/configuration/kms-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER_KMS/configuration/kms-env.xml
b/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER_KMS/configuration/kms-env.xml
index ae45552..24baa13 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER_KMS/configuration/kms-env.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/RANGER_KMS/configuration/kms-env.xml
@@ -30,4 +30,15 @@
     <description>HSM partition password</description>
     <on-ambari-upgrade add="true"/>
   </property>
+  <property>
+    <name>ranger_kms_pid_dir</name>
+    <value>/var/run/ranger_kms</value>
+    <description/>
+    <value-attributes>
+      <type>directory</type>
+      <overridable>false</overridable>
+      <editable-only-at-install>true</editable-only-at-install>
+    </value-attributes>
+    <on-ambari-upgrade add="true"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py
new file mode 100644
index 0000000..9b3c631
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_admin.py
@@ -0,0 +1,232 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+import json
+from mock.mock import MagicMock, patch
+from stacks.utils.RMFTestCase import *
+from only_for_platform import not_for_platform, PLATFORM_WINDOWS
+
+@not_for_platform(PLATFORM_WINDOWS)
+class TestRangerAdmin(RMFTestCase):
+  COMMON_SERVICES_PACKAGE_DIR = "RANGER/0.4.0/package"
+  STACK_VERSION = "2.5"
+
+  @patch("os.path.isfile")
+  def test_configure_default(self, isfile_mock):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_admin.py",
+      classname = "RangerAdmin",
+      command = "configure",
+      config_file="ranger-admin-default.json",
+      stack_version = self.STACK_VERSION,
+      target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertTrue(isfile_mock.called)
+    self.assertNoMoreResources()
+
+  @patch("os.path.isfile")    
+  def test_start_default(self, isfile_mock):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_admin.py",
+      classname = "RangerAdmin",
+      command = "start",
+      config_file="ranger-admin-default.json",
+      stack_version = self.STACK_VERSION,
+      target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertResourceCalled('Execute', '/usr/bin/ranger-admin-start',
+      environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+      not_if = 'ps -ef | grep proc_rangeradmin | grep -v grep',
+      user = 'ranger',
+    )
+
+    self.assertTrue(isfile_mock.called)
+    self.assertNoMoreResources()
+
+  def test_stop_default(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_admin.py",
+      classname = "RangerAdmin",
+      command = "stop",
+      config_file="ranger-admin-default.json",
+      stack_version = self.STACK_VERSION,
+      target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assertResourceCalled('Execute', '/usr/bin/ranger-admin-stop',
+      environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+      user = 'ranger'
+    )
+    self.assertResourceCalled('File', '/var/run/ranger/rangeradmin.pid',
+      action = ['delete']
+    )
+    self.assertNoMoreResources()
+
+  @patch("os.path.isfile")    
+  def test_configure_secured(self, isfile_mock):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_admin.py",
+      classname = "RangerAdmin",
+      command = "configure",
+      config_file="ranger-admin-secured.json",
+      stack_version = self.STACK_VERSION,
+      target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertTrue(isfile_mock.called)
+    self.assertNoMoreResources()
+
+  def assert_configure_default(self):
+    self.assertResourceCalled('Directory', '/usr/hdp/current/ranger-admin/conf',
+      owner = 'ranger',
+      group = 'ranger',
+      create_parents = True
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java-old.jar',
+        action = ['delete'],
+    )
+
+    self.assertResourceCalled('File', '/tmp/mysql-connector-java.jar',
+      content = DownloadSource('http://c6401.ambari.apache.org:8080/resources//mysql-connector-java.jar'),
+      mode = 0644
+    )
+
+    self.assertResourceCalled('Execute', ('cp', '--remove-destination', '/tmp/mysql-connector-java.jar',
'/usr/hdp/current/ranger-admin/ews/lib'),
+      sudo = True,
+      path = ['/bin', '/usr/bin/']
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java.jar',
+      mode = 0644
+    )
+
+    self.assertResourceCalled('ModifyPropertiesFile', '/usr/hdp/current/ranger-admin/install.properties',
+      properties = self.getConfig()['configurations']['admin-properties'],
+      owner = 'ranger'
+    )
+
+    self.assertResourceCalled('ModifyPropertiesFile', '/usr/hdp/current/ranger-admin/install.properties',
+      owner = 'ranger',
+      properties = {'SQL_CONNECTOR_JAR': '/usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java.jar'}
+    )
+
+    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
+      content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
+      mode = 0644
+    )
+
+    self.assertResourceCalled('Execute',
+      '/usr/jdk64/jdk1.7.0_45/bin/java -cp /usr/lib/ambari-agent/DBConnectionVerification.jar:/usr/hdp/current/ranger-admin/ews/lib/mysql-connector-java.jar:/usr/hdp/current/ranger-admin/ews/lib/*
org.apache.ambari.server.DBConnectionVerification \'jdbc:mysql://c6401.ambari.apache.org:3306/ranger01\'
rangeradmin01 rangeradmin01 com.mysql.jdbc.Driver',
+      path=['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'],
+      tries=5,
+      try_sleep=10,
+      environment = {}
+    )
+
+    self.assertResourceCalled('Execute', ('ln', '-sf', '/usr/hdp/current/ranger-admin/ews/webapp/WEB-INF/classes/conf',
'/usr/hdp/current/ranger-admin/conf'),
+      not_if = 'ls /usr/hdp/current/ranger-admin/conf',
+      only_if = 'ls /usr/hdp/current/ranger-admin/ews/webapp/WEB-INF/classes/conf',
+      sudo = True
+    )
+
+    self.assertResourceCalled('Directory', '/usr/hdp/current/ranger-admin/',
+      owner='ranger',
+      group='ranger',
+      recursive_ownership = True
+    )
+
+    self.assertResourceCalled('Directory', '/var/run/ranger',
+      mode=0755,
+      owner = 'ranger',
+      group = 'hadoop',
+      cd_access = "a",
+      create_parents=True
+    )
+
+    self.assertResourceCalled('Directory', '/var/log/ranger/admin',
+      owner='ranger',
+      group='ranger',
+      create_parents = True,
+      cd_access = 'a',
+      mode = 0755
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-admin/conf/ranger-admin-env-logdir.sh',
+      content = 'export RANGER_ADMIN_LOG_DIR=/var/log/ranger/admin',
+      owner = 'ranger',
+      group = 'ranger',
+      mode = 0755
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-admin/conf/ranger-admin-default-site.xml',
+      owner = 'ranger',
+      group = 'ranger'
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-admin/conf/security-applicationContext.xml',
+      owner = 'ranger',
+      group = 'ranger'
+    )
+
+    self.assertResourceCalled('Execute', ('ln', '-sf', '/usr/hdp/current/ranger-admin/ews/ranger-admin-services.sh',
'/usr/bin/ranger-admin'),
+      not_if = 'ls /usr/bin/ranger-admin',
+      only_if = 'ls /usr/hdp/current/ranger-admin/ews/ranger-admin-services.sh',
+      sudo = True
+    )
+
+    self.assertResourceCalled('XmlConfig', 'ranger-admin-site.xml',
+      owner = 'ranger',
+      group = 'ranger',
+      conf_dir = '/usr/hdp/current/ranger-admin/conf',
+      configurations = self.getConfig()['configurations']['ranger-admin-site'],
+      configuration_attributes = self.getConfig()['configuration_attributes']['ranger-admin-site'],
+      mode = 0644
+    )
+
+    self.assertResourceCalled('Directory', '/usr/hdp/current/ranger-admin/conf/ranger_jaas',
+      owner ='ranger',
+      group ='ranger',
+      mode = 0700
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-admin/ews/webapp/WEB-INF/log4j.properties',
+      owner = 'ranger',
+      group = 'ranger',
+      content = self.getConfig()['configurations']['admin-log4j']['content'],
+      mode = 0644
+    )
+
+    self.assertResourceCalled('Execute', ('/usr/jdk64/jdk1.7.0_45/bin/java', '-cp', '/usr/hdp/current/ranger-admin/cred/lib/*',
'org.apache.ranger.credentialapi.buildks', 'create', 'rangeradmin', '-value', 'rangeradmin01',
'-provider', 'jceks://file/etc/ranger/admin/rangeradmin.jceks'),
+      environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+      logoutput=True,
+      sudo = True
+    )
+
+    self.assertResourceCalled('File', '/etc/ranger/admin/rangeradmin.jceks',
+      owner = 'ranger',
+      group = 'ranger',
+      mode = 0640
+    )
+
+    self.assertResourceCalled('XmlConfig', 'core-site.xml',
+      owner = 'ranger',
+      group = 'ranger',
+      conf_dir = '/usr/hdp/current/ranger-admin/conf',
+      configurations = self.getConfig()['configurations']['core-site'],
+      configuration_attributes = self.getConfig()['configuration_attributes']['core-site'],
+      mode = 0644
+    )

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_tagsync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_tagsync.py b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_tagsync.py
new file mode 100644
index 0000000..33a4c87
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_tagsync.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+import json
+from mock.mock import MagicMock, patch
+from stacks.utils.RMFTestCase import *
+from only_for_platform import not_for_platform, PLATFORM_WINDOWS
+
+@not_for_platform(PLATFORM_WINDOWS)
+class TestRangerTagsync(RMFTestCase):
+  COMMON_SERVICES_PACKAGE_DIR = "RANGER/0.4.0/package"
+  STACK_VERSION = "2.5"
+
+  def test_configure_default(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_tagsync.py",
+                   classname = "RangerTagsync",
+                   command = "configure",
+                   config_file="ranger-admin-default.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertNoMoreResources()
+
+  def test_start_default(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_tagsync.py",
+                   classname = "RangerTagsync",
+                   command = "start",
+                   config_file="ranger-admin-default.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertResourceCalled('Execute', '/usr/hdp/current/ranger-tagsync/ranger-tagsync-services.sh
start',
+        environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+        not_if = 'ps -ef | grep proc_rangertagsync | grep -v grep',
+        user = 'ranger',
+    )
+    self.assertNoMoreResources()
+    
+  def test_stop_default(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_tagsync.py",
+                   classname = "RangerTagsync",
+                   command = "stop",
+                   config_file="ranger-admin-default.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assertResourceCalled('Execute', '/usr/hdp/current/ranger-tagsync/ranger-tagsync-services.sh
stop',
+        environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+        user = 'ranger'
+    )
+
+    self.assertResourceCalled('File', '/var/run/ranger/tagsync.pid',
+      action = ['delete']
+    )
+    self.assertNoMoreResources()
+
+  def test_configure_secured(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_tagsync.py",
+                   classname = "RangerTagsync",
+                   command = "configure",
+                   config_file="ranger-admin-secured.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertNoMoreResources()
+
+  def assert_configure_default(self):
+    self.assertResourceCalled('Directory', '/usr/hdp/current/ranger-tagsync/conf',
+      owner = 'ranger',
+      group = 'ranger',
+      create_parents = True
+    )
+
+    self.assertResourceCalled('Directory', '/var/run/ranger',
+      mode=0755,
+      owner = 'ranger',
+      group = 'hadoop',
+      cd_access = "a",
+      create_parents=True
+    )
+
+    self.assertResourceCalled('Directory', '/var/log/ranger/tagsync',
+      owner = 'ranger',
+      group = 'ranger',
+      cd_access = "a",
+      mode=0755,
+      create_parents = True
+    )
+
+    self.assertResourceCalled('File',
+      '/usr/hdp/current/ranger-tagsync/conf/ranger-tagsync-env-logdir.sh',
+      owner = 'ranger',
+      content = 'export RANGER_TAGSYNC_LOG_DIR=/var/log/ranger/tagsync',
+      group = 'ranger',
+      mode=0755
+    )
+
+    self.assertResourceCalled('XmlConfig', 'ranger-tagsync-site.xml',
+      owner = 'ranger',
+      group = 'ranger',
+      conf_dir = '/usr/hdp/current/ranger-tagsync/conf',
+      configurations = self.getConfig()['configurations']['ranger-tagsync-site'],
+      configuration_attributes = self.getConfig()['configuration_attributes']['ranger-tagsync-site'],
+      mode=0644
+    )
+
+    self.assertResourceCalled('PropertiesFile', '/usr/hdp/current/ranger-tagsync/conf/atlas-application.properties',
+      properties = self.getConfig()['configurations']['tagsync-application-properties'],
+      mode=0755,
+      owner='ranger',
+      group='ranger'
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-tagsync/conf/log4j.properties',
+      owner = 'ranger',
+      group = 'ranger',
+      content = self.getConfig()['configurations']['tagsync-log4j']['content'],
+      mode = 0644
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-tagsync/ranger-tagsync-services.sh',
+      mode = 0755,
+    )
+
+    self.assertResourceCalled('Execute', ('ln', '-sf', '/usr/hdp/current/ranger-tagsync/ranger-tagsync-services.sh',
'/usr/bin/ranger-tagsync'),
+      not_if='ls /usr/bin/ranger-tagsync',
+      only_if='ls /usr/hdp/current/ranger-tagsync/ranger-tagsync-services.sh',
+      sudo=True
+    )
+
+    self.assertResourceCalled('XmlConfig', 'core-site.xml',
+      owner = 'ranger',
+      group = 'ranger',
+      conf_dir = '/usr/hdp/current/ranger-tagsync/conf',
+      configurations = self.getConfig()['configurations']['core-site'],
+      configuration_attributes = self.getConfig()['configuration_attributes']['core-site'],
+      mode = 0644
+    )

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad23a68e/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_usersync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_usersync.py b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_usersync.py
new file mode 100644
index 0000000..7b6e782
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.5/RANGER/test_ranger_usersync.py
@@ -0,0 +1,196 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import json
+from mock.mock import MagicMock, patch
+from stacks.utils.RMFTestCase import *
+from only_for_platform import not_for_platform, PLATFORM_WINDOWS
+
+@not_for_platform(PLATFORM_WINDOWS)
+class TestRangerUsersync(RMFTestCase):
+  COMMON_SERVICES_PACKAGE_DIR = "RANGER/0.4.0/package"
+  STACK_VERSION = "2.5"
+
+  @patch("os.path.isfile")
+  def test_configure_default(self, isfile_mock):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_usersync.py",
+                   classname = "RangerUsersync",
+                   command = "configure",
+                   config_file="ranger-admin-default.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertTrue(isfile_mock.called)
+    self.assertNoMoreResources()
+   
+  @patch("os.path.isfile")
+  def test_start_default(self, isfile_mock):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_usersync.py",
+                   classname = "RangerUsersync",
+                   command = "start",
+                   config_file="ranger-admin-default.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertResourceCalled('Execute', '/usr/bin/ranger-usersync-start',
+        environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+        not_if = 'ps -ef | grep proc_rangerusersync | grep -v grep',
+        user = 'ranger',
+    )
+    self.assertTrue(isfile_mock.called)
+    self.assertNoMoreResources()
+    
+  def test_stop_default(self):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_usersync.py",
+                   classname = "RangerUsersync",
+                   command = "stop",
+                   config_file="ranger-admin-default.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assertResourceCalled('Execute', ('/usr/bin/ranger-usersync-stop',),
+      environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+        sudo = True
+    )
+    self.assertResourceCalled('File', '/var/run/ranger/usersync.pid',
+      action = ['delete']
+    )
+    self.assertNoMoreResources()
+
+  @patch("os.path.isfile")    
+  def test_configure_secured(self, isfile_mock):
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/ranger_usersync.py",
+                   classname = "RangerUsersync",
+                   command = "configure",
+                   config_file="ranger-admin-secured.json",
+                   stack_version = self.STACK_VERSION,
+                   target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+    self.assert_configure_default()
+    self.assertTrue(isfile_mock.called)
+    self.assertNoMoreResources()
+
+  def assert_configure_default(self):
+    self.assertResourceCalled('Directory', '/var/run/ranger',
+      mode=0755,
+      owner = 'ranger',
+      group = 'hadoop',
+      cd_access = "a",
+      create_parents=True
+    )
+
+    self.assertResourceCalled('Directory', '/var/log/ranger/usersync',
+      owner='ranger',
+      group='ranger',
+      create_parents = True,
+      cd_access = 'a',
+      mode = 0755
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-usersync/conf/ranger-usersync-env-logdir.sh',
+      content = 'export logdir=/var/log/ranger/usersync',
+      owner = 'ranger',
+      group = 'ranger',
+      mode = 0755
+    )
+
+    self.assertResourceCalled('Directory', '/usr/hdp/current/ranger-usersync/conf/',
+      owner = 'ranger'
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-usersync/conf/log4j.properties',
+      owner = 'ranger',
+      group = 'ranger',
+      content = self.getConfig()['configurations']['usersync-log4j']['content'],
+      mode = 0644
+    )
+
+    self.assertResourceCalled('XmlConfig', 'ranger-ugsync-site.xml',
+      owner = 'ranger',
+      group = 'ranger',
+      conf_dir = '/usr/hdp/current/ranger-usersync/conf',
+      configurations = self.getConfig()['configurations']['ranger-ugsync-site'],
+      configuration_attributes = self.getConfig()['configuration_attributes']['ranger-ugsync-site'],
+      mode = 0644
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-usersync/conf/ranger-ugsync-default.xml',
+      owner = 'ranger',
+      group = 'ranger'
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-usersync/conf/log4j.properties',
+      owner = 'ranger',
+      group = 'ranger'
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-usersync/native/credValidator.uexe',
+      group = 'ranger',
+      mode = 04555
+    )
+
+    self.assertResourceCalled('Execute', ('/usr/jdk64/jdk1.7.0_45/bin/java', '-cp', '/usr/hdp/current/ranger-usersync/lib/*',
'org.apache.ranger.credentialapi.buildks', 'create', 'usersync.ssl.key.password', '-value',
'UnIx529p', '-provider', 'jceks://file/usr/hdp/current/ranger-usersync/conf/ugsync.jceks'),
+      environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+      logoutput=True,
+      sudo = True
+    )
+
+    self.assertResourceCalled('Execute', ('/usr/jdk64/jdk1.7.0_45/bin/java', '-cp', '/usr/hdp/current/ranger-usersync/lib/*',
'org.apache.ranger.credentialapi.buildks', 'create', 'usersync.ssl.truststore.password', '-value',
'changeit', '-provider', 'jceks://file/usr/hdp/current/ranger-usersync/conf/ugsync.jceks'),
+      environment = {'JAVA_HOME': u'/usr/jdk64/jdk1.7.0_45'},
+      logoutput=True,
+      sudo = True
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-usersync/conf/ugsync.jceks',
+      owner = 'ranger',
+      group = 'ranger',
+      mode = 0640
+    )
+
+    self.assertResourceCalled('File', '/usr/bin/ranger-usersync-start',
+      owner = 'ranger',
+      group = 'ranger'
+    )
+
+    self.assertResourceCalled('File', '/usr/bin/ranger-usersync-stop',
+      owner = 'ranger',
+      group = 'ranger'
+    )
+
+    self.assertResourceCalled('File', '/usr/hdp/current/ranger-usersync/ranger-usersync-services.sh',
+      mode = 0755
+    )
+
+    self.assertResourceCalled('Execute', ('ln', '-sf', '/usr/hdp/current/ranger-usersync/ranger-usersync-services.sh',
'/usr/bin/ranger-usersync'),
+      not_if = 'ls /usr/bin/ranger-usersync',
+      only_if = 'ls /usr/hdp/current/ranger-usersync/ranger-usersync-services.sh',
+      sudo = True
+    )
+
+    self.assertResourceCalled('XmlConfig', 'core-site.xml',
+      owner = 'ranger',
+      group = 'ranger',
+      conf_dir = '/usr/hdp/current/ranger-usersync/conf',
+      configurations = self.getConfig()['configurations']['core-site'],
+      configuration_attributes = self.getConfig()['configuration_attributes']['core-site'],
+      mode = 0644
+    )


Mime
View raw message