fluke/devops-service/db/validators/field_validators/image.rb

23 lines
423 B
Ruby
Raw Normal View History

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