diff --git a/constants.py b/constants.py index 0eada7f4ed16aa559fa65dc50093ee84de4318ff..40d76b56aa8fdedae3af981bf147819f3d1cc1ed 100644 --- a/constants.py +++ b/constants.py @@ -54,3 +54,6 @@ DELETE_ORGANISMS_TOOL = "toolshed.g2.bx.psu.edu/repos/gga/chado_organism_delete_ HOST_DATA_DIR='src_data' CONTAINER_DATA_DIR_ROOT='/project_data' + +REQUIRED_PARAMETERS = [CONF_ALL_HOSTNAME, CONF_ALL_HTTP_PORT, CONF_GALAXY_DEFAULT_ADMIN_EMAIL, CONF_GALAXY_DEFAULT_ADMIN_USER, + CONF_GALAXY_DEFAULT_ADMIN_PASSWORD, CONF_TRIPAL_PASSWORD, CONF_GALAXY_CONFIG_REMOTE_USER_MAILDOMAIN] diff --git a/utilities.py b/utilities.py index af7a5ea2b054f756db0cf8b10032bec43bd16209..c6e7cfb7e23c6bcb2e5b0d418b05c6eb8448d57a 100755 --- a/utilities.py +++ b/utilities.py @@ -36,12 +36,16 @@ def parse_config(config_file): """ config_dict = load_yaml(config_file) - if isinstance(config_dict, dict): - #logging.debug("Config dictionary: {0}".format(config_dict)) - return config_dict - else: - logging.critical("Config yaml file is not a dictionary" % config_file) + if not isinstance(config_dict, dict): + logging.critical("Config yaml file is not a dictionary (%s)" % config_file) sys.exit() + else: + for required_parameter in constants.REQUIRED_PARAMETERS: + if not config_dict[required_parameter]: + logging.critical("{0} parameter improperly configured in config file {1}".format(required_parameter, config_file)) + sys.exit() + + return config_dict def parse_input(input_file): """