Skip to content

Commit 352492e

Browse files
ROSAENG-15779: New osdctl rhobs alerts subcommand (#923)
* ROSAENG-15779: making sure that json content retrieved from RHOBS is preserved This allows json output format to view content not supported by the other output formats Also making sure that the command original context is forwarded where needed * ROSAENG-15779: most of the content of the cmd/rhobs/requests.go has been moved in the other files of the package in order to reduce the file size * ROSAENG-15779: renaming some files in order standardize the file names in the package * ROSAENG-15779: new `osdctl rhobs alerts` subcommand * ROSAENG-15779: making sure the help is displayed for 'osdctl rhobs' commands on invalid arguments and flags * ROSAENG-15779: there is now a default vault config for the 'osdctl rhobs' commands
1 parent 1cc60dd commit 352492e

28 files changed

Lines changed: 3364 additions & 2319 deletions

cmd/rhobs/alerts_cmd.go

Lines changed: 622 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ package rhobs
22

33
import (
44
"fmt"
5-
"os"
65

7-
log "github.com/sirupsen/logrus"
86
"github.com/spf13/cobra"
97
)
108

@@ -13,19 +11,12 @@ func newCmdCell() *cobra.Command {
1311
Use: "cell",
1412
Short: "Get the RHOBS cell for a given cluster",
1513
Args: cobra.NoArgs,
16-
Run: func(cmd *cobra.Command, args []string) {
17-
cmd.SilenceUsage = true
18-
19-
metricsRhobsFetcher, logsRhobsFetcher, err := CreateMetricsAndLogsRhobsFetchers(commonOptions.clusterId, commonOptions.hiveOcmUrl)
20-
if err != nil {
21-
log.Errorf("Error while computing RHOBS cells: %v", err)
22-
os.Exit(1)
23-
}
24-
14+
RunE: func(cmd *cobra.Command, args []string) error {
15+
metricsRhobsFetcher, logsRhobsFetcher, err := CreateMetricsAndLogsRhobsFetchers(cmd.Context(), commonOptions.clusterId, commonOptions.hiveOcmUrl)
2516
if metricsRhobsFetcher != nil {
2617
if logsRhobsFetcher != nil && metricsRhobsFetcher.RhobsCell == logsRhobsFetcher.RhobsCell {
2718
fmt.Println("Metrics & logs RHOBS cell:", metricsRhobsFetcher.RhobsCell)
28-
return
19+
return err
2920
}
3021

3122
fmt.Println("Metrics RHOBS cell:", metricsRhobsFetcher.RhobsCell)
@@ -34,6 +25,8 @@ func newCmdCell() *cobra.Command {
3425
if logsRhobsFetcher != nil {
3526
fmt.Println("Logs RHOBS cell :", logsRhobsFetcher.RhobsCell)
3627
}
28+
29+
return err
3730
},
3831
}
3932

0 commit comments

Comments
 (0)