Skip to content

Commit

Permalink
Refs #36547 - Fix parsing of Ubuntu version in fact parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
goarsna committed Oct 4, 2023
1 parent cfbab69 commit ce5e657
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions db/migrate/20230719080900_fix_ubuntu_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ def up
# For every Ubuntu operating system with a set minor version we
# * Check if there is already an operating system present with the same major and minor version combined in the major field
# * If not, we update the version
Operatingsystem.where('name ~* :name', name: 'ubuntu')
.merge(Operatingsystem.where.not(minor: [nil, ''])).each do |os|
if !Operatingsystem.where('name ~* :name', name: 'ubuntu').merge(Operatingsystem.where(major: "#{os.major}.#{os.minor}")).merge(Operatingsystem.where(minor: [nil, ''])).first
Operatingsystem.where(name: 'Ubuntu').where.not(minor: [nil, '']).each do |os|
unless Operatingsystem.find_by(name: 'Ubuntu', major: "#{os.major}.#{os.minor}", minor: [nil, ''])
os.update(major: "#{os.major}.#{os.minor}", minor: nil)
end
end
end
end

0 comments on commit ce5e657

Please sign in to comment.