summaryrefslogtreecommitdiff
path: root/pkg/bindings/generate
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2021-08-02 14:09:55 -0700
committerJhon Honce <jhonce@redhat.com>2021-08-24 16:36:10 -0700
commit1dc6d14735eef1e51368103aefba3d7c704dcfe3 (patch)
tree61109c0b3d99cb3bcf85f53b0f8a837a995b0569 /pkg/bindings/generate
parente9daaf62e3921b8c696f3abd92f001a9447c8aa1 (diff)
downloadpodman-1dc6d14735eef1e51368103aefba3d7c704dcfe3.tar.gz
podman-1dc6d14735eef1e51368103aefba3d7c704dcfe3.tar.bz2
podman-1dc6d14735eef1e51368103aefba3d7c704dcfe3.zip
Fix file descriptor leaks and add test
* Add response.Body.Close() where needed to release HTTP connections to API server. * Add tests to ensure no general leaks occur. 100% coverage would be required to ensure no leaks on any call. * Update code comments to be godoc correct Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/bindings/generate')
-rw-r--r--pkg/bindings/generate/generate.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/bindings/generate/generate.go b/pkg/bindings/generate/generate.go
index 7c904a6a8..742956515 100644
--- a/pkg/bindings/generate/generate.go
+++ b/pkg/bindings/generate/generate.go
@@ -26,10 +26,15 @@ func Systemd(ctx context.Context, nameOrID string, options *SystemdOptions) (*en
if err != nil {
return nil, err
}
+ defer response.Body.Close()
+
report := &entities.GenerateSystemdReport{}
return report, response.Process(&report.Units)
}
+// Kube generate Kubernetes YAML (v1 specification)
+//
+// Note: Caller is responsible for closing returned reader
func Kube(ctx context.Context, nameOrIDs []string, options *KubeOptions) (*entities.GenerateKubeReport, error) {
if options == nil {
options = new(KubeOptions)