Class: Bosh::Director::DeploymentPlan::DeploymentValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/deployment_plan/deployment_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(deployment) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/bosh/director/deployment_plan/deployment_validator.rb', line 4

def validate(deployment)
  if deployment.vm_types.any? || deployment.stemcells.any?
    if deployment.resource_pools.any?
      raise DeploymentInvalidResourceSpecification, "'resource_pools' cannot be specified along with 'stemcells' and/or 'vm_types'"
    elsif deployment.stemcells.empty?
      raise DeploymentInvalidResourceSpecification, "Both 'stemcells' and 'vm_types' need to be specified: 'stemcells' is missing"
    elsif deployment.vm_types.empty?
      raise DeploymentInvalidResourceSpecification, "Both 'stemcells' and 'vm_types' need to be specified: 'vm_types' is missing"
    end
  end
end