@@ -1220,11 +1220,11 @@ class ErrorCode(Enum):
12201220
12211221 def description (self ) -> str :
12221222 descriptions = {
1223- self .EDEN_NOT_RUNNING : "The EdenFS daemon is not running." ,
1223+ self .EDEN_NOT_RUNNING : "The EdenFS daemon doesn't seem to be running." ,
12241224 self .STALE_EDEN_VERSION : "The running EdenFS daemon is over 30 days out-of-date." ,
1225- self .INVALID_CERTS : "The EdenFS couldn't find a valid user certificate." ,
1226- self .NO_REPO_MOUNT_FOUND : "One or more checkouts are unmounted: " ,
1227- self .CHEF_NOT_RUNNING : "Chef is not running on your machine." ,
1225+ self .INVALID_CERTS : "EdenFS couldn't find a valid user certificate." ,
1226+ self .NO_REPO_MOUNT_FOUND : "One or more checkouts are identified as unmounted. " ,
1227+ self .CHEF_NOT_RUNNING : "Chef doesn't seem to be running on your machine." ,
12281228 }
12291229 return descriptions [self ]
12301230
@@ -1245,22 +1245,22 @@ def is_eden_running(self, instance: EdenInstance) -> bool:
12451245 health_info = instance .check_health ()
12461246 if not health_info .is_healthy ():
12471247 self .error_codes [HealthReportCmd .ErrorCode .EDEN_NOT_RUNNING ] = (
1248- "Could not find EdenFS daemon pid. "
1248+ "Failed to find EdenFS daemon pid"
12491249 )
12501250 return False
12511251
12521252 try :
12531253 self .running_version = instance .get_running_version ()
12541254 except EdenNotRunningError :
12551255 self .error_codes [HealthReportCmd .ErrorCode .EDEN_NOT_RUNNING ] = (
1256- "Couldn't retrieve EdenFS running version. "
1256+ "Failed to retrieve EdenFS running version"
12571257 )
12581258 return False
12591259
12601260 self .version_info = version_mod .get_version_info (self .running_version )
12611261 if not self .version_info .is_eden_running :
12621262 self .error_codes [HealthReportCmd .ErrorCode .EDEN_NOT_RUNNING ] = (
1263- "Couldn't retrieve EdenFS running version. "
1263+ "Failed to retrieve EdenFS running version"
12641264 )
12651265 return False
12661266 return True
@@ -1284,7 +1284,7 @@ def are_certs_valid(self) -> bool:
12841284 return True
12851285 # cert error!
12861286 self .error_codes [HealthReportCmd .ErrorCode .INVALID_CERTS ] = (
1287- "Couldn't validate x509 certificates. "
1287+ "Failed to validate x509 certificates"
12881288 )
12891289 return False
12901290
@@ -1299,17 +1299,20 @@ def is_repo_mounted(self, instance: EdenInstance, mounts: List[str]) -> bool:
12991299
13001300 if unmounted_repos :
13011301 self .error_codes [HealthReportCmd .ErrorCode .NO_REPO_MOUNT_FOUND ] = (
1302- ", " .join (unmounted_repos )
1302+ ", " .join (unmounted_repos ) + " not mounted correctly"
13031303 )
13041304 return False
13051305
13061306 return True
1307+
13071308 except Exception as ex :
1308- print (f"Couldn't retrieve EdenFS checkouts info.: { ex } " , file = sys .stderr )
1309- return True
1309+ self .error_codes [HealthReportCmd .ErrorCode .NO_REPO_MOUNT_FOUND ] = " " .join (
1310+ ["Failed to retrieve EdenFS checkouts info: " , ex .args [0 ]]
1311+ )
1312+ return False
13101313
13111314 def is_chef_running (self ) -> bool :
1312- """Examine the status of Chef."""
1315+ """Examine the status of Chef runs ."""
13131316 chef_log_path = get_chef_log_path (platform .system ())
13141317 if chef_log_path is None or chef_log_path == "" :
13151318 print (f"Skipping chef run check for platform { platform .system ()} ." )
@@ -1321,9 +1324,10 @@ def is_chef_running(self) -> bool:
13211324 last_chef_run_sec = chef_log [CHEF_LOG_TIMESTAMP_KEY ]
13221325
13231326 if not isinstance (last_chef_run_sec , (int , float )):
1324- raise ValueError (
1325- f "Invalid/missing timestamp in { CHEF_LOG_TIMESTAMP_KEY } "
1327+ self . error_codes [ HealthReportCmd . ErrorCode . CHEF_NOT_RUNNING ] = (
1328+ "Invalid/missing timestamp in " + CHEF_LOG_TIMESTAMP_KEY
13261329 )
1330+ return False
13271331
13281332 last_chef_run = datetime .fromtimestamp (last_chef_run_sec )
13291333
@@ -1335,7 +1339,7 @@ def is_chef_running(self) -> bool:
13351339 self .error_codes [HealthReportCmd .ErrorCode .CHEF_NOT_RUNNING ] = (
13361340 "Last run was "
13371341 + str ((ms_since_last_run / 3600000 ))
1338- + " hours ago. "
1342+ + " hours ago"
13391343 )
13401344 return False
13411345 return True
@@ -1362,7 +1366,9 @@ def print_error_codes_json(out: ui.Output) -> None:
13621366 data = [
13631367 {
13641368 "error" : error_code .name ,
1365- "description" : error_code .description () + error_additional_info ,
1369+ "description" : error_additional_info
1370+ + ". Possible causes: "
1371+ + error_code .description (),
13661372 }
13671373 for error_code , error_additional_info in HealthReportCmd .error_codes .items ()
13681374 ]
@@ -1389,11 +1395,12 @@ def run(self, args: argparse.Namespace) -> int:
13891395 )
13901396 ):
13911397 exit_code = 1
1392- except Exception as ex :
1393- print (ex )
13941398
1395- self .print_error_codes_json (out )
1396- return exit_code
1399+ self .print_error_codes_json (out )
1400+ return exit_code
1401+
1402+ except Exception as ex :
1403+ raise Exception ("Failed to run health report: " + str (ex ))
13971404
13981405
13991406@subcmd ("strace" , "Monitor FUSE requests." )
0 commit comments