ionos-cloud / docker-machine-driver

IONOS Cloud Docker Machine Driver
Apache License 2.0
6 stars 3 forks source link

Error when deleting a VM that was not created properly #91

Closed mueller-tobias closed 1 year ago

mueller-tobias commented 1 year ago

Description

If the creation of a VM fails because of a missing configuration before it is created in the DCD, then deleting the machine CRD fails because the driver tries to delete a NIC that has never been created.

Don't know whats the best solution, but i think you should check if the resources exists before removal. If it's not existing the code shouln't run in an error.

Expected behavior

A VM that can't created properly should be removed without to remove finalizers on the Machine CRD.

Environment

Docker Machine Driver Ionos Cloud version:

7.0.

How to Reproduce

Error and Debug Output

Downloading driver from https://rancher.kogo4ic.de/assets/docker-machine-driver-ionoscloud
2023-09-04T06:40:48.003989777Z Doing /etc/rancher/ssl
docker-machine-driver-ionoscloud
docker-machine-driver-ionoscloud: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
About to remove ionos-driver-test-pool1-2e27aa9d-b52jt
WARNING: This action will delete both local reference and remote instance.
2023-09-04T06:40:50.449098409Z (ionos-driver-test-pool1-2e27aa9d-b52jt) NOTICE: Please check IONOS Cloud Console/CLI to ensure there are no leftover resources.
2023-09-04T06:40:50.449134111Z (ionos-driver-test-pool1-2e27aa9d-b52jt) Starting deleting resources...
Error removing host "ionos-driver-test-pool1-2e27aa9d-b52jt": 3 errors occurred:
2023-09-04T06:40:50.648391866Z  * error deleting NIC: Resource does not exist
    * error removing volume: Http method 'DELETE' not allowed. Expected one of [POST,GET,OPTIONS]
2023-09-04T06:40:50.648416983Z  * error deleting server: Http method 'DELETE' not allowed. Expected one of [POST,GET,OPTIONS]
rmocanu-ionos commented 1 year ago

Hello, This should be fixed in the new release, v7.0.2 https://github.com/ionos-cloud/docker-machine-driver/releases/tag/v7.0.2

Please let us know if the problem persists.