Skip to content

Commit

Permalink
Fixes #38044 - Don't accept negative values for OS major version
Browse files Browse the repository at this point in the history
  • Loading branch information
girijaasoni authored and stejskalleos committed Dec 2, 2024
1 parent 207137e commit c42d7bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/operatingsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Operatingsystem < ApplicationRecord
accepts_nested_attributes_for :os_default_templates, :allow_destroy => true,
:reject_if => :reject_empty_provisioning_template

validates :major, numericality: true, presence: { message: N_("Operating System version is required") }
validates :major, :presence => true, :numericality => {:greater_than_or_equal_to => 0, :message => N_("Major version of the operating system must be greater than or equal to 0") }
validates :minor, format: { with: /\A\d+(\.\d+)*\z/, message: "Operating System minor version must be in N or N.N format" }, allow_blank: true
has_many :os_parameters, :dependent => :destroy, :foreign_key => :reference_id, :inverse_of => :operatingsystem
has_many :parameters, :dependent => :destroy, :foreign_key => :reference_id, :class_name => "OsParameter"
Expand Down

0 comments on commit c42d7bd

Please sign in to comment.