Skip to content

Commit

Permalink
Omitting chef last run checks for OD
Browse files Browse the repository at this point in the history
Summary:
Reason:
Chef does not run on ODs because these machines can be reserved for only 18 hours, and sudo access is not permitted on ODs.
More details in this WP post -
https://fb.workplace.com/groups/vscode.feedback/permalink/9190771900989273/

Background:
Our goal is to ensure that Chef is functioning correctly on the user's machine to confirm they have the latest version of Eden installed. Currently, this check is not limited to any specific platform. In this case, it seems that the health report cannot access the Chef log path to accurately read the last updated timestamp, leading to an exception block being triggered. This check was introduced in the following diff: D66439133.

Reviewed By: genevievehelsel

Differential Revision: D68587542

fbshipit-source-id: 0e8b6288ca0cddc9315d5e6ce61df34ec99f4798
  • Loading branch information
ViniGupta08 authored and facebook-github-bot committed Jan 24, 2025
1 parent 8c835f6 commit b5bab8d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions eden/fs/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ def set_sample_rate(self, automation: int) -> None:
# pyre-fixme[31]: Expression `eden.fs.cli.main.ParTelemetryStub()` is not a
# valid type.
usage = ParTelemetryStub()
try:
from eden.fs.cli.facebook.hostcaps import is_on_demand
except ImportError:
# in OSS define a stub
def is_on_demand() -> bool:
return False


from eden.fs.cli.buck import get_buck_command, run_buck_command
from eden.fs.cli.config import HG_REPO_TYPES
Expand Down Expand Up @@ -1320,12 +1327,14 @@ def is_repo_mounted(self, instance: EdenInstance, mounts: List[str]) -> bool:

def is_chef_running(self) -> bool:
"""Examine the status of Chef runs."""
chef_log_path = get_chef_log_path(platform.system())
if chef_log_path is None or chef_log_path == "":
print(f"Skipping chef run check for platform {platform.system()}.")
if is_on_demand() or get_chef_log_path(platform.system()) is None:
print("Skipping chef run check for unsupported platform.")
return True

chef_log_path = get_chef_log_path(platform.system())

try:
with open(chef_log_path, "r") as f:
with open(str(chef_log_path), "r") as f:
chef_log_raw = f.read()
chef_log = json.loads(chef_log_raw)
last_chef_run_sec = chef_log[CHEF_LOG_TIMESTAMP_KEY]
Expand Down

0 comments on commit b5bab8d

Please sign in to comment.