Skip to content

Commit d8e33e6

Browse files
authored
fixes isDeprecated when github api quota exceeds (#109)
Signed-off-by: Tullio Sebastiani <tsebasti@redhat.com>
1 parent bbaa3de commit d8e33e6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cmd/root.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package cmd
33

44
import (
55
"fmt"
6+
"os"
7+
68
"github.com/fatih/color"
79
"github.com/krkn-chaos/krknctl/pkg/config"
810
"github.com/krkn-chaos/krknctl/pkg/provider/factory"
911
"github.com/krkn-chaos/krknctl/pkg/scenarioorchestrator"
1012
"github.com/spf13/cobra"
11-
"os"
1213
)
1314

1415
func Execute(providerFactory *factory.ProviderFactory, scenarioOrchestrator *scenarioorchestrator.ScenarioOrchestrator, config config.Config) {
@@ -116,8 +117,9 @@ func Execute(providerFactory *factory.ProviderFactory, scenarioOrchestrator *sce
116117
// update and deprecation check
117118
isDeprecated, err := IsDeprecated(config)
118119
if err != nil {
120+
fmt.Fprintln(os.Stderr, fmt.Sprintf("failed to fetch krknctl version: %v", err))
119121
fmt.Println(err)
120-
os.Exit(1)
122+
121123
}
122124
if isDeprecated != nil && *isDeprecated {
123125
_, err = color.New(color.FgHiRed).Println(fmt.Sprintf("⛔️ krknctl %s is deprecated, please update to latest: %s", config.Version, config.GithubLatestRelease))
@@ -129,8 +131,7 @@ func Execute(providerFactory *factory.ProviderFactory, scenarioOrchestrator *sce
129131

130132
latestVersion, err := GetLatest(config)
131133
if err != nil {
132-
fmt.Println(err)
133-
os.Exit(1)
134+
fmt.Fprintln(os.Stderr, fmt.Sprintf("failed to fetch krknctl version: %v", err))
134135
}
135136

136137
if latestVersion != nil && *latestVersion != config.Version {

0 commit comments

Comments
 (0)