Skip to content

Commit

Permalink
[elastic-agent] Add hint to version command for binary (#25380)
Browse files Browse the repository at this point in the history
By default when running `elastic-agent version` it is expected that the daemon is running. If it is not running, an error is shown. Then the flag --binary-only should be used. A hint for this is added here to the error message for users.
  • Loading branch information
ruflin authored Apr 28, 2021
1 parent 583b977 commit 7916ad4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/basecmd/version/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewCommandWithArgs(streams *cli.IOStreams) *cobra.Command {
binaryOnly, _ := cmd.Flags().GetBool("binary-only")
if !binaryOnly {
if d, err := queryDaemon(); err != nil {
returnErr = fmt.Errorf("failed to communicate with running daemon: %w", err)
returnErr = fmt.Errorf("could not get version. failed to communicate with running daemon: %w\nUse --binary-only flag to skip trying to retrieve version from running daemon", err)
} else {
daemon = d
if isMismatch(&binary, daemon) {
Expand Down

0 comments on commit 7916ad4

Please sign in to comment.