Skip to content

Commit

Permalink
deleting os-images in storage account (delete_disk) added in purge_all
Browse files Browse the repository at this point in the history
  • Loading branch information
lee212 committed Sep 30, 2016
1 parent 5d1fe87 commit 8d23f6a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion simpleazure/simpleazure.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import os
import base64
import random
import copy
from urlparse import urlparse
from time import sleep
from azure import *
Expand Down Expand Up @@ -602,6 +603,15 @@ def purge_all(self):
print ("Failed to delete {0}".format(i.service_name))
pass
# log("{0} (cloud service) deletion requested".format(i.service_name))

# delete disks
disks = self.sms.list_disks().disks
for i in disks:
try:
res = self.sms.delete_disk(i.name)
except:
print ("Failed to delete {0}".format(i.name))
pass
# Delete storage account
storage = self.sms.list_storage_accounts()
for i in storage:
Expand All @@ -627,7 +637,8 @@ def get_all_items(self):

# initialize
for i in supported:
all_items[i] = item
# shallow, deep copy - reference or value copy of inside objects
all_items[i] = copy.deepcopy(item)

# hosted services, deployments
hosted_services = self.sms.list_hosted_services()
Expand Down

0 comments on commit 8d23f6a

Please sign in to comment.