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

Properly update network hash when the first array element is nil #132

Merged
merged 1 commit into from
Nov 8, 2017

Conversation

gmcculloug
Copy link
Member

When calling set_network_adapter(idx, config_hash) from automate it is common to set additional adapters beyond what was selected from the provisioning dialogs.

If a caller passes set_network_adapter(1, <config_hash>) the :network option hash will contain a nil in the first array element. For example the previous call would create the following array: options[:networks] = [nil, <config_hash>]

The first array element is meant to be populated with the dialog network selection, but was instead causing an undefined method '[]' for nil:NilClass)] error.

With this change the code ensures that options[:networks] is an array and populates the first element with the dialog network settings if it is blank.

Refactor and add tests for normalize_network_adapter_settings

https://bugzilla.redhat.com/show_bug.cgi?id=1508069

@miq-bot
Copy link
Member

miq-bot commented Nov 6, 2017

Checked commit gmcculloug@8b196f6 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 👍

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@agrare agrare merged commit 9d93a0d into ManageIQ:master Nov 8, 2017
@agrare agrare added this to the Sprint 73 Ending Nov 13, 2017 milestone Nov 8, 2017
simaishi pushed a commit that referenced this pull request Nov 14, 2017
Properly update network hash when the first array element is nil
(cherry picked from commit 9d93a0d)

https://bugzilla.redhat.com/show_bug.cgi?id=1511502
@simaishi
Copy link
Contributor

Fine backport details:

$ git log -1
commit b58eef51fb5dca864dea82efcd07606b892dc48d
Author: Adam Grare <agrare@redhat.com>
Date:   Wed Nov 8 14:41:07 2017 -0500

    Merge pull request #132 from gmcculloug/normalize_network_adapter
    
    Properly update network hash when the first array element is nil
    (cherry picked from commit 9d93a0dd7242405220c5ea11bbaa3e043d571ae2)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1511502

simaishi pushed a commit that referenced this pull request Nov 15, 2017
Properly update network hash when the first array element is nil
(cherry picked from commit 9d93a0d)

https://bugzilla.redhat.com/show_bug.cgi?id=1511501
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 23b6d983a5037ebaac2c46862990da82d6d2f8fc
Author: Adam Grare <agrare@redhat.com>
Date:   Wed Nov 8 14:41:07 2017 -0500

    Merge pull request #132 from gmcculloug/normalize_network_adapter
    
    Properly update network hash when the first array element is nil
    (cherry picked from commit 9d93a0dd7242405220c5ea11bbaa3e043d571ae2)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1511501

agrare pushed a commit to agrare/manageiq-providers-vmware that referenced this pull request Apr 15, 2019
Spec test for excluding orphaned vms from quota.
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.

4 participants