From a70d3f379e7551851cffffcdd77410210235c47c Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Wed, 24 Aug 2016 10:07:48 +0300 Subject: better logger for master_daemon verify root priveleges in dpdk_* scripts call to functions of show status instead of calling process --- scripts/dpdk_setup_ports.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'scripts/dpdk_setup_ports.py') diff --git a/scripts/dpdk_setup_ports.py b/scripts/dpdk_setup_ports.py index 1bbf5b3a..84c44e4a 100755 --- a/scripts/dpdk_setup_ports.py +++ b/scripts/dpdk_setup_ports.py @@ -13,6 +13,7 @@ import shlex import traceback from collections import defaultdict, OrderedDict from distutils.util import strtobool +import getpass class ConfigCreator(object): mandatory_interface_fields = ['Slot_str', 'src_mac', 'dest_mac', 'Device_str', 'NUMA'] @@ -678,12 +679,12 @@ def main (): process_options () if map_driver.args.show: - res=os.system('%s dpdk_nic_bind.py --status' % sys.executable); - return(res); + dpdk_nic_bind.show_status() + return if map_driver.args.table: - res=os.system('%s dpdk_nic_bind.py -t' % sys.executable); - return(res); + dpdk_nic_bind.show_table() + return obj =CIfMap(map_driver.cfg_file); @@ -701,5 +702,8 @@ def main (): exit(-1) if __name__ == '__main__': + if getpass.getuser() != 'root': + print('Please run this program as root/with sudo') + exit(1) main() -- cgit 1.2.3-korg