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

View File

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

View File

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