mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Add relevant tests and formatting
This commit is contained in:
committed by
GeorgianaElena
parent
66cd578d75
commit
f799206920
@@ -61,6 +61,7 @@ def set_item_in_config(config, property_path, value):
|
||||
|
||||
return config_copy
|
||||
|
||||
|
||||
def unset_item_from_config(config, property_path):
|
||||
"""
|
||||
Unset key at property_path in config & return new config.
|
||||
@@ -105,6 +106,7 @@ def unset_item_from_config(config, property_path):
|
||||
|
||||
return config_copy
|
||||
|
||||
|
||||
def add_item_to_config(config, property_path, value):
|
||||
"""
|
||||
Add an item to a list in config.
|
||||
@@ -238,6 +240,7 @@ def remove_config_value(config_path, key_path, value):
|
||||
with open(config_path, 'w') as f:
|
||||
yaml.dump(config, f)
|
||||
|
||||
|
||||
def check_hub_ready():
|
||||
from .configurer import load_config
|
||||
|
||||
@@ -250,6 +253,7 @@ def check_hub_ready():
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
def reload_component(component):
|
||||
"""
|
||||
Reload a TLJH component.
|
||||
@@ -392,13 +396,16 @@ def main(argv=None):
|
||||
if args.action == 'show':
|
||||
show_config(args.config_path)
|
||||
elif args.action == 'set':
|
||||
set_config_value(args.config_path, args.key_path, parse_value(args.value))
|
||||
set_config_value(args.config_path, args.key_path,
|
||||
parse_value(args.value))
|
||||
elif args.action == 'unset':
|
||||
unset_config_value(args.config_path, args.key_path)
|
||||
elif args.action == 'add-item':
|
||||
add_config_value(args.config_path, args.key_path, parse_value(args.value))
|
||||
add_config_value(args.config_path, args.key_path,
|
||||
parse_value(args.value))
|
||||
elif args.action == 'remove-item':
|
||||
remove_config_value(args.config_path, args.key_path, parse_value(args.value))
|
||||
remove_config_value(args.config_path, args.key_path,
|
||||
parse_value(args.value))
|
||||
elif args.action == 'reload':
|
||||
reload_component(args.component)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user