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 specs for nic_settings customization #927

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

agrare
Copy link
Member

@agrare agrare commented Nov 12, 2024

Started out just writing specs covering the various cases, found an issue where when I used a options[:nic_settings] array I had to duplicate the values in the first nic settings entry at the root level of the options hash as well otherwise it would be overwritten with nil

@agrare agrare added the test label Nov 12, 2024
@agrare agrare requested a review from Fryguy as a code owner November 12, 2024 19:04
@agrare agrare force-pushed the add_specs_customization_nic_settings branch from 049b18d to 0421166 Compare November 12, 2024 19:06
@@ -110,8 +110,11 @@ def collect_nic_settings
nics = Array.wrap(options[:nic_settings])
nic = nics[0]
nic = {} if nic.blank?
[:dns_domain, :dns_servers, :sysprep_netbios_mode, :wins_servers, :addr_mode,
:gateway, :subnet_mask, :ip_addr].each { |key| nic[key] = options[key] }
Copy link
Member Author

@agrare agrare Nov 12, 2024

Choose a reason for hiding this comment

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

NOTE setting nic[key] = options[key] without checking if nic[key] is set already was causing the first entry in the nic_settings array to be overwritten with all nils so you had to duplicate the first nic's values like:

:nic_settings = [{:ip_addr => "1.2.3.4"}],
:ip_addr => "1.2.3.4"

@agrare agrare added the bug label Nov 12, 2024
@Fryguy Fryguy merged commit a802321 into ManageIQ:master Nov 12, 2024
4 checks passed
@Fryguy Fryguy self-assigned this Nov 12, 2024
@agrare agrare deleted the add_specs_customization_nic_settings branch November 12, 2024 19:28
@Fryguy
Copy link
Member

Fryguy commented Nov 14, 2024

Backported to radjabov in commit e5077a0.

commit e5077a02c67661fba51effcac63a9f1649f12a4c
Author: Jason Frey <[email protected]>
Date:   Tue Nov 12 14:27:37 2024 -0500

    Merge pull request #927 from agrare/add_specs_customization_nic_settings
    
    Add specs for nic_settings customization
    
    (cherry picked from commit a80232128ed27461402c1b0bd96d7d461b77d0f3)

Fryguy added a commit that referenced this pull request Nov 14, 2024
Add specs for nic_settings customization

(cherry picked from commit a802321)
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.

2 participants