Replace dbupdate command with routes.
Allows to use --update, --list, ...
This commit is contained in:
parent
e289f6ad6b
commit
527d5c2e93
|
@ -57,18 +57,28 @@ def delete_domain(domain):
|
||||||
|
|
||||||
|
|
||||||
@click.option('--domain', default=None)
|
@click.option('--domain', default=None)
|
||||||
|
@click.option('--update', default=False, is_flag=True)
|
||||||
|
@click.option('--list', default=False, is_flag=True)
|
||||||
@cli.command()
|
@cli.command()
|
||||||
def dbupdate(domain):
|
def routes(domain, list, update):
|
||||||
if domain is None:
|
domains = DOMAINS if domain is None else [domain]
|
||||||
click.echo('No domain name given, will update all active domains')
|
if update:
|
||||||
for domain in DOMAINS:
|
if not domain:
|
||||||
dbupdate_fct(domain)
|
click.echo('No domain name given, will update all active domains')
|
||||||
sys.exit(0)
|
for domain in domains:
|
||||||
|
update_db(domain)
|
||||||
|
if list:
|
||||||
|
list_routes(domains)
|
||||||
|
|
||||||
|
|
||||||
return dbupdate_fct(domain)
|
def list_routes(domains):
|
||||||
|
for domain in domains:
|
||||||
|
print(f'\nDomain {domain}')
|
||||||
|
routes = Acl(domain=domain)
|
||||||
|
for route in routes.select():
|
||||||
|
print('-', route)
|
||||||
|
|
||||||
|
def update_db(domain=None):
|
||||||
def dbupdate_fct(domain=None):
|
|
||||||
if domain is None:
|
if domain is None:
|
||||||
click.echo('Missing domain', err=True)
|
click.echo('Missing domain', err=True)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue