AMBARI-14492 Copy Ranger config files to Ranger conf directory

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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 2a7ccf4d6fb1c4e3a7cb674cc99fcad67e920a8b
Parents: f8213ed
Author: Gautam Borad <[email protected]>
Authored: Thu Dec 24 13:54:46 2015 +0530
Committer: Gautam Borad <[email protected]>
Committed: Mon Dec 28 10:47:09 2015 +0530

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/setup_ranger_xml.py    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2a7ccf4d/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 81f93a1..5e9f394 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
@@ -108,9 +108,21 @@ def setup_ranger_admin(upgrade_type=None):
 
   if os.path.isfile(params.ranger_admin_default_file):
     File(params.ranger_admin_default_file, owner=params.unix_user, 
group=params.unix_group)
+  else:
+    Logger.warning('Required file {0} does not exist, copying the file to {1} 
path'.format(params.ranger_admin_default_file, ranger_conf))
+    src_file = 
format('{ranger_home}/ews/webapp/WEB-INF/classes/conf.dist/ranger-admin-default-site.xml')
+    dst_file = format('{ranger_home}/conf/ranger-admin-default-site.xml')
+    Execute(('cp', '-f', src_file, dst_file), sudo=True)
+    File(params.ranger_admin_default_file, owner=params.unix_user, 
group=params.unix_group)
 
   if os.path.isfile(params.security_app_context_file):
     File(params.security_app_context_file, owner=params.unix_user, 
group=params.unix_group)
+  else:
+    Logger.warning('Required file {0} does not exist, copying the file to {1} 
path'.format(params.security_app_context_file, ranger_conf))
+    src_file = 
format('{ranger_home}/ews/webapp/WEB-INF/classes/conf.dist/security-applicationContext.xml')
+    dst_file = format('{ranger_home}/conf/security-applicationContext.xml')
+    Execute(('cp', '-f', src_file, dst_file), sudo=True)
+    File(params.security_app_context_file, owner=params.unix_user, 
group=params.unix_group)
 
   Execute(('ln','-sf', 
format('{ranger_home}/ews/ranger-admin-services.sh'),'/usr/bin/ranger-admin'),
     not_if=format("ls /usr/bin/ranger-admin"),

Reply via email to