25 lines
		
	
	
		
			516 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			516 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require "commands/bootstrap_templates"
 | |
| require "db/validators/base"
 | |
| 
 | |
| module Validators
 | |
|   module Image
 | |
|     class BootstrapTemplate < Base
 | |
| 
 | |
|       include BootstrapTemplatesCommands
 | |
| 
 | |
|       def valid?
 | |
|         if @model.bootstrap_template
 | |
|           templates = get_templates
 | |
|           templates.include?(@model.bootstrap_template)
 | |
|         else
 | |
|           true
 | |
|         end
 | |
|       end
 | |
| 
 | |
|       def message
 | |
|         "Invalid bootstrap template '#{@model.bootstrap_template}' for image '#{@model.id}'"
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 | 
