You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2015/08/13 02:46:51 UTC

ambari git commit: AMBARI-12747. Ambari server upgrade does not re-extract the jar content of the views (Rohit Choudhary via srimanth)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1.1 eb3a82843 -> c857bee54


AMBARI-12747. Ambari server upgrade does not re-extract the jar content of the views (Rohit Choudhary via srimanth)


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

Branch: refs/heads/branch-2.1.1
Commit: c857bee540ee8e18edd872319aeb1f9221402b83
Parents: eb3a828
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Wed Aug 12 17:46:23 2015 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Wed Aug 12 17:46:23 2015 -0700

----------------------------------------------------------------------
 .../src/main/python/ambari_server/serverConfiguration.py     | 8 ++++++++
 ambari-server/src/main/python/ambari_server/serverUpgrade.py | 7 ++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c857bee5/ambari-server/src/main/python/ambari_server/serverConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index 1a56fa6..f2661d3 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -428,6 +428,14 @@ def get_value_from_properties(properties, key, default=""):
     return default
   return value
 
+def get_views_dir(properties):
+  views_dir = properties.get_property(VIEWS_DIR_PROPERTY)
+  if views_dir is None or views_dir == "":
+    views_dirs = glob.glob("/var/lib/ambari-server/resources/views/work")
+  else:
+    views_dirs = glob.glob(views_dir + "/work")
+  return views_dirs
+
 def get_admin_views_dir(properties):
   views_dir = properties.get_property(VIEWS_DIR_PROPERTY)
   if views_dir is None or views_dir == "":

http://git-wip-us.apache.org/repos/asf/ambari/blob/c857bee5/ambari-server/src/main/python/ambari_server/serverUpgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverUpgrade.py b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
index a4fa24e..4a5009f 100644
--- a/ambari-server/src/main/python/ambari_server/serverUpgrade.py
+++ b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
@@ -35,7 +35,7 @@ from ambari_server.properties import Properties
 from ambari_server.serverConfiguration import configDefaults, \
   check_database_name_property, get_ambari_properties, get_ambari_version, get_full_ambari_classpath, \
   get_java_exe_path, get_stack_location, parse_properties_file, read_ambari_user, update_ambari_properties, \
-  update_database_name_property, get_admin_views_dir, \
+  update_database_name_property, get_admin_views_dir, get_views_dir,\
   AMBARI_PROPERTIES_FILE, IS_LDAP_CONFIGURED, LDAP_PRIMARY_URL_PROPERTY, RESOURCES_DIR_PROPERTY, \
   SETUP_OR_UPGRADE_MSG, update_krb_jaas_login_properties, AMBARI_KRB_JAAS_LOGIN_FILE
 from ambari_server.setupSecurity import adjust_directory_permissions, \
@@ -343,6 +343,11 @@ def upgrade(args):
   for admin_views_dir in admin_views_dirs:
     shutil.rmtree(admin_views_dir)
 
+  # Remove ambari views directory for the rest of the jars, at the time of upgrade. At restart all jars present in Ambari will be extracted into work directory
+  views_dir =  get_views_dir(properties)
+  for views in views_dir:
+    shutil.rmtree(views)
+
   # check if ambari has obsolete LDAP configuration
   if properties.get_property(LDAP_PRIMARY_URL_PROPERTY) and not properties.get_property(IS_LDAP_CONFIGURED):
     args.warnings.append("Existing LDAP configuration is detected. You must run the \"ambari-server setup-ldap\" command to adjust existing LDAP configuration.")