AMBARI-19851. ambari-server start failed with exit code 1. (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f2561c48 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f2561c48 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f2561c48 Branch: refs/heads/branch-dev-patch-upgrade Commit: f2561c48f71614d56fd747239cdd16bf5a6ef9ea Parents: 4ad3a2b Author: Andrew Onishuk <[email protected]> Authored: Fri Feb 3 15:03:40 2017 +0200 Committer: Andrew Onishuk <[email protected]> Committed: Fri Feb 3 15:03:40 2017 +0200 ---------------------------------------------------------------------- .../src/main/python/ambari_server/serverConfiguration.py | 9 +++++++-- ambari-server/src/main/python/ambari_server/serverSetup.py | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/f2561c48/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 ebd4807..c771b1e 100644 --- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py +++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py @@ -207,6 +207,11 @@ REQUIRED_PROPERTIES = [OS_FAMILY_PROPERTY, OS_TYPE_PROPERTY, COMMON_SERVICES_PAT BOOTSTRAP_SETUP_AGENT_SCRIPT, STACKADVISOR_SCRIPT, BOOTSTRAP_DIR_PROPERTY, PID_DIR_PROPERTY, MPACKS_STAGING_PATH_PROPERTY] +# if these properties are available 'ambari-server setup -s' is not triggered again. +SETUP_DONE_PROPERTIES = [OS_FAMILY_PROPERTY, OS_TYPE_PROPERTY, JDK_NAME_PROPERTY, JDBC_DATABASE_PROPERTY, + NR_USER_PROPERTY, PERSISTENCE_TYPE_PROPERTY +] + def get_conf_dir(): try: conf_dir = os.environ[AMBARI_CONF_VAR] @@ -1461,9 +1466,9 @@ def get_server_temp_location(properties): server_tmp_dir = configDefaults.SERVER_TMP_DIR_DEFAULT return server_tmp_dir -def get_missing_properties(properties): +def get_missing_properties(properties, property_set=REQUIRED_PROPERTIES): missing_propertiers = [] - for property in REQUIRED_PROPERTIES: + for property in property_set: value = properties[property] if not value: missing_propertiers.append(property) http://git-wip-us.apache.org/repos/asf/ambari/blob/f2561c48/ambari-server/src/main/python/ambari_server/serverSetup.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server/serverSetup.py b/ambari-server/src/main/python/ambari_server/serverSetup.py index adb5885..8a06034 100644 --- a/ambari-server/src/main/python/ambari_server/serverSetup.py +++ b/ambari-server/src/main/python/ambari_server/serverSetup.py @@ -37,11 +37,11 @@ from ambari_commons.os_utils import copy_files, run_os_command, is_root from ambari_commons.str_utils import compress_backslashes from ambari_server.dbConfiguration import DBMSConfigFactory, TAR_GZ_ARCHIVE_TYPE, default_connectors_map, check_jdbc_drivers from ambari_server.serverConfiguration import configDefaults, JDKRelease, \ - get_ambari_properties, get_is_secure, get_is_persisted, get_java_exe_path, get_JAVA_HOME, \ + get_ambari_properties, get_is_secure, get_is_persisted, get_java_exe_path, get_JAVA_HOME, get_missing_properties, \ get_resources_location, get_value_from_properties, read_ambari_user, update_properties, validate_jdk, write_property, \ JAVA_HOME, JAVA_HOME_PROPERTY, JCE_NAME_PROPERTY, JDBC_RCA_URL_PROPERTY, JDBC_URL_PROPERTY, \ JDK_NAME_PROPERTY, JDK_RELEASES, NR_USER_PROPERTY, OS_FAMILY, OS_FAMILY_PROPERTY, OS_TYPE, OS_TYPE_PROPERTY, OS_VERSION, \ - VIEWS_DIR_PROPERTY, JDBC_DATABASE_PROPERTY, JDK_DOWNLOAD_SUPPORTED_PROPERTY, JCE_DOWNLOAD_SUPPORTED_PROPERTY + VIEWS_DIR_PROPERTY, JDBC_DATABASE_PROPERTY, JDK_DOWNLOAD_SUPPORTED_PROPERTY, JCE_DOWNLOAD_SUPPORTED_PROPERTY, SETUP_DONE_PROPERTIES from ambari_server.serverUtils import is_server_runing from ambari_server.setupSecurity import adjust_directory_permissions from ambari_server.userInput import get_YN_input, get_validated_string_input @@ -1082,7 +1082,7 @@ def check_setup_already_done(): print_error_msg("Error getting ambari properties") return -1 - return properties.get_property(JDK_NAME_PROPERTY) and properties.get_property(JDBC_DATABASE_PROPERTY) + return not bool(get_missing_properties(properties, property_set=SETUP_DONE_PROPERTIES)) # # Setup the Ambari Server.
