1
0
Fork 0

generate: container: Drop or change removed log functions

Either drop the invocations or change them to log_error().

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-08-01 19:46:14 +02:00
parent d097cedc6b
commit 98e366a031
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -34,23 +34,21 @@ def load_container_config(file: Path, log: Log) -> dict | None:
data = json.load(fp) data = json.load(fp)
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
log.log_error(f"{file.name} is not a valid JSON file!") log.log_error(f"{file.name} is not a valid JSON file!")
log.log_debug(f"Exception: {e}") log.log_error(f"Exception: {e}")
return None return None
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
log.log_error(f"{file.name} is not a valid UTF8 file!") log.log_error(f"{file.name} is not a valid UTF8 file!")
log.log_debug(f"Exception: {e}") log.log_error(f"Exception: {e}")
return None return None
except OSError as e: except OSError as e:
log.log_error(f"{file.name} could not be read!") log.log_error(f"{file.name} could not be read!")
log.log_debug(f"Exception: {e}") log.log_error(f"Exception: {e}")
return None return None
return data return data
def create_container_from_config(data: dict, log: Log) -> Container | None: def create_container_from_config(data: dict, log: Log) -> Container | None:
"""Create a container object.""" """Create a container object."""
log.log_info("Creating container...")
log.log_debug(f"Container config is:\n{data}")
ct: Container | None = None ct: Container | None = None
try: try:
ct = Container(data) ct = Container(data)
@ -82,10 +80,8 @@ def main() -> None:
if data is None: if data is None:
logger.log_error(f"{config_file} is invalid, aborting!") logger.log_error(f"{config_file} is invalid, aborting!")
sys.exit(1) sys.exit(1)
try: ct = create_container_from_config(data, logger)
ct = create_container_from_config(data, logger) if ct is None:
except ConfigError as e:
logger.log_error(e)
sys.exit(1) sys.exit(1)
scripts = { scripts = {
"create-volumes": ct.create_volumes, "create-volumes": ct.create_volumes,