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

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


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

commit 9720c68060aaf3189ef4f3ea358f1eec6bfce1d2
Author: Andrew Onishuk <aonis...@hortonworks.com>
AuthorDate: Tue Feb 6 12:24:42 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 597adc9..b016bdc 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -1142,6 +1142,19 @@ def update_ambari_env():
     return -1
 
   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):
@@ -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 accbd26..88d3607 100644
--- a/ambari-server/src/main/python/ambari_server/serverUpgrade.py
+++ b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
@@ -40,9 +40,9 @@ from ambari_server.serverConfiguration import configDefaults, 
get_resources_loca
   check_database_name_property, get_ambari_properties, get_ambari_version, \
   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, CLIENT_SECURITY, RESOURCES_DIR_PROPERTY, \
+  AMBARI_PROPERTIES_FILE, CLIENT_SECURITY, RESOURCES_DIR_PROPERTY, 
GPL_LICENSE_ACCEPTED_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
+  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