1
0
mirror of synced 2026-02-13 13:06:56 +00:00

Don't log errors with missing CRDs for "get * all" commands

Whenever an API type is not available then both, `flux get all` and
`flux get image all` will just skip over that type instead of logging
an error message.

Before:

```
$ flux get all
✗ failed to get API group resources: unable to retrieve the complete
list of server APIs: source.toolkit.fluxcd.io/v1beta2: the server
could not find the requested resource
[...]
✗ failed to get API group resources: unable to retrieve the complete
list of server APIs: image.toolkit.fluxcd.io/v1beta2: the server could
not find the requested resource
✗ failed to get API group resources: unable to retrieve the complete
list of server APIs: image.toolkit.fluxcd.io/v1beta2: the server could
not find the requested resource
[...]
$ echo $?
0
```

After:

```
$ flux get all
$ echo $?
0
```
closes #3973

Signed-off-by: Max Jonas Werner <mail@makk.es>
This commit is contained in:
Max Jonas Werner
2023-06-22 17:57:23 +02:00
parent 67968dff7e
commit 173ee5fcdc
2 changed files with 7 additions and 5 deletions

View File

@@ -17,8 +17,6 @@ limitations under the License.
package main
import (
"strings"
"github.com/spf13/cobra"
autov1 "github.com/fluxcd/image-automation-controller/api/v1beta1"
@@ -57,9 +55,7 @@ var getImageAllCmd = &cobra.Command{
for _, c := range allImageCmd {
if err := c.run(cmd, args); err != nil {
if !strings.Contains(err.Error(), "no matches for kind") {
logger.Failuref(err.Error())
}
logger.Failuref(err.Error())
}
}