mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
early check if it was called as non-root user
This commit is contained in:
@@ -219,6 +219,10 @@ def _is_list(item):
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
if os.geteuid() != 0:
|
||||
print("Perhaps you didn't use `sudo -E`?")
|
||||
raise(SystemExit)
|
||||
|
||||
if argv is None:
|
||||
argv = sys.argv[1:]
|
||||
|
||||
@@ -295,7 +299,6 @@ def main(argv=None):
|
||||
|
||||
args = argparser.parse_args(argv)
|
||||
|
||||
try:
|
||||
if args.action == 'show':
|
||||
show_config(args.config_path)
|
||||
elif args.action == 'set':
|
||||
@@ -308,9 +311,6 @@ def main(argv=None):
|
||||
reload_component(args.component)
|
||||
else:
|
||||
argparser.print_help()
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
print("Perhaps you didn't use `sudo -E`?")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user