ngamsEscaladeUtils.py 文件源码

python
阅读 58 收藏 0 点赞 0 评论 0

项目:ngas 作者: ICRAR 项目源码 文件源码
def getControllers():
    """
    Query the controllers available, and return this in a list.

    Returns:   List with available 3ware controllers (list).
    """
    T = TRACE()

    cmd = "sudo /usr/local/sbin/tw_cli info"
    stat, out = commands.getstatusoutput(cmd)
    if (stat):
        raise Exception, "Error invoking 3ware Command Line Tool: " + str(out)
    contList = []
    for line in out.split("\n"):
        line = line.strip()
        if (line):
            if (line.find("Controller") == 0):
                # "Controller 1: 8506-4LP (4)"
                contNo = line.split(" ")[1].split(":")[0]
                contList.append(contNo)
            elif (line[0] == "c"):
                contNo = int(line.split(" ")[0][1:])
                contList.append(contNo)
    contList.sort()
    return contList
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号