forked from moritz/alakazam
wip add flag to purge specific secret
This commit is contained in:
12
alakazam.py
12
alakazam.py
@ -1240,12 +1240,14 @@ def get_latest_version(app: str) -> str:
|
||||
|
||||
@cli.command()
|
||||
@click.option('-a', '--apps', multiple=True)
|
||||
def purge_secrets(apps: List[str]) -> None:
|
||||
@click.option('-s', '--secret', multiple=False)
|
||||
def purge_secrets(apps: List[str], secret:str) -> None:
|
||||
"""
|
||||
Purges all secrets associated with specified applications.
|
||||
|
||||
Args:
|
||||
apps (list): List of applications from which secrets are to be purged.
|
||||
secrets (list): List of secrets to be purged.
|
||||
"""
|
||||
# TODO: check for deployed apps
|
||||
instance_apps = get_apps(apps)
|
||||
@ -1254,8 +1256,12 @@ def purge_secrets(apps: List[str]) -> None:
|
||||
if input(f"Do you really want to purge the secrets for these apps? Type YES: ") == "YES":
|
||||
for domain in domains:
|
||||
logging.info(f'purge {domain}')
|
||||
abra("app","secret" ,"rm", "-a", domain)
|
||||
print(f"Secrets for {domain} purged")
|
||||
if not secret:
|
||||
abra("app","secret" ,"rm", "-a", domain)
|
||||
print(f"Secrets for {domain} purged")
|
||||
else:
|
||||
abra("app","secret" ,"rm", domain, secret)
|
||||
print(f"Secret {secret} for {domain} purged")
|
||||
|
||||
@cli.command()
|
||||
@click.option('-a', '--apps', multiple=True)
|
||||
|
||||
Reference in New Issue
Block a user