* Expose license status in Info
This wires up a new field in the Info payload that exposes the license.
For moby this is hardcoded to always report a community edition.
Downstream enterprise dockerd will have additional licensing logic wired
into this function to report details about the current license status.
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
* Code review comments
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
* Add windows autogen support
Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
| ... | ... |
@@ -57,6 +57,7 @@ DOCKER_ENVS := \ |
| 57 | 57 |
-e no_proxy \ |
| 58 | 58 |
-e VERSION \ |
| 59 | 59 |
-e PLATFORM \ |
| 60 |
+ -e DEFAULT_PRODUCT_LICENSE \ |
|
| 60 | 61 |
-e PRODUCT |
| 61 | 62 |
# 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 |
| 62 | 63 |
|
| ... | ... |
@@ -3896,6 +3896,14 @@ definitions: |
| 3896 | 3896 |
- "name=seccomp,profile=default" |
| 3897 | 3897 |
- "name=selinux" |
| 3898 | 3898 |
- "name=userns" |
| 3899 |
+ ProductLicense: |
|
| 3900 |
+ description: | |
|
| 3901 |
+ Reports a summary of the product license on the daemon. |
|
| 3902 |
+ |
|
| 3903 |
+ If a commercial license has been applied to the daemon, information |
|
| 3904 |
+ such as number of nodes, and expiration are included. |
|
| 3905 |
+ type: "string" |
|
| 3906 |
+ example: "Community Engine" |
|
| 3899 | 3907 |
|
| 3900 | 3908 |
|
| 3901 | 3909 |
# PluginsInfo is a temp struct holding Plugins name |
| 79 | 80 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,10 @@ |
| 0 |
+package daemon // import "github.com/docker/docker/daemon" |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "github.com/docker/docker/api/types" |
|
| 4 |
+ "github.com/docker/docker/dockerversion" |
|
| 5 |
+) |
|
| 6 |
+ |
|
| 7 |
+func (daemon *Daemon) fillLicense(v *types.Info) {
|
|
| 8 |
+ v.ProductLicense = dockerversion.DefaultProductLicense |
|
| 9 |
+} |
| 0 | 10 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,18 @@ |
| 0 |
+package daemon // import "github.com/docker/docker/daemon" |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "testing" |
|
| 4 |
+ |
|
| 5 |
+ "github.com/docker/docker/api/types" |
|
| 6 |
+ "github.com/docker/docker/dockerversion" |
|
| 7 |
+ "gotest.tools/assert" |
|
| 8 |
+) |
|
| 9 |
+ |
|
| 10 |
+func TestfillLicense(t *testing.T) {
|
|
| 11 |
+ v := &types.Info{}
|
|
| 12 |
+ d := &Daemon{
|
|
| 13 |
+ root: "/var/lib/docker/", |
|
| 14 |
+ } |
|
| 15 |
+ d.fillLicense(v) |
|
| 16 |
+ assert.Assert(t, v.ProductLicense == dockerversion.DefaultProductLicense) |
|
| 17 |
+} |
| ... | ... |
@@ -6,13 +6,14 @@ package dockerversion // import "github.com/docker/docker/dockerversion" |
| 6 | 6 |
// Default build-time variable for library-import. |
| 7 | 7 |
// This file is overridden on build with build-time informations. |
| 8 | 8 |
const ( |
| 9 |
- GitCommit = "library-import" |
|
| 10 |
- Version = "library-import" |
|
| 11 |
- BuildTime = "library-import" |
|
| 12 |
- IAmStatic = "library-import" |
|
| 13 |
- ContainerdCommitID = "library-import" |
|
| 14 |
- RuncCommitID = "library-import" |
|
| 15 |
- InitCommitID = "library-import" |
|
| 16 |
- PlatformName = "" |
|
| 17 |
- ProductName = "" |
|
| 9 |
+ GitCommit = "library-import" |
|
| 10 |
+ Version = "library-import" |
|
| 11 |
+ BuildTime = "library-import" |
|
| 12 |
+ IAmStatic = "library-import" |
|
| 13 |
+ ContainerdCommitID = "library-import" |
|
| 14 |
+ RuncCommitID = "library-import" |
|
| 15 |
+ InitCommitID = "library-import" |
|
| 16 |
+ PlatformName = "" |
|
| 17 |
+ ProductName = "" |
|
| 18 |
+ DefaultProductLicense = "" |
|
| 18 | 19 |
) |
| ... | ... |
@@ -19,6 +19,8 @@ keywords: "API, Docker, rcli, REST, documentation" |
| 19 | 19 |
|
| 20 | 20 |
* `GET /info` now returns an empty string, instead of `<unknown>` for `KernelVersion` |
| 21 | 21 |
and `OperatingSystem` if the daemon was unable to obtain this information. |
| 22 |
+* `GET /info` now returns information about the product license, if a license |
|
| 23 |
+ has been applied to the daemon. |
|
| 22 | 24 |
|
| 23 | 25 |
## V1.38 API changes |
| 24 | 26 |
|
| ... | ... |
@@ -15,13 +15,14 @@ package dockerversion |
| 15 | 15 |
// Default build-time variable for library-import. |
| 16 | 16 |
// This file is overridden on build with build-time informations. |
| 17 | 17 |
const ( |
| 18 |
- GitCommit string = "$GITCOMMIT" |
|
| 19 |
- Version string = "$VERSION" |
|
| 20 |
- BuildTime string = "$BUILDTIME" |
|
| 21 |
- IAmStatic string = "${IAMSTATIC:-true}"
|
|
| 22 |
- ContainerdCommitID string = "${CONTAINERD_COMMIT}"
|
|
| 23 |
- PlatformName string = "${PLATFORM}"
|
|
| 24 |
- ProductName string = "${PRODUCT}"
|
|
| 18 |
+ GitCommit string = "$GITCOMMIT" |
|
| 19 |
+ Version string = "$VERSION" |
|
| 20 |
+ BuildTime string = "$BUILDTIME" |
|
| 21 |
+ IAmStatic string = "${IAMSTATIC:-true}"
|
|
| 22 |
+ ContainerdCommitID string = "${CONTAINERD_COMMIT}"
|
|
| 23 |
+ PlatformName string = "${PLATFORM}"
|
|
| 24 |
+ ProductName string = "${PRODUCT}"
|
|
| 25 |
+ DefaultProductLicense string = "${DEFAULT_PRODUCT_LICENSE}"
|
|
| 25 | 26 |
) |
| 26 | 27 |
|
| 27 | 28 |
// AUTOGENERATED FILE; see /go/src/github.com/docker/docker/hack/make/.go-autogen |
| ... | ... |
@@ -16,7 +16,8 @@ param( |
| 16 | 16 |
[Parameter(Mandatory=$true)][string]$CommitString, |
| 17 | 17 |
[Parameter(Mandatory=$true)][string]$DockerVersion, |
| 18 | 18 |
[Parameter(Mandatory=$false)][string]$Platform, |
| 19 |
- [Parameter(Mandatory=$false)][string]$Product |
|
| 19 |
+ [Parameter(Mandatory=$false)][string]$Product, |
|
| 20 |
+ [Parameter(Mandatory=$false)][string]$DefaultProductLicense |
|
| 20 | 21 |
) |
| 21 | 22 |
|
| 22 | 23 |
$ErrorActionPreference = "Stop" |
| ... | ... |
@@ -42,11 +43,12 @@ package dockerversion |
| 42 | 42 |
// Default build-time variable for library-import. |
| 43 | 43 |
// This file is overridden on build with build-time informations. |
| 44 | 44 |
const ( |
| 45 |
- GitCommit string = "'+$CommitString+'" |
|
| 46 |
- Version string = "'+$DockerVersion+'" |
|
| 47 |
- BuildTime string = "'+$buildDateTime+'" |
|
| 48 |
- PlatformName string = "'+$Platform+'" |
|
| 49 |
- ProductName string = "'+$Product+'" |
|
| 45 |
+ GitCommit string = "'+$CommitString+'" |
|
| 46 |
+ Version string = "'+$DockerVersion+'" |
|
| 47 |
+ BuildTime string = "'+$buildDateTime+'" |
|
| 48 |
+ PlatformName string = "'+$Platform+'" |
|
| 49 |
+ ProductName string = "'+$Product+'" |
|
| 50 |
+ DefaultProductLicense string = "'+$DefaultProductLicense+'" |
|
| 50 | 51 |
) |
| 51 | 52 |
|
| 52 | 53 |
// AUTOGENERATED FILE; see hack\make\.go-autogen.ps1 |