Skip to content

Commit

Permalink
Merge pull request #74 from CenturyLinkCloud/snapshot_fix
Browse files Browse the repository at this point in the history
ensuring that snapshot is actually removed
  • Loading branch information
jwcolbert authored Aug 16, 2017
2 parents 59c1bc7 + 1664454 commit 75f8ba4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions clc_ansible_module/clc_server_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@

__version__ = '${version}'

import time
from distutils.version import LooseVersion

try:
Expand Down Expand Up @@ -312,6 +313,15 @@ def _delete_server_snapshot(self, server, ignore_failures):
self.module.fail_json(msg='Failed to delete snapshot for server : {0}. {1}'.format(
server.id, ex.message
))

t_end = time.time() + 300
while time.time() < t_end:
if len(self.clc.v2.Server(server).GetSnapshots()) == 0:
break
if len(self.clc.v2.Server(server).GetSnapshots()) != 0:
self.module.fail_json(msg='Failed to delete snapshot for server : {0}. {1}'.format(
server.id, ex.message))

return result

def ensure_server_snapshot_restore(self, server_ids, ignore_failures):
Expand Down

0 comments on commit 75f8ba4

Please sign in to comment.