Skip to content

Commit

Permalink
Fix cleaner not running when the model is dying.
Browse files Browse the repository at this point in the history
  • Loading branch information
hpidcock committed Jul 6, 2023
1 parent 8a3f697 commit 4512661
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 34 deletions.
1 change: 0 additions & 1 deletion cmd/jujud/agent/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ var (
"environ-upgraded-flag",
"not-alive-flag",
"not-dead-flag",
"alive-flag",
"valid-credential-flag",
}
requireValidCredentialModelWorkers = []string{
Expand Down
26 changes: 2 additions & 24 deletions cmd/jujud/agent/model/manifolds.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,6 @@ func commonManifolds(config ManifoldsConfig) dependency.Manifolds {
NewWorker: lifeflag.NewWorker,
// No Logger defined in lifeflag package.
}),
aliveFlagName: lifeflag.Manifold(lifeflag.ManifoldConfig{
APICallerName: apiCallerName,
Entity: modelTag,
Result: life.IsAlive,
Filter: LifeFilter,

NewFacade: func(b base.APICaller) (lifeflag.Facade, error) {
return controllerlifeflag.NewClient(b), nil
},
NewWorker: lifeflag.NewWorker,
// No Logger defined in lifeflag package.
}),
isResponsibleFlagName: singular.Manifold(singular.ManifoldConfig{
Clock: config.Clock,
APICallerName: apiCallerName,
Expand Down Expand Up @@ -457,7 +445,7 @@ func IAASManifolds(config ManifoldsConfig) dependency.Manifolds {
NewCredentialValidatorFacade: common.NewCredentialInvalidatorFacade,
Logger: config.LoggingContext.GetLogger("juju.worker.machineundertaker"),
})),
environUpgraderName: ifAlive(ifCredentialValid(environupgrader.Manifold(environupgrader.ManifoldConfig{
environUpgraderName: ifNotDead(ifCredentialValid(environupgrader.Manifold(environupgrader.ManifoldConfig{
APICallerName: apiCallerName,
EnvironName: environTrackerName,
GateName: environUpgradeGateName,
Expand Down Expand Up @@ -587,7 +575,7 @@ func CAASManifolds(config ManifoldsConfig) dependency.Manifolds {
Logger: config.LoggingContext.GetLogger("juju.worker.caasunitprovisioner"),
},
)),
environUpgraderName: ifAlive(ifCredentialValid(caasenvironupgrader.Manifold(caasenvironupgrader.ManifoldConfig{
environUpgraderName: ifNotDead(ifCredentialValid(caasenvironupgrader.Manifold(caasenvironupgrader.ManifoldConfig{
APICallerName: apiCallerName,
GateName: environUpgradeGateName,
ModelTag: modelTag,
Expand Down Expand Up @@ -655,15 +643,6 @@ var (
},
}.Decorate

// ifAlive wraps a manifold such that it only runs if the
// responsibility flag is set and the model is Alive.
ifAlive = engine.Housing{
Flags: []string{
isResponsibleFlagName,
aliveFlagName,
},
}.Decorate

// ifNotDead wraps a manifold such that it only runs if the
// responsibility flag is set and the model is Alive or Dying.
ifNotDead = engine.Housing{
Expand Down Expand Up @@ -712,7 +691,6 @@ const (
isResponsibleFlagName = "is-responsible-flag"
notDeadFlagName = "not-dead-flag"
notAliveFlagName = "not-alive-flag"
aliveFlagName = "alive-flag"

migrationFortressName = "migration-fortress"
migrationInactiveFlagName = "migration-inactive-flag"
Expand Down
11 changes: 2 additions & 9 deletions cmd/jujud/agent/model/manifolds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func (s *ManifoldsSuite) TestIAASNames(c *gc.C) {
c.Check(actual.SortedValues(), jc.DeepEquals, []string{
"action-pruner",
"agent",
"alive-flag",
"api-caller",
"api-config-watcher",
"application-scaler",
Expand Down Expand Up @@ -85,7 +84,6 @@ func (s *ManifoldsSuite) TestCAASNames(c *gc.C) {
c.Check(actual.SortedValues(), jc.DeepEquals, []string{
"action-pruner",
"agent",
"alive-flag",
"api-caller",
"api-config-watcher",
"caas-application-provisioner",
Expand Down Expand Up @@ -128,7 +126,6 @@ func (s *ManifoldsSuite) TestFlagDependencies(c *gc.C) {
"is-responsible-flag",
"not-alive-flag",
"not-dead-flag",
"alive-flag",
// model upgrade manifolds are run on all
// controller agents, "responsible" or not.
"environ-upgrade-gate",
Expand Down Expand Up @@ -377,19 +374,17 @@ var expectedCAASModelManifoldsWithDependencies = map[string][]string{

"environ-upgrader": {
"agent",
"alive-flag",
"api-caller",
"environ-upgrade-gate",
"is-responsible-flag",
"not-dead-flag",
"valid-credential-flag",
},

"not-alive-flag": {"agent", "api-caller"},

"not-dead-flag": {"agent", "api-caller"},

"alive-flag": {"agent", "api-caller"},

"remote-relations": {
"agent",
"api-caller",
Expand Down Expand Up @@ -616,20 +611,18 @@ var expectedIAASModelManifoldsWithDependencies = map[string][]string{

"environ-upgrader": {
"agent",
"alive-flag",
"api-caller",
"environ-tracker",
"environ-upgrade-gate",
"is-responsible-flag",
"not-dead-flag",
"valid-credential-flag",
},

"not-alive-flag": {"agent", "api-caller"},

"not-dead-flag": {"agent", "api-caller"},

"alive-flag": {"agent", "api-caller"},

"remote-relations": {
"agent",
"api-caller",
Expand Down

0 comments on commit 4512661

Please sign in to comment.