Commit f6926e85 authored by Brenda J. Butler's avatar Brenda J. Butler Committed by David S. Miller

tools: tc-testing: rootPlugin

Move the functionality that checks for root permissions into a plugin.
Signed-off-by: default avatarBrenda J. Butler <bjb@mojatatu.com>
Acked-by: default avatarLucas Bates <lucasb@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 93707cba
import os
import sys
from TdcPlugin import TdcPlugin
from tdc_config import *
class SubPlugin(TdcPlugin):
def __init__(self):
self.sub_class = 'root/SubPlugin'
super().__init__()
def pre_suite(self, testcount, testidlist):
# run commands before test_runner goes into a test loop
super().pre_suite(testcount, testidlist)
if os.geteuid():
print('This script must be run with root privileges', file=sys.stderr)
exit(1)
...@@ -579,10 +579,6 @@ def set_operation_mode(pm, args): ...@@ -579,10 +579,6 @@ def set_operation_mode(pm, args):
list_test_cases(alltests) list_test_cases(alltests)
exit(0) exit(0)
if (os.geteuid() != 0):
print("This script must be run with root privileges.\n")
exit(1)
ns_create(args, pm) ns_create(args, pm)
if len(alltests): if len(alltests):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment