Skip to content

Commit

Permalink
clean up error logs for deprecated env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe committed Oct 17, 2023
1 parent dc59d12 commit 31e9d2a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions metplus/util/config_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,18 @@ def check_for_deprecated_met_config_file(config, met_config, met_tool):
with open(met_config, 'r') as file_handle:
lines = file_handle.read().splitlines()

all_good = True
error_logs = []
for line in lines:
for deprecated_item in deprecated_met_list:
if '${' + deprecated_item + '}' not in line:
continue
all_good = False
config.logger.error(
f"Deprecated environment variable ${{{deprecated_item}}} found "
f"in MET config file: {met_config}"
)
error_logs.append(f"Deprecated environment variable ${{{deprecated_item}}} found")

if error_logs:
config.logger.error(f"Deprecated environment variables found in MET config file: {met_config}")
for error_log in error_logs:
config.logger.error(error_log)

if not all_good:
met_install_dir = config.getdir('MET_INSTALL_DIR')
config_dir = os.path.join(met_install_dir, 'share', 'met', 'config')
default_config = f"{get_wrapper_name(met_tool)}Config_default"
Expand All @@ -202,8 +202,9 @@ def check_for_deprecated_met_config_file(config, met_config, met_tool):
"release-notes.html#metplus-wrappers-upgrade-instructions"
" for more information."
)
return False

return all_good
return True


def _get_deprecated_met_list(config, met_tool):
Expand Down

0 comments on commit 31e9d2a

Please sign in to comment.