1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

Add MISSING section type and update handling for missing sections

This commit is contained in:
Adolfo Gómez García 2024-10-30 20:00:37 +01:00
parent 3fbdea1e23
commit 37956262ef
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23

View File

@ -88,12 +88,13 @@ class Config:
WYSE = 'WYSE' # Legacy
ENTERPRISE = 'Enterprise' # For enterprise pourposes
OTHER = 'Other'
MISSING = 'Missing'
@staticmethod
def from_str(value: str) -> 'Config.SectionType':
if value in list(Config.SectionType.values()):
return Config.SectionType(value)
return Config.SectionType(Config.SectionType.OTHER)
return Config.SectionType(Config.SectionType.MISSING)
@staticmethod
def values() -> collections.abc.Iterable['Config.SectionType']:
@ -302,7 +303,9 @@ class Config:
val = Config.section(Config.SectionType.from_str(cfg.section)).value(
cfg.key, type=Config.FieldType.from_int(cfg.field_type), help=cfg.help
)
yield val
# If an already missing section is found, we will skip it
if val.section() != Config.SectionType.MISSING:
yield val
@staticmethod
def update(section: 'Config.SectionType', key: str, value: str, check_type: bool = False) -> 'None|Config.Value':