Skip to content

Commit 2f0d696

Browse files
committed
Clean up unused lines
1 parent a5944c2 commit 2f0d696

File tree

1 file changed

+15
-18
lines changed
  • merizrizal/idcloudhost/plugins/modules

1 file changed

+15
-18
lines changed

merizrizal/idcloudhost/plugins/modules/vm.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -338,28 +338,25 @@ def _create_vm(self, os_version_choices, network):
338338
self._module.exit_json(**result)
339339

340340
def _delete_vm(self, vm) -> dict:
341-
if 'uuid' in vm:
342-
url = f'{self._base_url}/{self._location}/{self._endpoint_url}'
343-
url_headers = dict(
344-
apikey=self._api_key
345-
)
346-
347-
form_data = dict(
348-
uuid=vm['uuid']
349-
)
341+
url = f'{self._base_url}/{self._location}/{self._endpoint_url}'
342+
url_headers = dict(
343+
apikey=self._api_key
344+
)
350345

351-
response = requests.request('DELETE', url, headers=url_headers, data=form_data, timeout=360)
346+
form_data = dict(
347+
uuid=vm['uuid']
348+
)
352349

353-
if response.status_code == 200:
354-
vm.update(changed=True)
355-
else:
356-
result = dict(
357-
error='There was a problem with the request.'
358-
)
350+
response = requests.request('DELETE', url, headers=url_headers, data=form_data, timeout=360)
359351

360-
self._module.fail_json(msg='Failed to delete the VM.', **result)
352+
if response.status_code == 200:
353+
vm.update(changed=True)
361354
else:
362-
vm.update(changed=False)
355+
result = dict(
356+
error='There was a problem with the request.'
357+
)
358+
359+
self._module.fail_json(msg='Failed to delete the VM.', **result)
363360

364361
return vm
365362

0 commit comments

Comments
 (0)