From 08737d7adf45b070253da5dc5ae04fde8b6d846e Mon Sep 17 00:00:00 2001 From: Olivier Navas Date: Fri, 29 Nov 2024 11:57:44 +0100 Subject: [PATCH] =?UTF-8?q?Possibilit=C3=A9=20de=20configuration=20du=20ti?= =?UTF-8?q?tre=20dans=20config.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yml.example | 2 ++ linuxinstaller/PythonActions.py | 4 ++-- linuxinstaller/linuxinstaller.py | 10 +++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/config.yml.example b/config.yml.example index 011828c..d29ef0a 100644 --- a/config.yml.example +++ b/config.yml.example @@ -1,5 +1,7 @@ ### Chemin dans lequel se trouvent les playbooks ansible base_path: ansible +### Titre du menu +title: Menu de configuration Libretic ### Liste des playbooks ansible # ansible_playbooks: diff --git a/linuxinstaller/PythonActions.py b/linuxinstaller/PythonActions.py index bf0173b..61381d3 100644 --- a/linuxinstaller/PythonActions.py +++ b/linuxinstaller/PythonActions.py @@ -18,7 +18,7 @@ def setFQDN(fqdn): ### Cartouche de status -def print_status(): +def print_status(menuTitle): # Récupération des infos hostname = getHostName() domain = getDomain() @@ -27,7 +27,7 @@ def print_status(): # Affichage du statut console = Console() console.print() - console.print("=== Menu de configuration Libretic ===", style="bold red") + console.print("=== {0} ===".format(menuTitle), style="bold red") console.print() table = Table(show_header=True, header_style="bold dim") table.add_column("Paramètre", style="bold magenta") diff --git a/linuxinstaller/linuxinstaller.py b/linuxinstaller/linuxinstaller.py index 068f5e2..1aa7c76 100644 --- a/linuxinstaller/linuxinstaller.py +++ b/linuxinstaller/linuxinstaller.py @@ -102,8 +102,12 @@ def main(): config = readConfig("config.yml") currentBranch = GitActions.getBranch() - description="Menu de configuration linuxinstaller" - parser = argparse.ArgumentParser(description=description) + if 'title' in config: + title=config['title'] + else: + title="Menu de configuration linuxinstaller" + + parser = argparse.ArgumentParser(description=title) parser.add_argument("--tags", help="Exécute les playbooks portant ces étiquettes", action="extend", nargs="+", type=str) for entry in config['ansible_playbooks']: if 'argument_help' in config['ansible_playbooks'][entry]: @@ -148,7 +152,7 @@ def main(): while not cmdlineOptionPassed: - PythonActions.print_status() + PythonActions.print_status(title) console = Console() console.print("Choisir une des options suivantes", style="bold blue") action = inquirer.select(