Class: Katello::Validators::RepoDisablementValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/lib/katello/validators/repo_disablement_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



4
5
6
7
8
9
10
# File 'app/lib/katello/validators/repo_disablement_validator.rb', line 4

def validate(record)
  if record.redhat? && record.enabled_changed? && (!record.enabled?) && record.promoted?
    record.errors[:base] << N_("Repository cannot be disabled since it has already been promoted.")
  elsif !record.redhat? && !record.enabled?
    record.errors[:base] << N_("Custom repositories cannot be disabled.")
  end
end