Paramétrage du nom de la branche souhaité
This commit is contained in:
parent
08737d7adf
commit
b7f16c46d5
3 changed files with 7 additions and 8 deletions
|
@ -2,6 +2,8 @@
|
|||
base_path: ansible
|
||||
### Titre du menu
|
||||
title: Menu de configuration Libretic
|
||||
### Branche git souhaitée - avertit si la branche constatée est différente
|
||||
git_branch: main
|
||||
|
||||
### Liste des playbooks ansible
|
||||
# ansible_playbooks:
|
||||
|
|
|
@ -18,7 +18,7 @@ def setFQDN(fqdn):
|
|||
|
||||
### Cartouche de status
|
||||
|
||||
def print_status(menuTitle):
|
||||
def print_status(menuTitle, gitBranch):
|
||||
# Récupération des infos
|
||||
hostname = getHostName()
|
||||
domain = getDomain()
|
||||
|
@ -33,9 +33,8 @@ def print_status(menuTitle):
|
|||
table.add_column("Paramètre", style="bold magenta")
|
||||
table.add_column("Valeur")
|
||||
table.add_column("Statut", justify="center")
|
||||
table.add_row("Environnement du poste", currentBranch, "[green]OK" if currentBranch == "main" else "[yellow]Attention")
|
||||
table.add_row("Environnement du poste", currentBranch, "[green]OK" if currentBranch == gitBranch else "[yellow]Attention")
|
||||
table.add_row("Hostname", hostname, "[green]OK" if hostname != "unassigned-hostname" else "[red]KO")
|
||||
console.print(table)
|
||||
console.print()
|
||||
|
||||
|
||||
|
|
|
@ -102,10 +102,8 @@ def main():
|
|||
config = readConfig("config.yml")
|
||||
currentBranch = GitActions.getBranch()
|
||||
|
||||
if 'title' in config:
|
||||
title=config['title']
|
||||
else:
|
||||
title="Menu de configuration linuxinstaller"
|
||||
title = config['title'] if 'title' in config else "Menu de configuration linuxinstaller"
|
||||
gitBranch = config['git_branch'] if 'git_branch' in config else "main"
|
||||
|
||||
parser = argparse.ArgumentParser(description=title)
|
||||
parser.add_argument("--tags", help="Exécute les playbooks portant ces étiquettes", action="extend", nargs="+", type=str)
|
||||
|
@ -152,7 +150,7 @@ def main():
|
|||
|
||||
|
||||
while not cmdlineOptionPassed:
|
||||
PythonActions.print_status(title)
|
||||
PythonActions.print_status(title, gitBranch)
|
||||
console = Console()
|
||||
console.print("Choisir une des options suivantes", style="bold blue")
|
||||
action = inquirer.select(
|
||||
|
|
Loading…
Reference in a new issue