#690: added owner to stack_template

This commit is contained in:
amartynov 2015-09-14 10:22:05 +03:00
parent 27bdf96136
commit c887e41257
2 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,7 @@ module Devops
def create_stack_template provider
body = parser.create
template_model = Model::StackTemplateFactory.create(provider, body)
template_model.owner = parser.current_user
Devops::Db.connector.stack_template_insert(template_model)
template_model
end

View File

@ -9,11 +9,12 @@ module Devops
include ModelWithProvider
attr_accessor :id, :template_body, :provider
attr_accessor :id, :template_body, :provider, :owner
types id: {type: String, empty: false},
provider: {type: String, empty: false},
template_body: {type: String, empty: false}
template_body: {type: String, empty: false},
owner: {type: String, empty: false}
set_validators ::Validators::StackTemplate::TemplateContent
@ -21,13 +22,15 @@ module Devops
self.id = attrs['id']
self.template_body = attrs['template_body']
self.provider = attrs['provider']
self.owner = attrs['owner']
self
end
def to_hash_without_id
{
provider: provider,
template_body: template_body
template_body: template_body,
owner: owner
}
end