bosh-director/lib/bosh/director/deployment_plan/planner.rb
# Looks up deployment model in DB or creates one if needed
# @return [void]
Looks up deployment model in DB or creates one if needed
Looks up deployment model in DB or creates one if needed
def bind_model
        if @name.nil? || @canonical_name.nil?
          raise DirectorError,
                'Unable to bind model, name and/or canonical name unknown'
        end
        attrs = {:name => @name}
        Models::Deployment.db.transaction do
          deployment = Models::Deployment.find(attrs)
          if deployment.nil?
            Models::Deployment.each do |other|
              if canonical(other.name) == @canonical_name
                raise DeploymentCanonicalNameTaken,
                      "Invalid deployment name `#{@name}', " +
                        'canonical name already taken'
              end
            end
            deployment = Models::Deployment.create(attrs)
          end
          @model = deployment
        end
      end
def bind_model if @name . nil? || @canonical_name . nil? raise DirectorError , 'Unable to bind model, name and/or canonical name unknown' end attrs = { :name => @name } Models :: Deployment . db . transaction do deployment = Models :: Deployment . find ( attrs ) if deployment . nil? Models :: Deployment . each do | other | if canonical ( other . name ) == @canonical_name raise DeploymentCanonicalNameTaken , "Invalid deployment name `#{@name}', " + 'canonical name already taken' end end deployment = Models :: Deployment . create ( attrs ) end @model = deployment end end
Looks up deployment model in DB or creates one if needed
Looks up deployment model in DB or creates one if needed
# Canonical uniqueness is not enforced in the DB
None
void