Re-run black after 2to3

This commit is contained in:
Adam Cecile 2021-08-17 09:42:50 +02:00
parent 8e78deda38
commit da4f474012
4 changed files with 159 additions and 70 deletions

View File

@ -151,14 +151,28 @@ for controller in controllerlist:
if nagiosmode: if nagiosmode:
if bad: if bad:
print("RAID ERROR - Arrays: OK:" + str(nagiosgoodarray) + " Bad:" + str(nagiosbadarray) + " - Disks: OK:" + str(nagiosgooddisk) + " Bad:" + str( print(
nagiosbaddisk "RAID ERROR - Arrays: OK:"
)) + str(nagiosgoodarray)
+ " Bad:"
+ str(nagiosbadarray)
+ " - Disks: OK:"
+ str(nagiosgooddisk)
+ " Bad:"
+ str(nagiosbaddisk)
)
sys.exit(2) sys.exit(2)
else: else:
print("RAID OK - Arrays: OK:" + str(nagiosgoodarray) + " Bad:" + str(nagiosbadarray) + " - Disks: OK:" + str(nagiosgooddisk) + " Bad:" + str( print(
nagiosbaddisk "RAID OK - Arrays: OK:"
)) + str(nagiosgoodarray)
+ " Bad:"
+ str(nagiosbadarray)
+ " - Disks: OK:"
+ str(nagiosgooddisk)
+ " Bad:"
+ str(nagiosbaddisk)
)
else: else:
if bad: if bad:
print("\nThere is at least one disk/array in a NOT OPTIMAL state.") print("\nThere is at least one disk/array in a NOT OPTIMAL state.")

View File

@ -297,9 +297,23 @@ if printarray:
for tasks in tasksinfo: for tasks in tasksinfo:
if int(tasks[0]) == int(arrayid): if int(tasks[0]) == int(arrayid):
if not config.nagios: if not config.nagios:
print("c" + str(controllerid - 1) + "u" + str(arrayid) + " | " + raidtype + " | " + arrayinfo[2] + "G | " + arrayinfo[ print(
1 "c"
] + " | " + tasks[1] + " | " + tasks[2] + "%") + str(controllerid - 1)
+ "u"
+ str(arrayid)
+ " | "
+ raidtype
+ " | "
+ arrayinfo[2]
+ "G | "
+ arrayinfo[1]
+ " | "
+ tasks[1]
+ " | "
+ tasks[2]
+ "%"
)
done = True done = True
break break
if done == False: if done == False:
@ -346,9 +360,22 @@ while controllerid <= controllernumber:
# Matched in members of this array # Matched in members of this array
if disk[0] == member: if disk[0] == member:
if not config.nagios: if not config.nagios:
print("c" + str(controllerid - 1) + "u" + str(arrayid) + "d" + str(memberid) + " | " + disk[2] + " " + disk[3] + " " + disk[ print(
4 "c"
] + " | " + disk[1]) + str(controllerid - 1)
+ "u"
+ str(arrayid)
+ "d"
+ str(memberid)
+ " | "
+ disk[2]
+ " "
+ disk[3]
+ " "
+ disk[4]
+ " | "
+ disk[1]
)
array_member = True array_member = True
memberid += 1 memberid += 1
@ -362,16 +389,20 @@ while controllerid <= controllernumber:
if config.nagios: if config.nagios:
if bad: if bad:
print(( print(
"RAID ERROR - Controllers OK:%d Bad:%d - Arrays OK:%d Bad:%d - Disks OK:%d Bad:%d" (
% (nagiosgoodctrl, nagiosbadctrl, nagiosgoodarray, nagiosbadarray, nagiosgooddisk, nagiosbaddisk) "RAID ERROR - Controllers OK:%d Bad:%d - Arrays OK:%d Bad:%d - Disks OK:%d Bad:%d"
)) % (nagiosgoodctrl, nagiosbadctrl, nagiosgoodarray, nagiosbadarray, nagiosgooddisk, nagiosbaddisk)
)
)
sys.exit(2) sys.exit(2)
else: else:
print(( print(
"RAID OK - Controllers OK:%d Bad:%d - Arrays OK:%d Bad:%d - Disks OK:%d Bad:%d" (
% (nagiosgoodctrl, nagiosbadctrl, nagiosgoodarray, nagiosbadarray, nagiosgooddisk, nagiosbaddisk) "RAID OK - Controllers OK:%d Bad:%d - Arrays OK:%d Bad:%d - Disks OK:%d Bad:%d"
)) % (nagiosgoodctrl, nagiosbadctrl, nagiosgoodarray, nagiosbadarray, nagiosgooddisk, nagiosbaddisk)
)
)
else: else:
if bad: if bad:
print("\nThere is at least one disk/array in a NOT OPTIMAL state.") print("\nThere is at least one disk/array in a NOT OPTIMAL state.")

View File

@ -770,18 +770,21 @@ if printarray:
if not nagiosmode: if not nagiosmode:
print(ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "DskCache", "Status", "OS Path", "CacheCade", "InProgress")) print(ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "DskCache", "Status", "OS Path", "CacheCade", "InProgress"))
if not nagiosmode: if not nagiosmode:
print(ldfmt % ( print(
arrayinfo[0], ldfmt
arrayinfo[1], % (
arrayinfo[2], arrayinfo[0],
arrayinfo[3], arrayinfo[1],
arrayinfo[4], arrayinfo[2],
arrayinfo[5], arrayinfo[3],
arrayinfo[6], arrayinfo[4],
arrayinfo[7], arrayinfo[5],
arrayinfo[8], arrayinfo[6],
arrayinfo[9], arrayinfo[7],
)) arrayinfo[8],
arrayinfo[9],
)
)
dbgprint("Array state : LD " + arrayinfo[0] + ", status : " + arrayinfo[6]) dbgprint("Array state : LD " + arrayinfo[0] + ", status : " + arrayinfo[6])
if arrayinfo[6] not in ["Optimal", "N/A"]: if arrayinfo[6] not in ["Optimal", "N/A"]:
bad = True bad = True
@ -862,17 +865,20 @@ if totaldrivenumber:
print(drvfmt % ("-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI ID")) print(drvfmt % ("-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI ID"))
# Drive information # Drive information
if not nagiosmode: if not nagiosmode:
print(drvfmt % ( print(
str("c" + str(controllerid) + "u" + array[0] + "p" + array[1]), # c0p0 drvfmt
array[2], # HDD/SDD % (
array[3], # Model Information (Variable len) str("c" + str(controllerid) + "u" + array[0] + "p" + array[1]), # c0p0
array[4], # Size array[2], # HDD/SDD
array[5], # Status (Variable len) array[3], # Model Information (Variable len)
array[6], # Speed array[4], # Size
array[7], # Temp array[5], # Status (Variable len)
str("[" + array[8] + ":" + array[9] + "]"), # Slot ID array[6], # Speed
array[10], array[7], # Temp
)) # LSI ID str("[" + array[8] + ":" + array[9] + "]"), # Slot ID
array[10],
)
) # LSI ID
i = i + 1 i = i + 1
controllerid += 1 controllerid += 1
if not nagiosmode: if not nagiosmode:
@ -969,18 +975,21 @@ if totalunconfdrivenumber:
print(drvfmt % ("-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI ID", "Path")) print(drvfmt % ("-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI ID", "Path"))
# Drive information # Drive information
if not nagiosmode: if not nagiosmode:
print(drvfmt % ( print(
str("c" + str(controllerid) + "uXpY"), # cXpY drvfmt
array[0], # HDD/SDD % (
array[1], # Model Information (Variable len) str("c" + str(controllerid) + "uXpY"), # cXpY
array[2], # Size array[0], # HDD/SDD
array[3], # Status (Variable len) array[1], # Model Information (Variable len)
array[4], # Speed array[2], # Size
array[5], # Temp array[3], # Status (Variable len)
str("[" + array[6] + ":" + array[7] + "]"), # Slot ID array[4], # Speed
array[8], # LSI ID array[5], # Temp
array[9], str("[" + array[6] + ":" + array[7] + "]"), # Slot ID
)) # OS path, if any array[8], # LSI ID
array[9],
)
) # OS path, if any
i += 1 i += 1
controllerid += 1 controllerid += 1
if not nagiosmode: if not nagiosmode:
@ -1002,21 +1011,42 @@ if debugmode:
if nagiosmode: if nagiosmode:
if bad: if bad:
print("RAID ERROR - Arrays: OK:" + str(nagiosgoodarray) + " Bad:" + str(nagiosbadarray) + " - Disks: OK:" + str(nagiosgooddisk) + " Bad:" + str( print(
nagiosbaddisk "RAID ERROR - Arrays: OK:"
)) + str(nagiosgoodarray)
+ " Bad:"
+ str(nagiosbadarray)
+ " - Disks: OK:"
+ str(nagiosgooddisk)
+ " Bad:"
+ str(nagiosbaddisk)
)
sys.exit(2) sys.exit(2)
else: else:
print("RAID OK - Arrays: OK:" + str(nagiosgoodarray) + " Bad:" + str(nagiosbadarray) + " - Disks: OK:" + str(nagiosgooddisk) + " Bad:" + str( print(
nagiosbaddisk "RAID OK - Arrays: OK:"
)) + str(nagiosgoodarray)
+ " Bad:"
+ str(nagiosbadarray)
+ " - Disks: OK:"
+ str(nagiosgooddisk)
+ " Bad:"
+ str(nagiosbaddisk)
)
else: else:
if bad: if bad:
# DO NOT MODIFY OUTPUT BELOW # DO NOT MODIFY OUTPUT BELOW
# Scripts may relies on it # Scripts may relies on it
# https://github.com/eLvErDe/hwraid/issues/99 # https://github.com/eLvErDe/hwraid/issues/99
print("\nThere is at least one disk/array in a NOT OPTIMAL state.") print("\nThere is at least one disk/array in a NOT OPTIMAL state.")
print("RAID ERROR - Arrays: OK:" + str(nagiosgoodarray) + " Bad:" + str(nagiosbadarray) + " - Disks: OK:" + str(nagiosgooddisk) + " Bad:" + str( print(
nagiosbaddisk "RAID ERROR - Arrays: OK:"
)) + str(nagiosgoodarray)
+ " Bad:"
+ str(nagiosbadarray)
+ " - Disks: OK:"
+ str(nagiosgooddisk)
+ " Bad:"
+ str(nagiosbaddisk)
)
sys.exit(1) sys.exit(1)

View File

@ -177,14 +177,28 @@ for ctrl in ctrls:
if nagiosmode: if nagiosmode:
if bad: if bad:
print("RAID ERROR - Arrays: OK:" + str(nagiosgoodarray) + " Bad:" + str(nagiosbadarray) + " - Disks: OK:" + str(nagiosgooddisk) + " Bad:" + str( print(
nagiosbaddisk "RAID ERROR - Arrays: OK:"
)) + str(nagiosgoodarray)
+ " Bad:"
+ str(nagiosbadarray)
+ " - Disks: OK:"
+ str(nagiosgooddisk)
+ " Bad:"
+ str(nagiosbaddisk)
)
sys.exit(2) sys.exit(2)
else: else:
print("RAID OK - Arrays: OK:" + str(nagiosgoodarray) + " Bad:" + str(nagiosbadarray) + " - Disks: OK:" + str(nagiosgooddisk) + " Bad:" + str( print(
nagiosbaddisk "RAID OK - Arrays: OK:"
)) + str(nagiosgoodarray)
+ " Bad:"
+ str(nagiosbadarray)
+ " - Disks: OK:"
+ str(nagiosgooddisk)
+ " Bad:"
+ str(nagiosbaddisk)
)
else: else:
if bad: if bad:
print("\nThere is at least one disk/array in a NOT OPTIMAL state.") print("\nThere is at least one disk/array in a NOT OPTIMAL state.")