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