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

vmware_guest_find: simplify the logic of the code #56369

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@goneri
Copy link
Contributor

commented May 13, 2019

SUMMARY

Simplify the logic of the vmware_guest_find module.

  • reuse the existing find_vm_by_name() function.
  • remove some unnecessary variables
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

vmware_guest_find

vmware_guest_find: simplify the logic of the code
- reuse the existing `find_vm_by_name()` function.
- remove some unnecessary variables

@goneri goneri force-pushed the goneri:vmware_guest_find_simplify branch from c83650a to b669f42 May 13, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 13, 2019

for temp_vm_object in objects:
if temp_vm_object.obj.name == self.name:
vms.append(temp_vm_object.obj)
vm_obj = find_vm_by_name(self.content, vm_name=self.name)

This comment has been minimized.

Copy link
@Akasurde

Akasurde May 14, 2019

Member

I would prefer get_managed_objects_properties over find_vm_by_name.

folder_path = self.get_vm_path(self.content, vm)
results.append(folder_path)
if vm_obj is None:
self.module.fail_json(msg="Failed to find the virtual machine with UUID: %s, name: %s" % (self.uuid, self.name))

This comment has been minimized.

Copy link
@Akasurde

Akasurde May 14, 2019

Member

self.uuid is None when name is specified.

This comment has been minimized.

Copy link
@goneri

goneri May 17, 2019

Author Contributor

I did that on purpose. I would prefer to only have one error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.