Fixes VMware module utils

Resolves syntax errors in the `wait_for_tasks`
Removes throw from `find_datacenter_by_name`
pull/10812/head
Joseph Callen 10 years ago
parent b5127c3442
commit 87bc705806

@ -39,14 +39,14 @@ def wait_for_task(task):
while True: while True:
if task.info.state == vim.TaskInfo.State.success: if task.info.state == vim.TaskInfo.State.success:
return True, task.info.result return True, task.info.result
if task.info.state == vim.TaskInfo.State.error if task.info.state == vim.TaskInfo.State.error:
try: try:
raise TaskError(task.info.error) raise TaskError(task.info.error)
except AttributeError: except AttributeError:
raise TaskError("An unknown error has occurred") raise TaskError("An unknown error has occurred")
if task.info.state == vim.TaskInfo.State.running: if task.info.state == vim.TaskInfo.State.running:
time.sleep(15) time.sleep(15)
if task.info.state = vim.TaskInfo.State.queued: if task.info.state == vim.TaskInfo.State.queued:
time.sleep(15) time.sleep(15)
@ -70,7 +70,7 @@ def find_cluster_by_name_datacenter(datacenter, cluster_name):
return None return None
def find_datacenter_by_name(content, datacenter_name, throw=True): def find_datacenter_by_name(content, datacenter_name):
datacenters = get_all_objs(content, [vim.Datacenter]) datacenters = get_all_objs(content, [vim.Datacenter])
for dc in datacenters: for dc in datacenters:

Loading…
Cancel
Save