@@ -3,11 +3,13 @@ package appregistry
3
3
import (
4
4
"fmt"
5
5
6
- "github.com/operator-framework/operator-registry/pkg/registry"
7
6
"github.com/sirupsen/logrus"
7
+ utilerrors "k8s.io/apimachinery/pkg/util/errors"
8
8
"k8s.io/client-go/kubernetes"
9
9
"k8s.io/client-go/rest"
10
10
"k8s.io/client-go/tools/clientcmd"
11
+
12
+ "github.com/operator-framework/operator-registry/pkg/registry"
11
13
)
12
14
13
15
// NewLoader returns a new instance of AppregistryLoader.
@@ -71,13 +73,13 @@ func (a *AppregistryLoader) Load(csvSources []string, csvPackages string) (store
71
73
a .logger .Infof ("operator source(s) specified are - %s" , csvSources )
72
74
a .logger .Infof ("package(s) specified are - %s" , csvPackages )
73
75
76
+ var errs []error
74
77
input , err := a .input .Parse (csvSources , csvPackages )
75
78
if err != nil {
76
- a .logger .Errorf ("the following error(s) occurred while parsing input - %v" , err )
77
-
79
+ errs = append (errs , fmt .Errorf ("error parsing input: %s" , err ))
78
80
if input == nil || ! input .IsGoodToProceed () {
79
81
a .logger .Info ("can't proceed, bailing out" )
80
- return
82
+ return nil , utilerrors . NewAggregate ( errs )
81
83
}
82
84
}
83
85
@@ -87,12 +89,7 @@ func (a *AppregistryLoader) Load(csvSources []string, csvPackages string) (store
87
89
88
90
rawManifests , err := a .downloader .Download (input )
89
91
if err != nil {
90
- a .logger .Errorf ("The following error occurred while downloading - %v" , err )
91
-
92
- if len (rawManifests ) == 0 {
93
- a .logger .Info ("No package manifest downloaded" )
94
- return
95
- }
92
+ errs = append (errs , fmt .Errorf ("error downloading manifests: %s" , err ))
96
93
}
97
94
98
95
a .logger .Infof ("download complete - %d repositories have been downloaded" , len (rawManifests ))
@@ -101,27 +98,25 @@ func (a *AppregistryLoader) Load(csvSources []string, csvPackages string) (store
101
98
// flattened single file yaml and nested operator bundle(s).
102
99
result , err := a .decoder .Decode (rawManifests )
103
100
if err != nil {
104
- a .logger .Errorf ("The following error occurred while decoding manifest - %v" , err )
105
-
106
- if result .IsEmpty () {
107
- a .logger .Info ("No operator manifest decoded" )
108
- return
109
- }
101
+ errs = append (errs , fmt .Errorf ("error decoding manifest: %s" , err ))
102
+ }
103
+ if result .IsEmpty () {
104
+ a .logger .Info ("No operator manifest decoded" )
110
105
}
111
106
112
107
a .logger .Infof ("decoded %d flattened and %d nested operator manifest(s)" , result .FlattenedCount , result .NestedCount )
113
108
114
109
if result .Flattened != nil {
115
110
a .logger .Info ("loading flattened operator manifest(s) into sqlite" )
116
111
if err = a .loader .LoadFlattenedToSQLite (result .Flattened ); err != nil {
117
- return
112
+ errs = append ( errs , fmt . Errorf ( "error loading flattened operator manifests: %s" , err ))
118
113
}
119
114
}
120
115
121
116
if result .NestedCount > 0 {
122
117
a .logger .Infof ("loading nested operator bundle(s) from %s into sqlite" , result .NestedDirectory )
123
118
if err = a .loader .LoadBundleDirectoryToSQLite (result .NestedDirectory ); err != nil {
124
- return
119
+ errs = append ( errs , fmt . Errorf ( "error loading nested operator manifests: %s" , err ))
125
120
}
126
121
}
127
122
0 commit comments