@@ -96,7 +96,6 @@ def analyze_data(
9696 return self .result
9797
9898 self .result .status = ExecutionStatus .OK
99- fail = False
10099 passing_devices = []
101100 failing_devices = []
102101 for device_name , device_data in data .storage_data .items ():
@@ -123,14 +122,11 @@ def analyze_data(
123122 condition = condition and (free_prct > args .min_required_free_space_prct )
124123
125124 if condition :
126- passing_devices .append (
127- f"'{ device_name } ' has { bytes_to_human_readable (device_data .free )} available, { device_data .percent } % used"
128- )
125+ passing_devices .append (device_name )
129126 else :
130- fail = True
131127 device = convert_to_bytes (str (device_data .total ))
132128 prct = device_data .percent
133- failing_devices .append (f" { device_name } " )
129+ failing_devices .append (device_name )
134130 event_data = {
135131 "offending_device" : {
136132 "device" : device_name ,
@@ -141,14 +137,16 @@ def analyze_data(
141137 }
142138 self ._log_event (
143139 category = EventCategory .STORAGE ,
144- description = f"{ self . result . message } { bytes_to_human_readable (device )} and { prct } %, used on { device_name } " ,
140+ description = f"Insufficient disk space: { bytes_to_human_readable (device )} and { prct } %, used on { device_name } " ,
145141 data = event_data ,
146142 priority = EventPriority .CRITICAL ,
147143 console_log = True ,
148144 )
149- if fail :
145+ if failing_devices :
150146 self .result .message = f"Insufficient disk space on " f"[{ ', ' .join (failing_devices )} ]"
151147 self .result .status = ExecutionStatus .ERROR
152148 else :
153- self .result .message = "," .join (passing_devices )
149+ self .result .message = (
150+ f"Sufficient disk space available on " f"[{ ', ' .join (passing_devices )} ]"
151+ )
154152 return self .result
0 commit comments