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

25 lines
453 B
Ruby
Raw Normal View History

2014-11-27 18:45:35 +03:00
require "commands/image"
module Validators
class DeployEnv::Image < Base
include ::ImageCommands
def valid?
2015-11-03 11:46:54 +03:00
return true unless @model.image
available_images.detect do |image|
2014-11-27 18:45:35 +03:00
image["id"] == @model.image
end
end
def message
"Invalid image '#{@model.image}'."
end
2015-11-03 11:46:54 +03:00
private
def available_images
get_available_provider_images(::Devops::Db.connector, @model.provider)
end
2014-11-27 18:45:35 +03:00
end
2015-02-18 11:00:24 +03:00
end