4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'app/lib/katello/validators/content_view_puppet_module_validator.rb', line 4
def validate(record)
if record.uuid.blank? && (record.name.blank? || record.author.blank?)
invalid_parameters = _("Invalid puppet module parameters specified. Either 'uuid' or 'name' and 'author' must be specified.")
record.errors[:base] << invalid_parameters
return
end
if record.name && record.author
unless PuppetModule
.in_repositories(record.content_view.puppet_repos)
.where(:name => record.name, :author => record.author).present?
invalid_parameters = _("Puppet Module with name='%{name}' and author='%{author}' does not exist") %
{ :name => record.name, :author => record.author }
record.errors[:base] << invalid_parameters
end
end
end
|