Skip to content

Commit 6c4951c

Browse files
Remove log-credentials-errors flag
There's no reason to hide such an error from the user. Users must be aware that a container has no valid credentials. Zypper will forward any errors encountered in plugins, allowing users to be fully aware why repos and packages are not showing up. Signed-off-by: Alexandre Vicenzi <[email protected]>
1 parent 963c866 commit 6c4951c

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

cmd/container-suseconnect/main.go

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,6 @@ import (
2828
"github.com/urfave/cli/v2"
2929
)
3030

31-
func actionWrapper(action func(*cli.Context) error) func(*cli.Context) error {
32-
return func(ctx *cli.Context) error {
33-
if err := action(ctx); err != nil {
34-
switch err.(type) {
35-
case *cs.SuseConnectError:
36-
if err.(*cs.SuseConnectError).ErrorCode == cs.GetCredentialsError {
37-
if ctx.Bool("log-credentials-errors") {
38-
return err
39-
}
40-
return nil
41-
}
42-
}
43-
return err
44-
}
45-
return nil
46-
}
47-
}
48-
4931
func main() {
5032
cs.SetLoggerOutput()
5133

@@ -75,13 +57,13 @@ func main() {
7557
defaultUsageAdditionListProducts := ""
7658
switch filepath.Base(os.Args[0]) {
7759
case "container-suseconnect-zypp":
78-
app.Action = actionWrapper(runZypperPlugin)
60+
app.Action = runZypperPlugin
7961
defaultUsageAdditionZypp = " (default)"
8062
case "susecloud":
81-
app.Action = actionWrapper(runZypperURLResolver)
63+
app.Action = runZypperURLResolver
8264
defaultUsageAdditionZypp = " (default)"
8365
default:
84-
app.Action = actionWrapper(runListProducts)
66+
app.Action = runListProducts
8567
defaultUsageAdditionListProducts = " (default)"
8668
}
8769

@@ -92,28 +74,20 @@ func main() {
9274
Aliases: []string{"lp"},
9375
Usage: fmt.Sprintf("List available products%v",
9476
defaultUsageAdditionListProducts),
95-
Action: actionWrapper(runListProducts),
77+
Action: runListProducts,
9678
},
9779
{
9880
Name: "list-modules",
9981
Aliases: []string{"lm"},
10082
Usage: "List available modules",
101-
Action: actionWrapper(runListModules),
83+
Action: runListModules,
10284
},
10385
{
10486
Name: "zypper",
10587
Aliases: []string{"z", "zypp"},
10688
Usage: fmt.Sprintf("Run the zypper service plugin%v",
10789
defaultUsageAdditionZypp),
108-
Action: actionWrapper(runZypperPlugin),
109-
},
110-
}
111-
112-
app.Flags = []cli.Flag{
113-
&cli.BoolFlag{
114-
Name: "log-credentials-errors",
115-
Usage: "Print errors with your credentials",
116-
EnvVars: []string{"CONTAINER_SUSECONNECT_LOG_CREDENTIALS_ERR"},
90+
Action: runZypperPlugin,
11791
},
11892
}
11993

0 commit comments

Comments
 (0)