[cli][domain] update_db is now run with a string as argument

This commit is contained in:
Maxime Alves LIRMM@home 2020-08-07 00:19:10 +02:00
parent cdcf8d034d
commit 976ba9b808
1 changed files with 50 additions and 56 deletions

View File

@ -39,14 +39,11 @@ def list_routes(domain):
#################
# domain update #
#################
def update_db(domains):
def update_db():
def add_domain(domain):
def add_domain():
"""
Inserts Domain into database
Parameters:
- domain (str): The domain's name
"""
new_domain = Domain(name=domain)
if len(new_domain) == 0:
@ -54,7 +51,7 @@ def update_db(domains):
new_domain.insert()
def add_router(name, domain):
def add_router(name):
"""
Inserts Router into database
@ -69,13 +66,12 @@ def update_db(domains):
router.insert()
def add_acl_fct(fct, domain):
def add_acl_fct(fct):
"""
Inserts ACL function into database
Parameters:
- fct (Callable): The ACL function reference
- domain (str): The Domain's name
"""
acl = AclFunction()
acl.domain = domain
@ -161,7 +157,7 @@ def update_db(domains):
return '_'.join(fct_name)
def add_route(http_verb, path, router, domain, acls):
def add_route(http_verb, path, router, acls):
"""
Inserts Route into database
@ -169,7 +165,6 @@ def update_db(domains):
- http_verb (str): The Route's HTTP method (GET, POST, ...)
- path (str): A path beginning by '/' for the route
- router (str): The Route's Router name
- domain (str): The Domain's name
- acls (List[Callable]): The list of ACL functions for this Route
"""
@ -191,7 +186,6 @@ def update_db(domains):
sys.path.insert(0, BASE_DIR)
for domain in domains:
# Reset Domain relations
delete_domain(domain)