This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new 4ed6a45  AMBARI-22906. Not able to register new HDP version after 
upgrading to Ambari2.6.1 (aonishuk)
4ed6a45 is described below

commit 4ed6a458ccae533c810529e2c6b6165a6bac427d
Author: Andrew Onishuk <aonis...@hortonworks.com>
AuthorDate: Tue Feb 6 12:22:44 2018 +0200

    AMBARI-22906. Not able to register new HDP version after upgrading to 
Ambari2.6.1 (aonishuk)
---
 .../main/python/ambari_server/serverConfiguration.py    | 17 ++++++++++++++---
 .../src/main/python/ambari_server/serverUpgrade.py      |  5 +++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py 
b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index 5658f67..909ac89 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -1143,6 +1143,19 @@ def update_ambari_env():
 
   return 0
 
+def set_property(key, value, rewrite=True):
+  properties = get_ambari_properties()
+  if properties == -1:
+    err = "Error getting ambari properties"
+    raise FatalException(-1, err)
+
+  if not rewrite and key in properties.keys():
+    return
+
+  properties.process_pair(key, value)
+  update_properties(properties)
+
+
 # default should be false / not accepted
 def write_gpl_license_accepted(default_prompt_value = False, text = 
GPL_LICENSE_PROMPT_TEXT):
   properties = get_ambari_properties()
@@ -1155,9 +1168,7 @@ def write_gpl_license_accepted(default_prompt_value = 
False, text = GPL_LICENSE_
     return True
 
   result = get_YN_input(text, default_prompt_value)
-
-  properties.process_pair(GPL_LICENSE_ACCEPTED_PROPERTY, str(result).lower())
-  update_properties(properties)
+  set_property(GPL_LICENSE_ACCEPTED_PROPERTY, str(result).lower())
 
   return result
 
diff --git a/ambari-server/src/main/python/ambari_server/serverUpgrade.py 
b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
index d5c7c7f..4af5b4d 100644
--- a/ambari-server/src/main/python/ambari_server/serverUpgrade.py
+++ b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
@@ -41,8 +41,8 @@ from ambari_server.serverConfiguration import configDefaults, 
get_resources_loca
   get_java_exe_path, get_stack_location, parse_properties_file, 
read_ambari_user, update_ambari_properties, \
   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, get_default_views_dir, 
write_gpl_license_accepted
+  SETUP_OR_UPGRADE_MSG, update_krb_jaas_login_properties, 
AMBARI_KRB_JAAS_LOGIN_FILE, GPL_LICENSE_ACCEPTED_PROPERTY, get_db_type, 
update_ambari_env, \
+  AMBARI_ENV_FILE, JDBC_DATABASE_PROPERTY, get_default_views_dir, 
write_gpl_license_accepted, set_property
 from ambari_server.setupSecurity import adjust_directory_permissions, \
   generate_env, ensure_can_start_under_current_user
 from ambari_server.utils import compare_versions
@@ -177,6 +177,7 @@ def run_schema_upgrade(args):
 
 def check_gpl_license_approved(upgrade_response):
   if 'lzo_enabled' not in upgrade_response or 
upgrade_response['lzo_enabled'].lower() != "true":
+    set_property(GPL_LICENSE_ACCEPTED_PROPERTY, "false", rewrite=False)
     return
 
   while not write_gpl_license_accepted(text = LZO_ENABLED_GPL_TEXT) and not 
get_YN_input(INSTALLED_LZO_WITHOUT_GPL_TEXT, False):

-- 
To stop receiving notification emails like this one, please contact
aonis...@apache.org.

Reply via email to