@@ -42,6 +42,23 @@ func Manifests(oldIndex, newIndex map[string]*manifest.MappingResult, options *O
4242}
4343
4444func ManifestsOwnership (oldIndex , newIndex map [string ]* manifest.MappingResult , newOwnedReleases map [string ]OwnershipDiff , options * Options , to io.Writer ) bool {
45+ seenAnyChanges , report , err := generateReport (oldIndex , newIndex , nil , options , to )
46+ if err != nil {
47+ panic (err )
48+ }
49+
50+ report .print (to )
51+ report .clean ()
52+ return seenAnyChanges
53+ }
54+
55+ func ManifestReport (oldIndex , newIndex map [string ]* manifest.MappingResult , options * Options , to io.Writer ) (* Report , error ) {
56+ _ , report , err := generateReport (oldIndex , newIndex , nil , options , to )
57+
58+ return report , err
59+ }
60+
61+ func generateReport (oldIndex , newIndex map [string ]* manifest.MappingResult , newOwnedReleases map [string ]OwnershipDiff , options * Options , to io.Writer ) (bool , * Report , error ) {
4562 report := Report {}
4663 report .setupReportFormat (options .OutputFormat )
4764 var possiblyRemoved []string
@@ -86,13 +103,8 @@ func ManifestsOwnership(oldIndex, newIndex map[string]*manifest.MappingResult, n
86103 seenAnyChanges := len (report .entries ) > 0
87104
88105 report , err := doSuppress (report , options .SuppressedOutputLineRegex )
89- if err != nil {
90- panic (err )
91- }
92106
93- report .print (to )
94- report .clean ()
95- return seenAnyChanges
107+ return seenAnyChanges , & report , err
96108}
97109
98110func doSuppress (report Report , suppressedOutputLineRegex []string ) (Report , error ) {
@@ -247,9 +259,9 @@ func preHandleSecrets(old, new *manifest.MappingResult) (v1.Secret, v1.Secret, e
247259 if oldSecretDecodeErr != nil {
248260 old .Content = fmt .Sprintf ("Error parsing old secret: %s" , oldSecretDecodeErr )
249261 } else {
250- //if we have a Secret containing `stringData`, apply the same
251- //transformation that the apiserver would do with it (this protects
252- //stringData keys from being overwritten down below)
262+ // if we have a Secret containing `stringData`, apply the same
263+ // transformation that the apiserver would do with it (this protects
264+ // stringData keys from being overwritten down below)
253265 if len (oldSecret .StringData ) > 0 && oldSecret .Data == nil {
254266 oldSecret .Data = make (map [string ][]byte , len (oldSecret .StringData ))
255267 }
@@ -263,7 +275,7 @@ func preHandleSecrets(old, new *manifest.MappingResult) (v1.Secret, v1.Secret, e
263275 if newSecretDecodeErr != nil {
264276 new .Content = fmt .Sprintf ("Error parsing new secret: %s" , newSecretDecodeErr )
265277 } else {
266- //same as above
278+ // same as above
267279 if len (newSecret .StringData ) > 0 && newSecret .Data == nil {
268280 newSecret .Data = make (map [string ][]byte , len (newSecret .StringData ))
269281 }
0 commit comments