merged with dev
This commit is contained in:
parent
3dee4b4b0b
commit
d1a555d97e
@ -18,7 +18,7 @@ module Connectors
|
||||
private
|
||||
|
||||
def model_from_bson(bson)
|
||||
::Image.create_from_bson(bson)
|
||||
::Image.build_from_bson(bson)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ module Connectors
|
||||
private
|
||||
|
||||
def model_from_bson(bson)
|
||||
::Key.create_from_bson(bson)
|
||||
::Key.build_from_bson(bson)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ module Connectors
|
||||
private
|
||||
|
||||
def model_from_bson(bson)
|
||||
::Project.create_from_bson(bson)
|
||||
::Project.build_from_bson(bson)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ module Connectors
|
||||
private
|
||||
|
||||
def model_from_bson(bson)
|
||||
::Server.create_from_bson(bson)
|
||||
::Server.build_from_bson(bson)
|
||||
end
|
||||
|
||||
# couldn't be replaced with ShowCommand (_id doesn't neccesary appear in params)
|
||||
|
||||
@ -18,7 +18,7 @@ module Connectors
|
||||
|
||||
def model_from_bson(bson)
|
||||
provider = bson['provider']
|
||||
::StackFactory.get_class(provider).create_from_bson(bson)
|
||||
::StackFactory.get_class(provider).build_from_bson(bson)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -18,7 +18,7 @@ module Connectors
|
||||
|
||||
def model_from_bson(bson)
|
||||
provider = bson['provider']
|
||||
::StackTemplateFactory.get_class(provider).create_from_bson(bson)
|
||||
::StackTemplateFactory.get_class(provider).build_from_bson(bson)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ module Connectors
|
||||
private
|
||||
|
||||
def model_from_bson(bson)
|
||||
::User.create_from_bson(bson)
|
||||
::User.build_from_bson(bson)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ class DeployEnvMulti < MongoModel
|
||||
raise InvalidRecord.new("Subproject '#{spi}'. #{e.message}")
|
||||
end
|
||||
end
|
||||
pdb = DevopsService.mongo.project_names_with_envs(server["subprojects"].map{|sp| sp["name"]})
|
||||
pdb = ::Devops::Db.connector.project_names_with_envs(server["subprojects"].map{|sp| sp["name"]})
|
||||
server["subprojects"].each_with_index do |sp, spi|
|
||||
raise InvalidRecord.new("Subproject '#{spi}'. Project '#{sp["name"]}' with env '#{sp["env"]}' does not exist") if pdb[sp["name"]].nil? or !pdb[sp["name"]].include?(sp["env"])
|
||||
end
|
||||
@ -107,7 +107,7 @@ class DeployEnvMulti < MongoModel
|
||||
}
|
||||
end
|
||||
|
||||
def self.create_from_bson d
|
||||
def self.build_from_bson d
|
||||
DeployEnvMulti.new(d)
|
||||
end
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ class Image < MongoModel
|
||||
self.bootstrap_template = p["bootstrap_template"]
|
||||
end
|
||||
|
||||
def self.create_from_bson args
|
||||
def self.build_from_bson args
|
||||
image = Image.new(args)
|
||||
image.id = args["_id"]
|
||||
image
|
||||
|
||||
@ -21,7 +21,7 @@ class Key < MongoModel
|
||||
self.scope = p["scope"] || USER
|
||||
end
|
||||
|
||||
def self.create_from_bson s
|
||||
def self.build_from_bson s
|
||||
key = Key.new s
|
||||
key.id = s["_id"]
|
||||
key
|
||||
|
||||
@ -126,7 +126,7 @@ class Project < MongoModel
|
||||
self.type == MULTI_TYPE
|
||||
end
|
||||
|
||||
def self.create_from_bson p
|
||||
def self.build_from_bson p
|
||||
p["name"] = p["_id"]
|
||||
Project.new p
|
||||
end
|
||||
|
||||
@ -67,7 +67,7 @@ class Server < MongoModel
|
||||
}
|
||||
end
|
||||
|
||||
def self.create_from_bson s
|
||||
def self.build_from_bson s
|
||||
Server.new(s)
|
||||
end
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class StackBase < MongoModel
|
||||
model
|
||||
end
|
||||
|
||||
def self.create_from_bson(attrs)
|
||||
def self.build_from_bson(attrs)
|
||||
attrs['id'] = attrs["_id"]
|
||||
self.new(attrs)
|
||||
end
|
||||
|
||||
@ -8,8 +8,8 @@ class StackFactory
|
||||
get_class(provider).create(attrs)
|
||||
end
|
||||
|
||||
def self.create_from_bson(provider, attrs)
|
||||
get_class(provider).create_from_bson(attrs)
|
||||
def self.build_from_bson(provider, attrs)
|
||||
get_class(provider).build_from_bson(attrs)
|
||||
end
|
||||
|
||||
def self.get_class(provider)
|
||||
|
||||
@ -47,7 +47,7 @@ class StackTemplateBase < MongoModel
|
||||
new(attrs)
|
||||
end
|
||||
|
||||
def self.create_from_bson(attrs)
|
||||
def self.build_from_bson(attrs)
|
||||
attrs['id'] = attrs["_id"]
|
||||
self.new(attrs)
|
||||
end
|
||||
|
||||
@ -8,8 +8,8 @@ class StackTemplateFactory
|
||||
get_class(provider).create(attrs)
|
||||
end
|
||||
|
||||
def self.create_from_bson(provider, attrs)
|
||||
get_class(provider).create_from_bson(attrs)
|
||||
def self.build_from_bson(provider, attrs)
|
||||
get_class(provider).build_from_bson(attrs)
|
||||
end
|
||||
|
||||
def self.get_class(provider)
|
||||
|
||||
@ -49,7 +49,7 @@ class User < MongoModel
|
||||
end
|
||||
end
|
||||
|
||||
def self.create_from_bson s
|
||||
def self.build_from_bson s
|
||||
user = User.new s
|
||||
user.id = s["_id"]
|
||||
user
|
||||
|
||||
@ -5,7 +5,7 @@ module Validators
|
||||
include ::ImageCommands
|
||||
|
||||
def valid?
|
||||
images = get_images(DevopsService.mongo, @model.provider)
|
||||
images = get_images(::Devops::Db.connector, @model.provider)
|
||||
images.detect do |image|
|
||||
image["id"] == @model.image
|
||||
end
|
||||
@ -15,4 +15,4 @@ module Validators
|
||||
"Invalid image '#{@model.image}'."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -2,7 +2,7 @@ module Validators
|
||||
class DeployEnv::Users < Base
|
||||
|
||||
def valid?
|
||||
mongo_users = DevopsService.mongo.users_names(@model.users)
|
||||
mongo_users = ::Devops::Db.connector.users_names(@model.users)
|
||||
@nonexistent_users = @model.users - mongo_users
|
||||
@nonexistent_users.empty?
|
||||
end
|
||||
@ -11,4 +11,4 @@ module Validators
|
||||
"These users are missing in mongo: '#{@nonexistent_users.join("', '")}'."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -5,7 +5,7 @@ module Validators
|
||||
include ImageCommands
|
||||
|
||||
def valid?
|
||||
images = get_images(DevopsService.mongo, @model.provider)
|
||||
images = get_images(::Devops::Db.connector, @model.provider)
|
||||
images.map{|i| i["id"]}.include?(@model.id)
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user