diff --git a/common/command.py b/common/command.py new file mode 100644 index 0000000000000000000000000000000000000000..9968bcd23c49670a4d3246aa29ffb3c8c0035e49 --- /dev/null +++ b/common/command.py @@ -0,0 +1,25 @@ +# -*- coding:utf-8 -*- +#!/usr/bin/env python +# cython:language_level=3 + + +class Command: + + @staticmethod + def call(cmd, caller = ''): + ''' + Encapsulated CALL function to return abnormal location information + ''' + if(subprocess.call(cmd, shell = True)): + raise Exception("{} : [{}] Failed to execute!".format(caller, cmd)) + + @staticmethod + def check_ethtool_cg(cmd_stde): + if cmd_stde == b"Cannot get device coalesce settings: Operation not supported\n": + return True + elif cmd_stde == b"Cannot get device ring settings: Operation not supported\n": + return True + else: + return False + + \ No newline at end of file