(ret, output) = commands.getstatusoutput("grep -iln 
'BONDING_OPTS[[:blank:]]*=' /etc/sysconfig/network-scripts/*")
    ret >>= 8
    if not ret:
      bonds = output.split('\n')
      for bond in bonds:
        f4 = open(bond, 'r')
        lines4 = f4.read()
        matchList = 
re.findall(r'.*DEVICE\s*=\s*(\S+).*BONDING_OPTS\s*=\s*"\s*mode\s*=\s*(\d+)\s+miimon\s*=\s*(\d+)',
                               lines4, re.M|re.S|re.I)
        bondCfgTuple = matchList[0]
        fh.write(str(index) + ',' + bondCfgTuple[0] + '双网卡绑定模式,' + 
bondCfgTuple[1] + '\n')
        index += 1
        fh.write(str(index) + ',' + bondCfgTuple[0] + '双网卡绑定检测时长,' + 
bondCfgTuple[2] + '\n')
        index += 1
        f4.close()
    else:
      fh.write(str(index) + ',双网卡绑定模式,NA\n')
      index += 1
      fh.write(str(index) + ',双网卡绑定检测时长,NA\n')
      index += 1
    
    
    
    Run

python support group match

Reply via email to