Skip to content

Commit 35372bf

Browse files
author
Elias Nygren
committed
improve stop_and_destroy
1 parent 8989841 commit 35372bf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

upcloud_api/server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def _self_destruct():
465465
# first destroy server
466466
try_it_n_times(operation=self.destroy,
467467
expected_error_codes=['SERVER_STATE_ILLEGAL'],
468-
custom_error='stopping server failed')
468+
custom_error='destroying server failed')
469469

470470
# storages may be deleted instantly after server DELETE
471471
for storage in self.storage_devices:
@@ -481,7 +481,10 @@ def _self_destruct():
481481
self._wait_for_state_change(['stopped', 'started'])
482482

483483
if self.state == 'started':
484-
self.stop()
484+
try_it_n_times(operation=self.stop,
485+
expected_error_codes=['SERVER_STATE_ILLEGAL'],
486+
custom_error='stopping server failed')
487+
485488
self._wait_for_state_change(['stopped'])
486489

487490
if self.state == 'stopped':

0 commit comments

Comments
 (0)