diff --git a/scripts/hostname.py b/scripts/hostname.py index e4194fd..bf7b185 100644 --- a/scripts/hostname.py +++ b/scripts/hostname.py @@ -7,7 +7,6 @@ import xml.etree.ElementTree as ET from logging.handlers import RotatingFileHandler from pathlib import Path - def configure_logging(): current_file = Path(__file__).resolve() sdsat_root = current_file.parent.parent @@ -28,12 +27,10 @@ def configure_logging(): root.handlers.clear() root.addHandler(handler) - def generate_random_string(length: int) -> str: letters = string.ascii_lowercase return "".join(random.choice(letters) for _ in range(length)) - def update_config_hostname(config_path: str, new_hostname: str) -> tuple[str | None, bool]: """ Met à jour dans le XML. @@ -55,12 +52,10 @@ def update_config_hostname(config_path: str, new_hostname: str) -> tuple[str | N return old_hostname, changed - def apply_hostname(new_hostname: str) -> int: # Retourne le code retour de la commande return os.system(f"sudo hostname {new_hostname}") - def main( expected_hostname: str = "sd-satxx.dtx.io", config_path: str = "/conf/config.xml", @@ -86,6 +81,5 @@ def main( rc = apply_hostname(new_hostname) logging.info(f"Hostname change completed successfully (rc={rc})") - if __name__ == "__main__": main()