feat: self-update of master and agents (#15)
This commit is contained in:
@@ -19,6 +19,10 @@ var (
|
||||
// speaks protocol version 2, which cannot deploy a digest-pinned or
|
||||
// tagless ref. errors.Is(err, ErrAgentTooOld) is true for it as well.
|
||||
ErrAgentTooOldForPinned error = agentTooOldForPinned{}
|
||||
// ErrAgentTooOldForSelfUpdate means the agent that runs the service speaks
|
||||
// a protocol version before 4 and cannot update itself.
|
||||
// errors.Is(err, ErrAgentTooOld) is true for it as well.
|
||||
ErrAgentTooOldForSelfUpdate error = agentTooOldForSelfUpdate{}
|
||||
)
|
||||
|
||||
type agentTooOldForPinned struct{}
|
||||
@@ -29,6 +33,12 @@ func (agentTooOldForPinned) Error() string {
|
||||
|
||||
func (agentTooOldForPinned) Is(target error) bool { return target == ErrAgentTooOld }
|
||||
|
||||
type agentTooOldForSelfUpdate struct{}
|
||||
|
||||
func (agentTooOldForSelfUpdate) Error() string { return "agent too old to update itself" }
|
||||
|
||||
func (agentTooOldForSelfUpdate) Is(target error) bool { return target == ErrAgentTooOld }
|
||||
|
||||
// NotUpdatableError says why a service cannot be updated. Reason is shown
|
||||
// in the UI as is.
|
||||
type NotUpdatableError struct {
|
||||
@@ -44,6 +54,9 @@ const (
|
||||
ReasonNoTag = "follows no tag"
|
||||
ReasonRemoved = "service no longer exists"
|
||||
ReasonBuilt = "built from source (build:)"
|
||||
// ReasonSelfSwarm is for an agent's own Swarm service, which cannot be
|
||||
// updated by the agent that runs in it.
|
||||
ReasonSelfSwarm = "an agent's own Swarm service cannot update itself"
|
||||
|
||||
ReasonDrifted = "drifted: restore or accept the running version first"
|
||||
ReasonNotDrifted = "runs its desired version"
|
||||
|
||||
Reference in New Issue
Block a user