Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/models/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def self.new(*args, &block)
include OwnershipMixin
include TenancyMixin

validates :name, :length => {:maximum => 128}

belongs_to :tenant

# TODO: DELETE ME!!!!
Expand Down
2 changes: 2 additions & 0 deletions app/models/cloud_tenant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class CloudTenant < ApplicationRecord
has_many :flavors, :through => :cloud_tenant_flavors
has_many :cloud_volume_types, :through => :ext_management_system

validates :name, :length => {:maximum => 128}
Copy link
Member

@Fryguy Fryguy Mar 10, 2025

Choose a reason for hiding this comment

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

I think I mentioned this elsewhere, but any data that can come from providers I don't think we should be as conservative with, otherwise we run the risk of failing during provider collection. On the backend, I think we can be much looser with these values. For example, here I'd be ok with 1k or even higher. The frontend is only for new objects, and those forms (I think) are provider specific, so the value could be different on different forms depending on the provider. I understand the need to limit it to some value, but I'd prefer if it were a really large, but reasonable value.

@agrare Thoughts?


alias_method :direct_cloud_networks, :cloud_networks

acts_as_miq_taggable
Expand Down
2 changes: 2 additions & 0 deletions app/models/cloud_volume_snapshot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class CloudVolumeSnapshot < ApplicationRecord

virtual_total :total_based_volumes, :based_volumes

validates :description, :length => {:maximum => 50}
Copy link
Member

Choose a reason for hiding this comment

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

This is a great example, where the description (if it's not a name or identifier), could actually be really large coming from a provider.


def self.class_by_ems(ext_management_system)
ext_management_system&.class_by_ems(:CloudVolumeSnapshot)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/generic_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class GenericObject < ApplicationRecord
has_one :picture, :through => :generic_object_definition
has_many :custom_button_events, :foreign_key => :target_id, :dependent => :destroy

validates :name, :presence => true
validates :name, :presence => true, :length => {:maximum => 255}

delegate :property_attribute_defined?,
:property_defined?,
Expand Down
1 change: 1 addition & 0 deletions app/models/miq_alert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class MiqAlert < ApplicationRecord
serialize :options

validates :description, :presence => true, :uniqueness_when_changed => true, :length => {:maximum => 255}
validates :name, :length => {:maximum => 512}
validate :validate_automate_expressions
validate :validate_single_expression
validates :severity, :inclusion => {:in => SEVERITIES}
Expand Down
2 changes: 2 additions & 0 deletions app/models/pxe_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class PxeImage < ApplicationRecord

has_many :customization_templates, :through => :pxe_image_type

validates :name, :length => {:maximum => 255}

acts_as_miq_taggable

before_validation do
Expand Down
3 changes: 2 additions & 1 deletion app/models/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ class Service < ApplicationRecord
virtual_column :power_state, :type => :string
virtual_column :power_status, :type => :string

validates :name, :presence => true
validates :name, :presence => true, :length => {:maximum => 256}
validates :description, :length => {:maximum => 1024}
Copy link
Member

Choose a reason for hiding this comment

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

1kb for a service description feels really small. I'm surprised the UI only allows that much.


default_value_for :visible, false
default_value_for :initiator, 'user'
Expand Down
2 changes: 2 additions & 0 deletions app/models/time_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ class TimeProfile < ApplicationRecord
default_value_for :days, ALL_DAYS
default_value_for :hours, ALL_HOURS

validates :description, :length => {:maximum => 128}

has_many :miq_reports
has_many :metric_rollups

Expand Down
4 changes: 2 additions & 2 deletions app/models/zone.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Zone < ApplicationRecord
validates_presence_of :name, :description
validates :name, :unique_within_region => true
validates :name, :unique_within_region => true, :presence => true, :length => {:maximum => 128}
validates :description, :presence => true, :length => {:maximum => 128}

serialize :settings, :type => Hash

Expand Down