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