Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8864 from ExternalReality/ensure_upgrade_series_h…
…ooks_run #8864 ## Description of change When a `upgrade-series prepare` is initiated hooks need to be run.
- Loading branch information
Showing
26 changed files
with
652 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2018 Canonical Ltd. | ||
// Licensed under the AGPLv3, see LICENCE file for details. | ||
|
||
package model | ||
|
||
import ( | ||
"github.com/juju/errors" | ||
) | ||
|
||
//MachineSeriesUpgradeStatus is the current status a machine series upgrade | ||
type MachineSeriesUpgradeStatus string | ||
|
||
const ( | ||
MachineSeriesUpgradeNotStarted MachineSeriesUpgradeStatus = "NotStarted" | ||
MachineSeriesUpgradeStarted MachineSeriesUpgradeStatus = "Started" | ||
MachineSeriesUpgradeUnitsRunning MachineSeriesUpgradeStatus = "UnitsRunning" | ||
MachineSeriesUpgradeJujuComplete MachineSeriesUpgradeStatus = "JujuComplete" | ||
MachineSeriesUpgradeAgentsStopped MachineSeriesUpgradeStatus = "AgentsStopped" | ||
MachineSeriesUpgradeComplete MachineSeriesUpgradeStatus = "Complete" | ||
) | ||
|
||
//UnitSeriesUpgradeStatus is the current status of a series upgrade for units | ||
type UnitSeriesUpgradeStatus string | ||
|
||
const ( | ||
UnitNotStarted UnitSeriesUpgradeStatus = "NotStarted" | ||
UnitStarted UnitSeriesUpgradeStatus = "Started" | ||
UnitErrored UnitSeriesUpgradeStatus = "Errored" | ||
UnitCompleted UnitSeriesUpgradeStatus = "Completed" | ||
) | ||
|
||
// Validates a string returning an UpgradeSeriesStatus, if valid, or an error. | ||
func ValidateUnitSeriesUpgradeStatus(series string) (UnitSeriesUpgradeStatus, error) { | ||
unCheckedStatus := UnitSeriesUpgradeStatus(series) | ||
switch unCheckedStatus { | ||
case UnitNotStarted, UnitStarted, UnitErrored, UnitCompleted: | ||
return unCheckedStatus, nil | ||
} | ||
|
||
return UnitNotStarted, errors.Errorf("encountered invalid unit upgrade series status of %q", series) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.