feat(config): For empty vars check differentiate between print and rich
This commit is contained in:
		| @@ -193,6 +193,19 @@ def validate_config_sections( | ||||
|         config_obj: configparser.ConfigParser()) -> None: | ||||
|     for this_section in config_obj.sections(): | ||||
|         {% if cookiecutter.use_rich_logging == "yes" -%}log.debug{%- else -%}print{%- endif %}(print_section_header(this_section)) | ||||
|  | ||||
|         unset_options = we_have_unset_options(config_obj, this_section) | ||||
|         if unset_options: | ||||
|             {% if cookiecutter.use_rich_logging == "yes" -%}log.error{%- else -%}print{%- endif %}(f"""{p.plural("Option", len(unset_options))} {unset_options} """ | ||||
|                   {% if cookiecutter.use_rich_logging == "yes" %}    {% endif %}f"""{p.plural("is", len(unset_options))} unset. """ | ||||
|                   {% if cookiecutter.use_rich_logging == "yes" %}    {% endif %}f"""{p.singular_noun("They", len(unset_options))} """ | ||||
|                   {% if cookiecutter.use_rich_logging == "yes" %}    {% endif %}f"must have a non-null value. " | ||||
|                   {% if cookiecutter.use_rich_logging == "yes" %}    {% endif %}f"""{p.plural("Default", len(unset_options))} {p.plural("is", len(unset_options))}:""") | ||||
|             for unset_option in unset_options: | ||||
|                 {% if cookiecutter.use_rich_logging == "yes" -%}log.error{%- else -%}print{%- endif %}(f"{unset_option} = {internal_defaults[unset_option]}") | ||||
|             {% if cookiecutter.use_rich_logging == "yes" -%}log.error{%- else -%}print{%- endif %}(f"Exiting 7 ...") | ||||
|             sys.exit(7) | ||||
|  | ||||
|         if not set(CONST.CFG_MANDATORY).issubset(config_obj.options(this_section, no_defaults=True)): | ||||
|             {% if cookiecutter.use_rich_logging == "yes" -%}log.debug{%- else -%}print{%- endif %}(f"Config section '[{this_section}]' does not have all mandatory options " | ||||
|                   {% if cookiecutter.use_rich_logging == "yes" %}    {% endif %}f"{CONST.CFG_MANDATORY} set, skipping section ...") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user