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})
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
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})
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
def create_local_sdr_cache( username, password, ipaddr, salt, localSdrCache, server): out, err, rc = run_command( ['ipmitool', '-H', ipaddr, '-I', 'lanplus', '-U', username, '-P', decrypt(password, salt), 'sdr', 'dump', localSdrCache]) if rc == 0: return True else: return False
def run_sdr_command( username, password, ipaddr, salt, server, sensor_type, localSdrCache, sdrCachePresent): cmdlist = [ 'ipmitool', '-H', ipaddr, '-I', 'lanplus', '-P', decrypt(password, salt)] if sdrCachePresent: cmdlist.extend(['-S', localSdrCache]) if username != '': cmdlist.extend(['-U', username]) if sensor_type == 'all': cmdlist.extend(['sdr', 'elist']) else: cmdlist.extend(['sdr', 'type', sensor_type]) out, err, rc = run_command(cmdlist) if rc == 0: return out else: raise OperationFailed('GINSDR00001E', {'name': server, 'err': err, 'rc': rc})