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 a getDeviceByLabel method #37

Merged
merged 1 commit into from May 14, 2018

Conversation

agrare
Copy link
Member

@agrare agrare commented Apr 30, 2018

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

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
@miq-bot
Copy link
Member

miq-bot commented Apr 30, 2018

Checked commit agrare@0a71f13 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 3 offenses detected

lib/VMwareWebService/MiqVimVm.rb

@agrare
Copy link
Member Author

agrare commented Apr 30, 2018

/cc @Fryguy


def getDeviceKeysByLabel(device_label, hardware = nil)
dev = getDeviceByLabel(device_label, hardware)
dev.values_at("controllerKey", "key", "unitNumber") unless dev.nil?
Copy link
Member

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?

Copy link
Member Author

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

@agrare agrare assigned roliveri and unassigned Fryguy May 11, 2018
@agrare
Copy link
Member Author

agrare commented May 11, 2018

@roliveri WDYT?

@roliveri roliveri merged commit 47a3b55 into ManageIQ:master May 14, 2018
@agrare agrare deleted the add_get_device_by_label branch January 25, 2019 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants