summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--api/swagger.yaml8
-rw-r--r--api/types/types.go1
-rw-r--r--daemon/info.go1
-rw-r--r--daemon/licensing.go10
-rw-r--r--daemon/licensing_test.go18
-rw-r--r--dockerversion/version_lib.go19
-rw-r--r--docs/api/version-history.md2
-rw-r--r--hack/make/.go-autogen15
-rw-r--r--hack/make/.go-autogen.ps114
10 files changed, 67 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index fc5b7d9964..403c6792ee 100644
--- a/Makefile
+++ b/Makefile
@@ -57,6 +57,7 @@ DOCKER_ENVS := \
-e no_proxy \
-e VERSION \
-e PLATFORM \
+ -e DEFAULT_PRODUCT_LICENSE \
-e PRODUCT
# note: we _cannot_ add "-e DOCKER_BUILDTAGS" here because even if it's unset in the shell, that would shadow the "ENV DOCKER_BUILDTAGS" set in our Dockerfile, which is very important for our official builds
diff --git a/api/swagger.yaml b/api/swagger.yaml
index 204d5b860f..30fbf189de 100644
--- a/api/swagger.yaml
+++ b/api/swagger.yaml
@@ -3896,6 +3896,14 @@ definitions:
- "name=seccomp,profile=default"
- "name=selinux"
- "name=userns"
+ ProductLicense:
+ description: |
+ Reports a summary of the product license on the daemon.
+
+ If a commercial license has been applied to the daemon, information
+ such as number of nodes, and expiration are included.
+ type: "string"
+ example: "Community Engine"
# PluginsInfo is a temp struct holding Plugins name
diff --git a/api/types/types.go b/api/types/types.go
index 06c0ca3a69..ca1b3753a5 100644
--- a/api/types/types.go
+++ b/api/types/types.go
@@ -204,6 +204,7 @@ type Info struct {
RuncCommit Commit
InitCommit Commit
SecurityOptions []string
+ ProductLicense string `json:",omitempty"`
}
// KeyValue holds a key/value pair
diff --git a/daemon/info.go b/daemon/info.go
index 5bcc5d72fa..3575fdda38 100644
--- a/daemon/info.go
+++ b/daemon/info.go
@@ -73,6 +73,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
daemon.fillDriverInfo(v)
daemon.fillPluginsInfo(v)
daemon.fillSecurityOptions(v, sysInfo)
+ daemon.fillLicense(v)
return v, nil
}
diff --git a/daemon/licensing.go b/daemon/licensing.go
new file mode 100644
index 0000000000..3e9fcdbd3d
--- /dev/null
+++ b/daemon/licensing.go
@@ -0,0 +1,10 @@
+package daemon // import "github.com/docker/docker/daemon"
+
+import (
+ "github.com/docker/docker/api/types"
+ "github.com/docker/docker/dockerversion"
+)
+
+func (daemon *Daemon) fillLicense(v *types.Info) {
+ v.ProductLicense = dockerversion.DefaultProductLicense
+}
diff --git a/daemon/licensing_test.go b/daemon/licensing_test.go
new file mode 100644
index 0000000000..5a97ce8fa2
--- /dev/null
+++ b/daemon/licensing_test.go
@@ -0,0 +1,18 @@
+package daemon // import "github.com/docker/docker/daemon"
+
+import (
+ "testing"
+
+ "github.com/docker/docker/api/types"
+ "github.com/docker/docker/dockerversion"
+ "gotest.tools/assert"
+)
+
+func TestfillLicense(t *testing.T) {
+ v := &types.Info{}
+ d := &Daemon{
+ root: "/var/lib/docker/",
+ }
+ d.fillLicense(v)
+ assert.Assert(t, v.ProductLicense == dockerversion.DefaultProductLicense)
+}
diff --git a/dockerversion/version_lib.go b/dockerversion/version_lib.go
index ff1816503b..77b87891be 100644
--- a/dockerversion/version_lib.go
+++ b/dockerversion/version_lib.go
@@ -6,13 +6,14 @@ package dockerversion // import "github.com/docker/docker/dockerversion"
// Default build-time variable for library-import.
// This file is overridden on build with build-time informations.
const (
- GitCommit = "library-import"
- Version = "library-import"
- BuildTime = "library-import"
- IAmStatic = "library-import"
- ContainerdCommitID = "library-import"
- RuncCommitID = "library-import"
- InitCommitID = "library-import"
- PlatformName = ""
- ProductName = ""
+ GitCommit = "library-import"
+ Version = "library-import"
+ BuildTime = "library-import"
+ IAmStatic = "library-import"
+ ContainerdCommitID = "library-import"
+ RuncCommitID = "library-import"
+ InitCommitID = "library-import"
+ PlatformName = ""
+ ProductName = ""
+ DefaultProductLicense = ""
)
diff --git a/docs/api/version-history.md b/docs/api/version-history.md
index 416187f292..b5b81034d4 100644
--- a/docs/api/version-history.md
+++ b/docs/api/version-history.md
@@ -19,6 +19,8 @@ keywords: "API, Docker, rcli, REST, documentation"
* `GET /info` now returns an empty string, instead of `<unknown>` for `KernelVersion`
and `OperatingSystem` if the daemon was unable to obtain this information.
+* `GET /info` now returns information about the product license, if a license
+ has been applied to the daemon.
## V1.38 API changes
diff --git a/hack/make/.go-autogen b/hack/make/.go-autogen
index 342f5ec95b..5d1aab930b 100644
--- a/hack/make/.go-autogen
+++ b/hack/make/.go-autogen
@@ -15,13 +15,14 @@ package dockerversion
// Default build-time variable for library-import.
// This file is overridden on build with build-time informations.
const (
- GitCommit string = "$GITCOMMIT"
- Version string = "$VERSION"
- BuildTime string = "$BUILDTIME"
- IAmStatic string = "${IAMSTATIC:-true}"
- ContainerdCommitID string = "${CONTAINERD_COMMIT}"
- PlatformName string = "${PLATFORM}"
- ProductName string = "${PRODUCT}"
+ GitCommit string = "$GITCOMMIT"
+ Version string = "$VERSION"
+ BuildTime string = "$BUILDTIME"
+ IAmStatic string = "${IAMSTATIC:-true}"
+ ContainerdCommitID string = "${CONTAINERD_COMMIT}"
+ PlatformName string = "${PLATFORM}"
+ ProductName string = "${PRODUCT}"
+ DefaultProductLicense string = "${DEFAULT_PRODUCT_LICENSE}"
)
// AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen
diff --git a/hack/make/.go-autogen.ps1 b/hack/make/.go-autogen.ps1
index 98686e1362..cd4d87c557 100644
--- a/hack/make/.go-autogen.ps1
+++ b/hack/make/.go-autogen.ps1
@@ -16,7 +16,8 @@ param(
[Parameter(Mandatory=$true)][string]$CommitString,
[Parameter(Mandatory=$true)][string]$DockerVersion,
[Parameter(Mandatory=$false)][string]$Platform,
- [Parameter(Mandatory=$false)][string]$Product
+ [Parameter(Mandatory=$false)][string]$Product,
+ [Parameter(Mandatory=$false)][string]$DefaultProductLicense
)
$ErrorActionPreference = "Stop"
@@ -42,11 +43,12 @@ package dockerversion
// Default build-time variable for library-import.
// This file is overridden on build with build-time informations.
const (
- GitCommit string = "'+$CommitString+'"
- Version string = "'+$DockerVersion+'"
- BuildTime string = "'+$buildDateTime+'"
- PlatformName string = "'+$Platform+'"
- ProductName string = "'+$Product+'"
+ GitCommit string = "'+$CommitString+'"
+ Version string = "'+$DockerVersion+'"
+ BuildTime string = "'+$buildDateTime+'"
+ PlatformName string = "'+$Platform+'"
+ ProductName string = "'+$Product+'"
+ DefaultProductLicense string = "'+$DefaultProductLicense+'"
)
// AUTOGENERATED FILE; see hack\make\.go-autogen.ps1