23 lines
423 B
Ruby
23 lines
423 B
Ruby
|
|
require "commands/image"
|
||
|
|
require_relative "base"
|
||
|
|
|
||
|
|
module Validators
|
||
|
|
module FieldValidator
|
||
|
|
class Image < Base
|
||
|
|
include ::ImageCommands
|
||
|
|
|
||
|
|
def valid?
|
||
|
|
images = get_available_provider_images(::Devops::Db.connector, @model.provider)
|
||
|
|
images.detect do |image|
|
||
|
|
image["id"] == @value
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
def message
|
||
|
|
"Invalid image '#{@value}'."
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|