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

Fixes #38046 - Make sure IPv6 interface can be primary #10389

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ShimShtein
Copy link
Member

No description provided.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Interesting you hit this code. Facter has networking.primary but I suspect you're using another fact provider.

app/services/fact_parser.rb Outdated Show resolved Hide resolved
@ShimShtein
Copy link
Member Author

Interesting you hit this code. Facter has networking.primary but I suspect you're using another fact provider.

I didn't try a real-life scenario. This was one of the places that had a reference only to IPv4, but not to IPv6. I didn't try to change the logic more than is needed.

While I am at it, changed the implementation to resolve both IPv4 and IPv6 separately.

app/services/fact_parser.rb Outdated Show resolved Hide resolved
app/services/fact_parser.rb Outdated Show resolved Hide resolved
test/unit/fact_parser_test.rb Outdated Show resolved Hide resolved
@ShimShtein ShimShtein force-pushed the add_ipv6_fact_parser branch from 52ebe09 to c2cccfd Compare December 3, 2024 12:44
@ShimShtein
Copy link
Member Author

Now it should look a bit more reasonable. Also fixed the tests to use the testing range.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I think the separate try_resolve method is a good refactor.

Comment on lines +302 to +306
'br0' => {'ipaddress6' => '2001:db8::10', 'macaddress' => '00:00:00:00:00:10'},
'em1' => {'ipaddress6' => '2001:db8::20', 'macaddress' => '00:00:00:00:00:20'},
'em2' => {'ipaddress6' => '2001:db8::30', 'macaddress' => '00:00:00:00:00:30'},
'bond0' => {'ipaddress6' => '2001:db8::40', 'macaddress' => '00:00:00:00:00:40'},
}.with_indifferent_access)
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to be stricter and provide just a regular hash with the right types. Though you are right that it's presented as indifferent access

Suggested change
'br0' => {'ipaddress6' => '2001:db8::10', 'macaddress' => '00:00:00:00:00:10'},
'em1' => {'ipaddress6' => '2001:db8::20', 'macaddress' => '00:00:00:00:00:20'},
'em2' => {'ipaddress6' => '2001:db8::30', 'macaddress' => '00:00:00:00:00:30'},
'bond0' => {'ipaddress6' => '2001:db8::40', 'macaddress' => '00:00:00:00:00:40'},
}.with_indifferent_access)
'br0' => {ipaddress6: '2001:db8::10', macaddress: '00:00:00:00:00:10'},
'em1' => {ipaddress6: '2001:db8::20', macaddress: '00:00:00:00:00:20'},
'em2' => {ipaddress6: '2001:db8::30', macaddress: '00:00:00:00:00:30'},
'bond0' => {ipaddress6: '2001:db8::40', macaddress: '00:00:00:00:00:40'},
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants