mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-08-16 15:29:45 +00:00
Expand source error (#293)
This commit is contained in:
parent
28e5622d3c
commit
d24489e074
@ -120,6 +120,9 @@ const (
|
|||||||
PassiveBootSuffix = " (fallback)"
|
PassiveBootSuffix = " (fallback)"
|
||||||
RecoveryBootSuffix = " recovery"
|
RecoveryBootSuffix = " recovery"
|
||||||
StateResetBootSuffix = " state reset (auto)"
|
StateResetBootSuffix = " state reset (auto)"
|
||||||
|
|
||||||
|
// Error
|
||||||
|
UpgradeNoSourceError = "Could not find a proper source for the upgrade.\nThis can be configured in the cloud config files under the 'upgrade.system.uri' key or via cmdline using the '--source' flag."
|
||||||
)
|
)
|
||||||
|
|
||||||
func UkiDefaultMenuEntries() []string {
|
func UkiDefaultMenuEntries() []string {
|
||||||
|
@ -187,14 +187,14 @@ type UpgradeSpec struct {
|
|||||||
func (u *UpgradeSpec) Sanitize() error {
|
func (u *UpgradeSpec) Sanitize() error {
|
||||||
if u.RecoveryUpgrade {
|
if u.RecoveryUpgrade {
|
||||||
if u.Recovery.Source.IsEmpty() {
|
if u.Recovery.Source.IsEmpty() {
|
||||||
return fmt.Errorf("undefined upgrade source")
|
return fmt.Errorf(constants.UpgradeNoSourceError)
|
||||||
}
|
}
|
||||||
if u.Partitions.Recovery == nil || u.Partitions.Recovery.MountPoint == "" {
|
if u.Partitions.Recovery == nil || u.Partitions.Recovery.MountPoint == "" {
|
||||||
return fmt.Errorf("undefined recovery partition")
|
return fmt.Errorf("undefined recovery partition")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if u.Active.Source.IsEmpty() {
|
if u.Active.Source.IsEmpty() {
|
||||||
return fmt.Errorf("undefined upgrade source")
|
return fmt.Errorf(constants.UpgradeNoSourceError)
|
||||||
}
|
}
|
||||||
if u.Partitions.State == nil || u.Partitions.State.MountPoint == "" {
|
if u.Partitions.State == nil || u.Partitions.State.MountPoint == "" {
|
||||||
return fmt.Errorf("undefined state partition")
|
return fmt.Errorf("undefined state partition")
|
||||||
|
@ -425,7 +425,7 @@ var _ = Describe("Types", Label("types", "config"), func() {
|
|||||||
It("fails with empty source", func() {
|
It("fails with empty source", func() {
|
||||||
err := spec.Sanitize()
|
err := spec.Sanitize()
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
Expect(err.Error()).To(ContainSubstring("undefined upgrade source"))
|
Expect(err.Error()).To(ContainSubstring(constants.UpgradeNoSourceError))
|
||||||
})
|
})
|
||||||
It("fails with missing state partition", func() {
|
It("fails with missing state partition", func() {
|
||||||
spec.Active.Source = v1.NewFileSrc("/tmp")
|
spec.Active.Source = v1.NewFileSrc("/tmp")
|
||||||
@ -449,7 +449,7 @@ var _ = Describe("Types", Label("types", "config"), func() {
|
|||||||
It("fails with empty source", func() {
|
It("fails with empty source", func() {
|
||||||
err := spec.Sanitize()
|
err := spec.Sanitize()
|
||||||
Expect(err).To(HaveOccurred())
|
Expect(err).To(HaveOccurred())
|
||||||
Expect(err.Error()).To(ContainSubstring("undefined upgrade source"))
|
Expect(err.Error()).To(ContainSubstring(constants.UpgradeNoSourceError))
|
||||||
})
|
})
|
||||||
It("fails with missing recovery partition", func() {
|
It("fails with missing recovery partition", func() {
|
||||||
spec.Recovery.Source = v1.NewFileSrc("/tmp")
|
spec.Recovery.Source = v1.NewFileSrc("/tmp")
|
||||||
|
Loading…
Reference in New Issue
Block a user