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 #36547 - Fix parsing of Ubuntu version in fact parsers #10145

Merged
merged 1 commit into from
May 23, 2024

Conversation

goarsna
Copy link
Contributor

@goarsna goarsna commented Apr 29, 2024

Replacement PR for #9760 which has been closed by the github-actions bot and was unfortunately force pushed afterwards.

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'm wondering about this line here:

validates :major, numericality: true, presence: { message: N_("Operating System version is required") }

Looking at https://guides.rubyonrails.org/active_record_validations.html#numericality it should recognize it as a float so I have a hard time explaining the test failures.

test/models/operatingsystem_test.rb Outdated Show resolved Hide resolved
db/migrate/20230719080900_fix_ubuntu_versions.rb Outdated Show resolved Hide resolved
@goarsna
Copy link
Contributor Author

goarsna commented May 14, 2024

Thanks for your review. Ewoud. I also added some suggestions from Bernhard.
I also don't know what exactly causes the failing tests. The only thing I know is, that the tests work for delevop branch 😅 But I'll hopefully be able to fix them soon 🤞

@goarsna
Copy link
Contributor Author

goarsna commented May 14, 2024

Fixed it :) Could you please have a look again @sbernhard and @ekohl?

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.

Not a complete review, mostly making some notes for myself.

Comment on lines +9 to +10
major = os_major_version
minor = os_minor_version
Copy link
Member

Choose a reason for hiding this comment

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

On a related note (but not necessarily in this PR): I'm still inclined to make this the default, not just for Ubuntu but for all. I'd be happy to accept a follow up PR that implements that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but this should definitely be handled by an extra PR as mentioned here

test "should correctly identify Ubuntu 18.04" do
assert_equal 'Ubuntu', subject.send(:os_name)
assert_equal '18.04', subject.send(:os_major_version)
assert_nil subject.send(:os_minor_version)
Copy link
Member

Choose a reason for hiding this comment

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

Note to self: this was surprising, but there is no minor for Ubuntu releases. I checked Puppet 8's facter version on 20.04 and it wasn't there.

app/services/foreman_ansible/operating_system_parser.rb Outdated Show resolved Hide resolved
@goarsna
Copy link
Contributor Author

goarsna commented May 23, 2024

Thanks @nadjaheitmann for your review again. Although the possible minor versions are limited by the database model we decided to limit them in the migration to only affect valid Ubuntu minor versions.

@nadjaheitmann
Copy link
Contributor

Tested the host registration part and the migration and both works fine.

Copy link
Contributor

@sbernhard sbernhard left a comment

Choose a reason for hiding this comment

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

Thanks @goarsna

@sbernhard sbernhard merged commit d690fa7 into theforeman:develop May 23, 2024
52 of 53 checks passed
@nadjaheitmann nadjaheitmann deleted the 36547 branch May 24, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants