Skip to content

Commit

Permalink
ensuring that snapshot is actually removed
Browse files Browse the repository at this point in the history
  • Loading branch information
jwcolbert committed Aug 16, 2017
1 parent 59c1bc7 commit 1664454
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 1664454

Please sign in to comment.