Possibilité de configuration du titre dans config.yml

This commit is contained in:
Olivier Navas 2024-11-29 11:57:44 +01:00
parent e50dae4b12
commit 08737d7adf
3 changed files with 11 additions and 5 deletions

View file

@ -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:

View file

@ -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")

View file

@ -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(