Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add complete flag to delete_role #435

Merged
merged 1 commit into from Aug 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions azure/servicemanagement/servicemanagementservice.py
Expand Up @@ -1517,7 +1517,7 @@ def update_role(self, service_name, deployment_name, role_name,
provision_guest_agent),
async=True)

def delete_role(self, service_name, deployment_name, role_name):
def delete_role(self, service_name, deployment_name, role_name, complete = False):
'''
Deletes the specified virtual machine.

Expand All @@ -1527,13 +1527,21 @@ def delete_role(self, service_name, deployment_name, role_name):
The name of the deployment.
role_name:
The name of the role.
complete:
True if all OS/data disks and the source blobs for the disks should
also be deleted from storage.
'''
_validate_not_none('service_name', service_name)
_validate_not_none('deployment_name', deployment_name)
_validate_not_none('role_name', role_name)
return self._perform_delete(
self._get_role_path(service_name, deployment_name, role_name),
async=True)

path = self._get_role_path(service_name, deployment_name, role_name)

if complete == True:
path = path +'?comp=media'

return self._perform_delete(path,
async=True)

def capture_role(self, service_name, deployment_name, role_name,
post_capture_action, target_image_name,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_servicemanagementservice.py
Expand Up @@ -1854,7 +1854,7 @@ def test_delete_role(self):
self._add_role_windows(service_name, deployment_name, role_name2, '59914')

# Act
result = self.sms.delete_role(service_name, deployment_name, role_name2)
result = self.sms.delete_role(service_name, deployment_name, role_name2, True)
self._wait_for_async(result.request_id)

# Assert
Expand Down