summaryrefslogtreecommitdiff
path: root/libpod/image/docker_registry_options.go
diff options
context:
space:
mode:
authorStefan Becker <chemobejk@gmail.com>2019-08-12 18:28:36 +0300
committerStefan Becker <chemobejk@gmail.com>2019-08-12 18:28:36 +0300
commite7fdaf48db84330a4907a3c7d79462d0466fedc4 (patch)
treee747c44296b3bd8cbcb61a7cb8e92915f05aa5cc /libpod/image/docker_registry_options.go
parentec93c9d8753c1cf346fe7fee3035af1a0dcf9b55 (diff)
downloadpodman-e7fdaf48db84330a4907a3c7d79462d0466fedc4.tar.gz
podman-e7fdaf48db84330a4907a3c7d79462d0466fedc4.tar.bz2
podman-e7fdaf48db84330a4907a3c7d79462d0466fedc4.zip
image: add user agent to Docker registry options
Set the string to "libpod/VERSION" so that we don't use the unspecific default of "Go-http-client/xxx". Fixes #3788 Signed-off-by: Stefan Becker <chemobejk@gmail.com>
Diffstat (limited to 'libpod/image/docker_registry_options.go')
-rw-r--r--libpod/image/docker_registry_options.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/libpod/image/docker_registry_options.go b/libpod/image/docker_registry_options.go
index c191a3ca2..60bb3c33f 100644
--- a/libpod/image/docker_registry_options.go
+++ b/libpod/image/docker_registry_options.go
@@ -1,8 +1,12 @@
package image
import (
+ "fmt"
+
"github.com/containers/image/docker/reference"
"github.com/containers/image/types"
+
+ podmanVersion "github.com/containers/libpod/version"
)
// DockerRegistryOptions encapsulates settings that affect how we connect or
@@ -36,6 +40,7 @@ func (o DockerRegistryOptions) GetSystemContext(parent *types.SystemContext, add
sc.SignaturePolicyPath = parent.SignaturePolicyPath
sc.AuthFilePath = parent.AuthFilePath
sc.DirForceCompress = parent.DirForceCompress
+ sc.DockerRegistryUserAgent = parent.DockerRegistryUserAgent
}
return sc
}
@@ -48,5 +53,7 @@ func GetSystemContext(signaturePolicyPath, authFilePath string, forceCompress bo
}
sc.AuthFilePath = authFilePath
sc.DirForceCompress = forceCompress
+ sc.DockerRegistryUserAgent = fmt.Sprintf("libpod/%s", podmanVersion.Version)
+
return sc
}