mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-13 14:43:03 +00:00
Minor simplification for checking root usage
This commit is contained in:
parent
d351ca9184
commit
21231a15d0
@ -54,7 +54,7 @@ def main():
|
||||
)
|
||||
@click.pass_context
|
||||
def cli(context, root):
|
||||
if utils.get_user_id() == 0:
|
||||
if utils.is_root():
|
||||
fmt.echo_alert(
|
||||
"You are running Tutor as root. This is strongly not recommended. If you are doing this in order to access"
|
||||
" the Docker daemon, you should instead add your user to the 'docker' group. (see https://docs.docker.com"
|
||||
|
@ -126,6 +126,13 @@ def walk_files(path):
|
||||
yield os.path.join(dirpath, filename)
|
||||
|
||||
|
||||
def is_root():
|
||||
"""
|
||||
Check whether tutor is being run as root/sudo.
|
||||
"""
|
||||
return get_user_id() == 0
|
||||
|
||||
|
||||
def get_user_id():
|
||||
"""
|
||||
Portable way to get user ID. Note: I have no idea if it actually works on windows...
|
||||
|
Loading…
Reference in New Issue
Block a user