Add list_cmds function
This commit is contained in:
parent
37dedb5cef
commit
6e81d48a5a
24
alakazam.py
24
alakazam.py
|
@ -382,6 +382,17 @@ def replace_domains(path, old_domain, new_domain):
|
|||
file.write(content)
|
||||
|
||||
|
||||
def list_commands(app_config):
|
||||
domain = app_config['app_domain']
|
||||
if not (all_cmds:= app_config.get('execute')):
|
||||
logging.info(f"No post deploy cmds for {domain}")
|
||||
return
|
||||
for cmd in all_cmds:
|
||||
container = cmd.split()[0]
|
||||
cmd = cmd.split()[1:]
|
||||
print(f"{domain}:{container} --> '{cmd}'")
|
||||
|
||||
|
||||
def execute_cmds(app_config):
|
||||
domain = app_config['app_domain']
|
||||
if not (all_cmds:= app_config.get('execute')):
|
||||
|
@ -561,6 +572,19 @@ def cmds(apps):
|
|||
logging.info(f'execute commands for {domain}')
|
||||
execute_cmds(app_config)
|
||||
|
||||
@cli.command()
|
||||
@click.option('-a', '--apps', multiple=True)
|
||||
def list_cmds(apps):
|
||||
""" execute all post deploy cmds """
|
||||
for _, instance_config in CONFIGS.items():
|
||||
if apps:
|
||||
selected_apps = [app for app in apps if app in instance_config.keys()]
|
||||
else:
|
||||
selected_apps = instance_config.keys()
|
||||
for app in selected_apps:
|
||||
app_config = instance_config[app]
|
||||
list_commands(app_config)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('-a', '--apps', multiple=True)
|
||||
|
|
Loading…
Reference in New Issue