Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion baremetal/metal3machine_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ func (m *MachineManager) Delete(ctx context.Context) error {
switch host.Status.Provisioning.State {
case bmh.StateRegistrationError, bmh.StateRegistering,
bmh.StateMatchProfile, bmh.StateInspecting,
bmh.StateReady, bmh.StateAvailable, bmh.StateNone:
bmh.StateReady, bmh.StateAvailable, bmh.StateNone,
bmh.StateUnmanaged:
// Host is not provisioned
waiting = false
case bmh.StateExternallyProvisioned:
Expand Down
17 changes: 13 additions & 4 deletions baremetal/metal3machine_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1282,10 +1282,8 @@ var _ = Describe("Metal3Machine manager", func() {
}
host := bmh.BareMetalHost{}

if tc.Host != nil {
err := c.Get(context.TODO(), key, &host)
Expect(err).NotTo(HaveOccurred())
}
err := c.Get(context.TODO(), key, &host)
Expect(err).NotTo(HaveOccurred())

name := ""
expectedName := ""
Expand Down Expand Up @@ -1398,6 +1396,17 @@ var _ = Describe("Metal3Machine manager", func() {
ExpectedResult: &RequeueAfterError{RequeueAfter: time.Second * 30},
Secret: newSecret(),
}),
Entry("Unmanaged host should not be waited on", testCaseDelete{
Host: newBareMetalHost("myhost", bmhSpecNoImg(),
bmh.StateUnmanaged, bmhPowerStatus(), true, false,
),
Machine: newMachine("mymachine", "", nil),
BMMachine: newMetal3Machine("mybmmachine", nil, bmmSecret(), nil,
bmmObjectMetaWithValidAnnotations(),
),
ExpectSecretDeleted: true,
Secret: newSecret(),
}),
Entry("Consumer ref should be removed from externally provisioned host",
testCaseDelete{
Host: newBareMetalHost("myhost", bmhSpecNoImg(),
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a // indirect
github.com/mdempsky/maligned v0.0.0-20180708014732-6e39bd26a8c8 // indirect
github.com/metal3-io/baremetal-operator v0.0.0-20200617072321-b35c5e9bceba
github.com/metal3-io/baremetal-operator v0.0.0-20200707051855-4d4d033a8059
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.9.0
github.com/openshift/api v3.9.1-0.20190924102528-32369d4db2ad+incompatible // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,8 @@ github.com/metal3-io/baremetal-operator v0.0.0-20200318114549-c3da1db56f43/go.mo
github.com/metal3-io/baremetal-operator v0.0.0-20200402123356-c863ac5a6630 h1:n/FW9YW7qY8/J0YSq/SnXJ6RuLV4Jb3YHeZWQBJdYp8=
github.com/metal3-io/baremetal-operator v0.0.0-20200617072321-b35c5e9bceba h1:1vQVRm3NqHu6vH9KT44oilN0YNtchlR/lROPGp+ACQY=
github.com/metal3-io/baremetal-operator v0.0.0-20200617072321-b35c5e9bceba/go.mod h1:DOgBIuBcXuTD8uub0jL7h6gBdIBt3CFrwz6K2FtfMBA=
github.com/metal3-io/baremetal-operator v0.0.0-20200707051855-4d4d033a8059 h1:Ek7eFJ4t3TS3aosP/FHGhQX9DEm2Z53tnNnHwE/A2Kc=
github.com/metal3-io/baremetal-operator v0.0.0-20200707051855-4d4d033a8059/go.mod h1:DOgBIuBcXuTD8uub0jL7h6gBdIBt3CFrwz6K2FtfMBA=
github.com/mholt/certmagic v0.6.2-0.20190624175158-6a42ef9fe8c2/go.mod h1:g4cOPxcjV0oFq3qwpjSA30LReKD8AoIfwAY9VvG35NY=
github.com/miekg/dns v0.0.0-20181005163659-0d29b283ac0f/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
Expand Down