iffld==0:# Special case, as i-1 would loop around.
serverNameCurrentTmp.append(int(serverName[srv][0:serverNamePos[fld]].strip()))# Also convert to int, as we know it's a number.
else:
serverNameCurrentTmp.append(serverName[srv][serverNamePos[fld-1]+1:serverNamePos[fld]].strip())# Get ith field by character position.
ifnot(serverNameCurrentTmp[1]=='[Absent]'andserverNameCurrentTmp[4]==''):# If name is Absent and power status isn't available, there probably isn't a server there.
servers.append(serverNameCurrentTmp)# Only append if the bay is actually in use.
#serverName = ['Bay Server Name Serial Number Status Power UID Partner\r', '--- ------------------------------------------------- --------------- -------- ------- --- -------\r', ' 1 foo-lab-1 OK On Off \r', ' 2 foo-lab-2 CZ302243P9 OK On Off \r', ' 3 foo-lab-3 CZJI441OKP Failed On Off \r', ' 4 kspve1 CZJ18450FK OK On Off \r', ' 5 kspve2-2 OK On Off \r', ' 6 kspve3 OK On Off \r', ' 7 foo-blade OK On Off \r', ' 8 Bar-01 CZ241274CC OK On Off \r', ' 9 baz-sar CZ3217FNYE OK On Off \r', ' 10 baz-sar2 CZ3217FFSS OK On Off \r', ' 11 [Absent] \r', ' 12 bee-bar OK On Off \r', ' 13 [Absent] \r', ' 14 [Absent] \r', ' 15 [Absent] \r', ' 16 [Absent] \r']