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