input-output-hk / nixops-packet

NixOps Packet.net Plugin
GNU Lesser General Public License v3.0
5 stars 5 forks source link

Destroying a server with a bad API key deletes locally but doesn't destroy the machine #18

Closed grahamc closed 3 years ago

grahamc commented 4 years ago
[nix-shell:~/projects/github.com/ofborg/infrastructure]$ nixops destroy --include packet-spot-eval-{1,2,3}
Fetched!
warning: are you sure you want to destroy Packet.Net machine ‘packet-spot-eval-1’? (y/N) y
warning: are you sure you want to destroy Packet.Net machine ‘packet-spot-eval-2’? (y/N) y
warning: are you sure you want to destroy Packet.Net machine ‘packet-spot-eval-3’? (y/N) y
packet-spot-eval-1...........> destroying instance 6e78cdaf-578c-4192-bda7-6c7ba31cabcc
packet-spot-eval-2...........> destroying instance b3c48611-074f-48ac-aa7b-63573437a60a
packet-spot-eval-3...........> destroying instance 28e99122-3510-45e5-b579-f408c7efb794
Error 401: {'error': 'Invalid authentication token'}
packet-spot-eval-3...........> An error occurred destroying instance. Assuming it's been destroyed already.
Error 401: {'error': 'Invalid authentication token'}Error 401: {'error': 'Invalid authentication token'}

packet-spot-eval-1...........> An error occurred destroying instance. Assuming it's been destroyed already.
packet-spot-eval-2...........> An error occurred destroying instance. Assuming it's been destroyed already.

after this the machines were still existing / costing money, but nixops didn't know anything about them.

johnalotoski commented 3 years ago

Fixed in https://github.com/input-output-hk/nixops-packet/commit/9e26f65e9992b29510c0edb0c4f2fd7c4159ca3c and https://github.com/input-output-hk/nixops-packet/commit/297e907feebc82839df30c0e4fdb155110f53ab2.

If the instance does have an invalid key stored in state, destroy will now raise and not delete the resource. Re-deploying with the new/correct key specified in nix is an easy option to get the proper key into state followed by another destroy command to successfully destroy the instance while the proper key is in state.

johnalotoski commented 3 years ago

Closing. Re-open this ticket or create a new ticket if the issue persists.