25 lines
		
	
	
		
			453 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			453 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require "commands/image"
 | |
| 
 | |
| module Validators
 | |
|   class DeployEnv::Image < Base
 | |
|     include ::ImageCommands
 | |
| 
 | |
|     def valid?
 | |
|       return true unless @model.image
 | |
|       available_images.detect do |image|
 | |
|         image["id"] == @model.image
 | |
|       end
 | |
|     end
 | |
| 
 | |
|     def message
 | |
|       "Invalid image '#{@model.image}'."
 | |
|     end
 | |
| 
 | |
|     private
 | |
| 
 | |
|     def available_images
 | |
|       get_available_provider_images(::Devops::Db.connector, @model.provider)
 | |
|     end
 | |
|   end
 | |
| end
 | 
