You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by lp...@apache.org on 2017/09/05 09:41:23 UTC

[28/50] [abbrv] ambari git commit: AMBARI-21684. ambari-server upgrade process still puts the new views jar to default location even if views.dir is customized in ambari.properties (aonishuk)

AMBARI-21684. ambari-server upgrade process still puts the new views jar to default location even if views.dir is customized in ambari.properties (aonishuk)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: e20c06400bd175a72b54374f7548daf342839f69
Parents: 84ab2eb
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Sep 1 14:44:51 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Sep 1 14:44:51 2017 +0300

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/e20c0640/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 c2ecb01..bd64b0e 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -221,6 +221,9 @@ SETUP_DONE_PROPERTIES = [OS_FAMILY_PROPERTY, OS_TYPE_PROPERTY, JDK_NAME_PROPERTY
                          NR_USER_PROPERTY, PERSISTENCE_TYPE_PROPERTY
 ]
 
+def get_default_views_dir():
+  return AmbariPath.get("/var/lib/ambari-server/resources/views")
+
 def get_conf_dir():
   try:
     conf_dir = os.environ[AMBARI_CONF_VAR]

http://git-wip-us.apache.org/repos/asf/ambari/blob/e20c0640/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 a4a4ae2..8712da5 100644
--- a/ambari-server/src/main/python/ambari_server/serverUpgrade.py
+++ b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
@@ -41,7 +41,7 @@ from ambari_server.serverConfiguration import configDefaults, get_resources_loca
   update_database_name_property, get_admin_views_dir, get_views_dir, get_views_jars, \
   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, get_db_type, update_ambari_env, \
-  AMBARI_ENV_FILE, JDBC_DATABASE_PROPERTY
+  AMBARI_ENV_FILE, JDBC_DATABASE_PROPERTY, get_default_views_dir
 from ambari_server.setupSecurity import adjust_directory_permissions, \
   generate_env, ensure_can_start_under_current_user
 from ambari_server.utils import compare_versions
@@ -264,6 +264,12 @@ def upgrade(args):
   elif compare_versions(ambari_version, "2.0.0") == 0:
     move_user_custom_actions()
 
+  # Move files installed by package to default views directory to a custom one
+  for views_dir in get_views_dir(properties):
+    root_views_dir = views_dir + "/../"
+    for file in glob.glob(get_default_views_dir()+'/*'):
+      shutil.move(file, root_views_dir)
+
   # Remove ADMIN_VIEW directory for upgrading Admin View on Ambari upgrade from 1.7.0 to 2.0.0
   admin_views_dirs = get_admin_views_dir(properties)
   for admin_views_dir in admin_views_dirs: