예제 #1
0
def delete_sel(server, sel_id):
    serverData = get_config(server)
    sel_id_int = int(sel_id, 16)
    if serverData:
        password = serverData['password']
        ipaddr = serverData['ipaddr']
        salt = serverData['salt']
        if serverData.get('username'):
            out, err, rc = run_command([
                'ipmitool', '-H', ipaddr, '-I', 'lanplus', '-U',
                serverData['username'], '-P',
                decrypt(password, salt), 'sel', 'delete',
                str(sel_id_int)
            ])
        else:
            out, err, rc = run_command([
                'ipmitool', '-H', ipaddr, '-I', 'lanplus', '-P',
                decrypt(password, salt), 'sel', 'delete',
                str(sel_id_int)
            ])
        if rc != 0:
            raise OperationFailed('GINSEL00004E', {
                'name': server,
                'sel_id': sel_id,
                'err': err,
                'rc': rc
            })
    else:
        raise OperationFailed('GINSEL00002E', {'name': server})
예제 #2
0
def get_sels(server):
    sels = []
    serverData = get_config(server)
    if serverData:
        password = serverData['password']
        ipaddr = serverData['ipaddr']
        salt = serverData['salt']
        if serverData.get('username'):
            out, err, rc = run_command([
                'ipmitool', '-H', ipaddr, '-I', 'lanplus', '-U',
                serverData['username'], '-P',
                decrypt(password, salt), 'sel', 'list'
            ])
        else:
            out, err, rc = run_command([
                'ipmitool', '-H', ipaddr, '-I', 'lanplus', '-P',
                decrypt(password, salt), 'sel', 'list'
            ])
        if rc == 0:
            output = out.rstrip().split('\n')
            for each in output:
                sels.append(get_each_sel(each))
        else:
            raise OperationFailed('GINSEL00001E', {
                'name': server,
                'err': err,
                'rc': rc
            })
    else:
        raise OperationFailed('GINSEL00002E', {'name': server})
    return sels
예제 #3
0
def get_sels(server):
    sels = []
    serverData = get_config(server)
    if serverData:
        password = serverData['password']
        ipaddr = serverData['ipaddr']
        salt = serverData['salt']
        if serverData.get('username'):
            out, err, rc = run_command(
                ['ipmitool', '-H', ipaddr, '-I', 'lanplus', '-U',
                 serverData['username'], '-P', decrypt(password, salt),
                 'sel', 'list'])
        else:
            out, err, rc = run_command(
                ['ipmitool', '-H', ipaddr, '-I', 'lanplus', '-P',
                 decrypt(password, salt), 'sel', 'list'])
        if rc == 0:
            output = out.rstrip().split('\n')
            for each in output:
                sels.append(get_each_sel(each))
        else:
            raise OperationFailed(
                'GINSEL00001E',
                {'name': server,
                 'err': err,
                 'rc': rc})
    else:
        raise OperationFailed('GINSEL00002E', {'name': server})
    return sels
예제 #4
0
def delete_sel(server, sel_id):
    serverData = get_config(server)
    sel_id_int = int(sel_id, 16)
    if serverData:
        password = serverData['password']
        ipaddr = serverData['ipaddr']
        salt = serverData['salt']
        if serverData.get('username'):
            out, err, rc = run_command(
                ['ipmitool', '-H', ipaddr, '-I', 'lanplus', '-U',
                 serverData['username'], '-P', decrypt(password, salt),
                 'sel', 'delete', str(sel_id_int)])
        else:
            out, err, rc = run_command(
                ['ipmitool', '-H', ipaddr, '-I', 'lanplus', '-P',
                 decrypt(password, salt), 'sel', 'delete', str(sel_id_int)])
        if rc != 0:
            raise OperationFailed(
                'GINSEL00004E',
                {'name': server,
                 'sel_id': sel_id,
                 'err': err,
                 'rc': rc})
    else:
        raise OperationFailed('GINSEL00002E', {'name': server})
예제 #5
0
def list_sensor_data(server, sensor_type):
    sdrs = []
    serverData = get_config(server)
    if serverData:
        out = get_sdr_data(serverData, sensor_type)
        output = out.rstrip().split('\n')
        for each in output:
            sdrs.append(get_each_sdr(each))
    else:
        raise OperationFailed('GINSEL00002E', {'name': server})
    return sdrs