command: Open HTML report in default browser#408
Merged
nirs merged 4 commits intoRamenDR:mainfrom Apr 20, 2026
Merged
Conversation
nirs
commented
Mar 31, 2026
nirs
commented
Apr 9, 2026
8b8c160 to
ac57261
Compare
fbadbfe to
7c40644
Compare
Member
Author
|
@parikshithb should be ready now. |
parikshithb
previously approved these changes
Apr 20, 2026
BrowseReport() opens the HTML report in the default browser so the user
can view it immediately. On macOS we use "open", on Windows "cmd /c
start", and on other platforms "xdg-open".
If opening fails, we log the error to the command log and show a
friendly notice suggesting to open the file manually. If xdg-open is not
installed, we also suggest installing it.
Example output when xdg-open is missing:
⭐ Cannot open "output/test-run.html", please open it in a browser to view the report
Install xdg-open to open the report automatically
Also add console.Hint() for showing suggestions indented under a
previous message.
Assisted-by: Cursor/Claude Opus 4.6
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
The cobra handlers called console.Fatal() to log errors and exit. This means the command has no control over the output after an error, so it cannot do things like opening the HTML report in the browser after logging the failure. Move error output to the command functions using console.Failed(), which logs the error and returns a sentinel error. The cobra handlers call os.Exit(1) when the command returns an error, without logging it. console.Fatal() is replaced by console.Failed() which logs the error and returns a sentinel error to avoid duplicating the error message. Assisted-by: Cursor/Claude Opus 4 Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Add --interactive flag (default auto) that controls interactive features like opening the HTML report in the browser. When not set explicitly, the flag defaults to true if stdout is a terminal, allowing scripts and automation to suppress browser opening without extra flags. The value is resolved in PersistentPreRun before any subcommand executes, so all commands see the final value. The flag will be used to open the report in a browser when validation is done when user interaction is desired. Assisted-by: Cursor/Claude Opus 4.6 Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Always open the HTML report in the browser after validation completes,
whether successful or failed. The validation report helps understand
complex DR setups even when all checks pass.
We open the report only if user interaction is desired, based on
opts.Interactive:
# opens browser (tty)
$ ramenctl validate clusters -o out
# no browser (pipe)
$ ramenctl validate clusters -o out | cat
# opens browser (explicit)
$ ramenctl validate clusters -o out --interactive=true | tee out.log
Assisted-by: Cursor/Claude Opus 4.6
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After validation completes, the HTML report is automatically opened in
the default browser, whether the validation passed or failed. When
ramenctl is used in scripts or automation (stdout piped), the browser is
not opened. Users can override the auto-detection with
--interactive=trueor--interactive=false.Changes:
BrowseReport()function to open the HTML report in the defaultbrowser after a command completes.
commands have full control over the output flow. This is needed to
open the browser after the last error message.
BrowseReport()in the validate commands to open the reportwhen done.
--interactiveflag (default auto) to skip browser opening whenrunning non-interactively. When not set explicitly, defaults to true
if stdout is a terminal.
Example usage:
Based on #424 for testing.