early check if it was called as non-root user

This commit is contained in:
anyushevai
2018-10-23 23:45:33 +03:00
parent 35309d13d0
commit 12aaf382aa

View File

@@ -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__':