@@ -358,9 +358,9 @@ func (g *GetCmd) getObjects(ctx context.Context, args []string, kind manifest.Ki
358
358
return nil , errors .New ("'sloctl get alerts' does not support Project filtering," +
359
359
" explicitly pass '-A' flag to fetch all Alerts." )
360
360
}
361
- query := url.Values {
362
- objectsV1 . QueryKeyName : args ,
363
- objectsV1 .QueryKeyLabels : parseFilterLabel (g .labels ),
361
+ query := url.Values {objectsV1 . QueryKeyName : args }
362
+ if len ( g . labels ) > 0 {
363
+ query . Set ( objectsV1 .QueryKeyLabels , parseFilterLabel (g .labels ))
364
364
}
365
365
header := http.Header {sdk .HeaderProject : []string {g .client .Config .Project }}
366
366
objects , err := g .client .Objects ().V1 ().Get (ctx , kind , header , query )
@@ -379,7 +379,7 @@ func (g *GetCmd) getObjects(ctx context.Context, args []string, kind manifest.Ki
379
379
return objects , nil
380
380
}
381
381
382
- func parseFilterLabel (filterLabels []string ) [] string {
382
+ func parseFilterLabel (filterLabels []string ) string {
383
383
labels := make (v1alpha.Labels )
384
384
for _ , filterLabel := range filterLabels {
385
385
filteredLabels := strings .Split (filterLabel , "," )
@@ -404,7 +404,7 @@ func parseFilterLabel(filterLabels []string) []string {
404
404
strLabels = append (strLabels , key )
405
405
}
406
406
}
407
- return strLabels
407
+ return strings . Join ( strLabels , "," )
408
408
}
409
409
410
410
func (g * GetCmd ) printObjects (objects interface {}) error {
0 commit comments