diff --git a/cmd/index/eus/command.go b/cmd/index/eus/command.go index 065258f0..70aae69b 100644 --- a/cmd/index/eus/command.go +++ b/cmd/index/eus/command.go @@ -126,6 +126,10 @@ func run(cmd *cobra.Command, args []string) error { EUSReportColumn = append(EUSReportColumn, channelGrouping) } EUSReportTable = append(EUSReportTable, EUSReportColumn) + + // must rm container so all rmi succeed + command := exec.Command(flags.ContainerEngine, "rm", actions.CatalogIndex) + _, _ = pkg.RunCommand(command) // always remove catalog images, so always non-"server-mode" as elsewhere rmiCmd := exec.Command(flags.ContainerEngine, "rmi", flags.Indexes[index]) _, _ = pkg.RunCommand(rmiCmd) diff --git a/pkg/actions/extract_index.go b/pkg/actions/extract_index.go index 23569d48..511f4acb 100644 --- a/pkg/actions/extract_index.go +++ b/pkg/actions/extract_index.go @@ -23,16 +23,16 @@ import ( log "github.com/sirupsen/logrus" ) -const catalogIndex = "audit-catalog-index" +const CatalogIndex = "audit-catalog-index" func ExtractIndexDBorCatalogs(image string, containerEngine string) error { log.Info("Extracting database...") // Remove image if exists already - command := exec.Command(containerEngine, "rm", catalogIndex) + command := exec.Command(containerEngine, "rm", CatalogIndex) _, _ = pkg.RunCommand(command) // Download the image - command = exec.Command(containerEngine, "create", "--name", catalogIndex, image, "\"yes\"") + command = exec.Command(containerEngine, "create", "--name", CatalogIndex, image, "\"yes\"") _, err := pkg.RunCommand(command) if err != nil { return fmt.Errorf("unable to create container image %s : %s", image, err) @@ -47,7 +47,7 @@ func ExtractIndexDBorCatalogs(image string, containerEngine string) error { log.Fatal(err) } // sqlite db - command = exec.Command(containerEngine, "cp", fmt.Sprintf("%s:/database/index.db", catalogIndex), + command = exec.Command(containerEngine, "cp", fmt.Sprintf("%s:/database/index.db", CatalogIndex), "./output/"+versionTag+"/") _, err = pkg.RunCommand(command) if err != nil { @@ -55,13 +55,13 @@ func ExtractIndexDBorCatalogs(image string, containerEngine string) error { } // transitional indexes have a hidden sqlite db, copy it, and change the name to just index.db command = exec.Command(containerEngine, "cp", - fmt.Sprintf("%s:/var/lib/iib/_hidden/do.not.edit.db", catalogIndex), "./output/"+versionTag+"/index.db") + fmt.Sprintf("%s:/var/lib/iib/_hidden/do.not.edit.db", CatalogIndex), "./output/"+versionTag+"/index.db") _, err = pkg.RunCommand(command) if err != nil { log.Infof("unable to extract the image for index.db (transition or file based config index) %s : %s", image, err) } // For FBC extract they are on the image, in /configs//catalog.json - command = exec.Command(containerEngine, "cp", fmt.Sprintf("%s:/configs/", catalogIndex), + command = exec.Command(containerEngine, "cp", fmt.Sprintf("%s:/configs/", CatalogIndex), "./output/"+versionTag+"/") _, errFbc := pkg.RunCommand(command) if errFbc != nil {