Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/bundles/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ import (
"fmt"
"os"
"os/exec"
"strings"

"github.com/spf13/cobra"

// To allow create connection to query the index database
_ "github.com/mattn/go-sqlite3"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
Expand Down Expand Up @@ -124,10 +126,14 @@ func validation(cmd *cobra.Command, args []string) error {

func indexRun(cmd *cobra.Command, args []string) error {
log.Info("Starting audit...")

reportData := index.Data{}
reportData.Flags = flags
pkg.GenerateTemporaryDirs()

// to fix common possible typo issue
reportData.Flags.Filter = strings.ReplaceAll(reportData.Flags.Filter, "”", "")

if err := extractIndexDB(); err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/channels/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"os"
"os/exec"
"strings"

log "github.com/sirupsen/logrus"
// To allow create connection to query the index database
Expand Down Expand Up @@ -103,6 +104,9 @@ func indexRun(cmd *cobra.Command, args []string) error {
reportData.Flags = flags
pkg.GenerateTemporaryDirs()

// to fix common possible typo issue
reportData.Flags.Filter = strings.ReplaceAll(reportData.Flags.Filter, "”", "")

if err := extractIndexDB(); err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions cmd/packages/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"errors"
"os"
"os/exec"
"strings"

log "github.com/sirupsen/logrus"

Expand Down Expand Up @@ -141,6 +142,9 @@ func indexRun(cmd *cobra.Command, args []string) error {
log.Errorf("unable to inspect the index image: %s", err)
}

// to fix common possible typo issue
reportData.Flags.Filter = strings.ReplaceAll(reportData.Flags.Filter, "”", "")

reportData, err = getDataFromIndexDB(reportData)
if err != nil {
return err
Expand Down
8 changes: 8 additions & 0 deletions pkg/reports/bundles/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package bundles
import (
"fmt"

log "github.com/sirupsen/logrus"

sq "github.com/Masterminds/squirrel"
"github.com/blang/semver"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
Expand Down Expand Up @@ -111,6 +113,12 @@ func (d *Data) PrepareReport() Report {
finalReport.Flags = d.Flags
finalReport.Columns = allColumns
finalReport.IndexImageInspect = d.IndexImageInspect

if len(allColumns) == 0 {
log.Fatal("No data was found for the criteria informed. " +
"Please, ensure that you provide valid information.")
}

return finalReport
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/reports/channels/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package channels

import (
"fmt"
"log"
"strings"

sq "github.com/Masterminds/squirrel"
Expand Down Expand Up @@ -89,6 +90,12 @@ func (d *Data) PrepareReport() Report {
finalReport.Flags = d.Flags
finalReport.Columns = allColumns
finalReport.IndexImageInspect = d.IndexImageInspect

if len(allColumns) == 0 {
log.Fatal("No data was found for the criteria informed. " +
"Please, ensure that you provide valid information.")
}

return finalReport
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/reports/packages/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package packages

import (
"fmt"
"log"

sq "github.com/Masterminds/squirrel"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
Expand Down Expand Up @@ -174,6 +175,11 @@ func (d *Data) PrepareReport() Report {
finalReport.Columns = allColumns
finalReport.IndexImageInspect = d.IndexImageInspect

if len(allColumns) == 0 {
log.Fatal("No data was found for the criteria informed. " +
"Please, ensure that you provide valid information.")
}

return finalReport
}

Expand Down