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 a getDeviceByLabel method #37
Conversation
Add a method to return a VirtualDevice by label and refactor the existing getDeviceKeysByLabel to use it. https://bugzilla.redhat.com/show_bug.cgi?id=1533728
|
Checked commit agrare@0a71f13 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 lib/VMwareWebService/MiqVimVm.rb
|
|
/cc @Fryguy |
|
|
||
| def getDeviceKeysByLabel(device_label, hardware = nil) | ||
| dev = getDeviceByLabel(device_label, hardware) | ||
| dev.values_at("controllerKey", "key", "unitNumber") unless dev.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agrare
Is it ok that this no longer returns an array when no devices are found?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the only caller of this is https://github.com/ManageIQ/manageiq-providers-vmware/blob/master/app/models/manageiq/providers/vmware/infra_manager/vm/reconfigure.rb#L338 which with this changeset applied results in:
>> controller_key, key, unit_number = miq_vim_vm.send(:getDeviceKeysByLabel, "abcd")
=> nil
>> controller_key
=> nil
>> key
=> nil
>> unit_number
=> nil
|
@roliveri WDYT? |
Add a method to return a VirtualDevice by label and refactor the
existing getDeviceKeysByLabel to use it.
https://bugzilla.redhat.com/show_bug.cgi?id=1533728