@@ -39,27 +39,40 @@ func (s *RegistryServer) GetPackage(ctx context.Context, req *api.GetPackageRequ
3939}
4040
4141func (s * RegistryServer ) GetBundle (ctx context.Context , req * api.GetBundleRequest ) (* api.Bundle , error ) {
42- bundleString , err := s .store .GetBundle (ctx , req .GetPkgName (), req .GetChannelName (), req .GetCsvName ())
42+ bundleString , bundlepathString , err := s .store .GetBundle (ctx , req .GetPkgName (), req .GetChannelName (), req .GetCsvName ())
4343 if err != nil {
4444 return nil , err
4545 }
46+ // If the value of the `bundle` field in the OperatorBundle table is NULL, return a
47+ // Bundle struct with available fields
48+ if bundleString == "" {
49+ bundle := & api.Bundle {
50+ PackageName : req .PkgName ,
51+ ChannelName : req .ChannelName ,
52+ CsvName : req .CsvName ,
53+ CsvJson : "" ,
54+ Object : []string {},
55+ BundlePath : bundlepathString ,
56+ }
57+ return bundle , nil
58+ }
4659 entry := & registry.ChannelEntry {
4760 PackageName : req .GetPkgName (),
4861 ChannelName : req .GetChannelName (),
4962 }
50- return api .BundleStringToAPIBundle (bundleString , entry )
63+ return api .BundleStringToAPIBundle (bundleString , bundlepathString , entry )
5164}
5265
5366func (s * RegistryServer ) GetBundleForChannel (ctx context.Context , req * api.GetBundleInChannelRequest ) (* api.Bundle , error ) {
54- bundleString , err := s .store .GetBundleForChannel (ctx , req .GetPkgName (), req .GetChannelName ())
67+ bundleString , bundlepathString , err := s .store .GetBundleForChannel (ctx , req .GetPkgName (), req .GetChannelName ())
5568 if err != nil {
5669 return nil , err
5770 }
5871 entry := & registry.ChannelEntry {
5972 PackageName : req .GetPkgName (),
6073 ChannelName : req .GetChannelName (),
6174 }
62- return api .BundleStringToAPIBundle (bundleString , entry )
75+ return api .BundleStringToAPIBundle (bundleString , bundlepathString , entry )
6376}
6477
6578func (s * RegistryServer ) GetChannelEntriesThatReplace (req * api.GetAllReplacementsRequest , stream api.Registry_GetChannelEntriesThatReplaceServer ) error {
@@ -76,7 +89,7 @@ func (s *RegistryServer) GetChannelEntriesThatReplace(req *api.GetAllReplacement
7689}
7790
7891func (s * RegistryServer ) GetBundleThatReplaces (ctx context.Context , req * api.GetReplacementRequest ) (* api.Bundle , error ) {
79- bundleString , err := s .store .GetBundleThatReplaces (ctx , req .GetCsvName (), req .GetPkgName (), req .GetChannelName ())
92+ bundleString , bundlepathString , err := s .store .GetBundleThatReplaces (ctx , req .GetCsvName (), req .GetPkgName (), req .GetChannelName ())
8093 if err != nil {
8194 return nil , err
8295 }
@@ -85,7 +98,7 @@ func (s *RegistryServer) GetBundleThatReplaces(ctx context.Context, req *api.Get
8598 ChannelName : req .GetChannelName (),
8699 Replaces : req .GetCsvName (),
87100 }
88- return api .BundleStringToAPIBundle (bundleString , entry )
101+ return api .BundleStringToAPIBundle (bundleString , bundlepathString , entry )
89102}
90103
91104func (s * RegistryServer ) GetChannelEntriesThatProvide (req * api.GetAllProvidersRequest , stream api.Registry_GetChannelEntriesThatProvideServer ) error {
@@ -115,9 +128,9 @@ func (s *RegistryServer) GetLatestChannelEntriesThatProvide(req *api.GetLatestPr
115128}
116129
117130func (s * RegistryServer ) GetDefaultBundleThatProvides (ctx context.Context , req * api.GetDefaultProviderRequest ) (* api.Bundle , error ) {
118- bundleString , channelEntry , err := s .store .GetBundleThatProvides (ctx , req .GetGroup (), req .GetVersion (), req .GetKind ())
131+ bundleString , bundlepathString , channelEntry , err := s .store .GetBundleThatProvides (ctx , req .GetGroup (), req .GetVersion (), req .GetKind ())
119132 if err != nil {
120133 return nil , err
121134 }
122- return api .BundleStringToAPIBundle (bundleString , channelEntry )
135+ return api .BundleStringToAPIBundle (bundleString , bundlepathString , channelEntry )
123136}
0 commit comments