bump docker/licensing to 9781369abdb5281cdc07a2a446c6df01347ec793

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5ac07c795f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2019-03-20 18:52:19 +01:00
parent 3a749342a3
commit 667aef15b0
23 changed files with 951 additions and 538 deletions

View File

@ -10,7 +10,7 @@ import (
"github.com/dgrijalva/jwt-go"
"github.com/docker/licensing/lib/go-auth/identity"
"github.com/satori/go.uuid"
"github.com/google/uuid"
)
const (
@ -100,7 +100,7 @@ func Encode(identity identity.DockerIdentity, options EncodeOptions) (string, er
jtiStr := options.Jti
if len(jtiStr) == 0 {
jtiStr = "jti-" + uuid.NewV4().String()
jtiStr = "jti-" + uuid.New().String()
}
token.Claims[jti] = jtiStr

View File

@ -2,11 +2,11 @@ package model
import (
"fmt"
"strings"
"time"
"strings"
validation "github.com/docker/licensing/lib/go-validation"
"github.com/docker/licensing/types"
)
// PricingComponents represents a collection of pricing components
@ -37,20 +37,20 @@ func (s *Subscription) String() string {
storeURL := "https://docker.com/licensing"
var nameMsg, expirationMsg, statusMsg string
switch s.State {
case "cancelled":
switch types.State(s.State) {
case types.Cancelled:
statusMsg = fmt.Sprintf("\tCancelled! You will no longer receive updates. To purchase go to %s", storeURL)
expirationMsg = fmt.Sprintf("Expiration date: %s", s.Expires.Format("2006-01-02"))
case "expired":
case types.Expired:
statusMsg = fmt.Sprintf("\tExpired! You will no longer receive updates. Please renew at %s", storeURL)
expirationMsg = fmt.Sprintf("Expiration date: %s", s.Expires.Format("2006-01-02"))
case "preparing":
case types.Preparing:
statusMsg = "\tYour subscription has not yet begun"
expirationMsg = fmt.Sprintf("Activation date: %s", s.Start.Format("2006-01-02"))
case "failed":
case types.Failed:
statusMsg = "\tOops, this subscription did not get setup properly!"
expirationMsg = ""
case "active":
case types.Active:
statusMsg = "\tLicense is currently active"
expirationMsg = fmt.Sprintf("Expiration date: %s", s.Expires.Format("2006-01-02"))
default:

View File

@ -11,11 +11,10 @@ import (
"strings"
"time"
"github.com/docker/licensing/model"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/licensing/model"
)
var (
@ -88,11 +87,14 @@ func (c *client) LoadLocalLicense(ctx context.Context, clnt WrappedDockerClient)
} else {
// Load the latest license index
var latestVersion int
// check if node is swarm manager
if !info.Swarm.ControlAvailable {
return nil, ErrWorkerNode
}
latestVersion, err = getLatestNamedConfig(clnt, licenseNamePrefix)
if err != nil {
if strings.Contains(err.Error(), "not a swarm manager.") {
return nil, ErrWorkerNode
}
return nil, fmt.Errorf("unable to get latest license version: %s", err)
}
if latestVersion >= 0 {

17
vendor/github.com/docker/licensing/types/types.go generated vendored Normal file
View File

@ -0,0 +1,17 @@
package types
// State represents a given subscription's current status
type State string
const (
// Active means a subscription is currently in a working, live state
Active State = "active"
// Expired means a subscription's end date is in the past
Expired State = "expired"
// Cancelled means the subscription has been cancelled
Cancelled State = "cancelled"
// Preparing means that the subscription's payment (if any) is being still processed
Preparing State = "preparing"
// Failed means that there was a problem creating the subscription
Failed State = "failed"
)