Skip to content

Commit f4a87ba

Browse files
Olivier Richardmeta-codesync[bot]
authored andcommitted
rage: fix {hostname} not substituted in sub-paste titles
Summary: The `rage.reporter` config contains a `{hostname}` placeholder (e.g. `pastry --title "eden rage from {hostname}"`). `RageCmd.run()` in `main.py` correctly substituted this via `str.format(hostname=socket.getfqdn())`, but `print_diagnostic_info()` in `rage.py` and `upload_logs()` in `debug.py` read the same config without substitution. This caused every sub-paste created during a rage (verbose logs, watchman logs, crash logs, etc.) to have a literal `{hostname}` in the title — see P2292964945 for an example. This diff extracts the config-read-and-substitute logic into `get_rage_reporter()` and uses it in all three call sites. Reviewed By: kavehahmadi60 Differential Revision: D103877922 fbshipit-source-id: 175e55fc636c4c4bdb5c80574b40134b5bf27c25
1 parent 583958d commit f4a87ba

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

eden/fs/cli/debug.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,8 +1384,7 @@ def setup_parser(self, parser: argparse.ArgumentParser) -> None:
13841384
def upload_logs(
13851385
self, args: argparse.Namespace, instance: EdenInstance, eden_log_path: Path
13861386
) -> int:
1387-
# For ease of use, just use the same rage reporter
1388-
rage_processor = instance.get_config_value("rage.reporter", default="")
1387+
rage_processor = rage_mod.get_rage_reporter(instance)
13891388

13901389
# pyre-fixme[24]: Generic type `subprocess.Popen` expects 1 type parameter.
13911390
proc: Optional[subprocess.Popen] = None

eden/fs/cli/main.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import shlex
2020
import shutil
2121
import signal
22-
import socket
2322
import subprocess
2423
import sys
2524
import traceback
@@ -3067,10 +3066,7 @@ def setup_parser(self, parser: argparse.ArgumentParser) -> None:
30673066
def run(self, args: argparse.Namespace) -> int:
30683067
instance = get_eden_instance(args)
30693068
instance.log_sample("eden_rage")
3070-
rage_processor = instance.get_config_value("rage.reporter", default="")
3071-
3072-
# Allow "{hostname}" substitution in rage.reporter config.
3073-
rage_processor = rage_processor.format(hostname=socket.getfqdn())
3069+
rage_processor = rage_mod.get_rage_reporter(instance)
30743070

30753071
if args.report:
30763072
rage_mod.report_edenfs_bug(instance, rage_processor)

eden/fs/cli/rage.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import re
1616
import shlex
1717
import shutil
18+
import socket
1819
import subprocess
1920
import sys
2021
import time
@@ -131,6 +132,11 @@ def flush(self) -> None:
131132
self.wrapped.flush()
132133

133134

135+
def get_rage_reporter(instance: EdenInstance) -> str:
136+
processor = instance.get_config_value("rage.reporter", default="")
137+
return processor.format(hostname=socket.getfqdn())
138+
139+
134140
THRIFT_COUNTER_REGEX = (
135141
r"thrift\.(EdenService|BaseService)\..*(time|num_samples|num_calls).*"
136142
)
@@ -375,7 +381,7 @@ def print_diagnostic_info(
375381
print_build_info(out, host, instance)
376382
print_host_dashboard(out, host)
377383

378-
processor = instance.get_config_value("rage.reporter", default="")
384+
processor = get_rage_reporter(instance)
379385
get_eden_logs(out, processor, instance, dry_run)
380386

381387
print_watchman_log(out, processor, dry_run)

0 commit comments

Comments
 (0)