From 532dd70685449a90efb5ebff244aa4c083e1dc09 Mon Sep 17 00:00:00 2001 From: Anton Martynov Date: Tue, 1 Mar 2016 16:04:53 +0300 Subject: [PATCH 1/2] static account --- devops-service/providers/static.rb | 2 +- .../providers/static_accounts_factory.rb | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/devops-service/providers/static.rb b/devops-service/providers/static.rb index e3fcb94..83ea720 100644 --- a/devops-service/providers/static.rb +++ b/devops-service/providers/static.rb @@ -7,7 +7,7 @@ module Provider def initialize config self.certificate_path = config[:static_certificate] - self.ssh_key = "static" + self.ssh_key = config[:static_ssh_key] || "static" @@mongo ||= MongoConnector.new(config[:mongo_db], config[:mongo_host], config[:mongo_port], config[:mongo_user], config[:mongo_password]) end diff --git a/devops-service/providers/static_accounts_factory.rb b/devops-service/providers/static_accounts_factory.rb index 630921b..42b2dd7 100644 --- a/devops-service/providers/static_accounts_factory.rb +++ b/devops-service/providers/static_accounts_factory.rb @@ -2,5 +2,34 @@ require_relative "accounts_factory" module Provider class StaticAccountsFactory < AccountsFactory + def init config + @connections = {} + accounts.each do |account| + create_connection_from_account(config, account) + puts "\tFound static account '#{account.account_name}'" + end + ProviderFactory.add_provider Static::PROVIDER unless @connections.empty? + end + + def provider_name + Static::PROVIDER + end + + def create_connection_from_account config, account + options = { + static_ssh_key: account.ssh_key, + mongo_db: config[:mongo_db], + mongo_host: config[:mongo_host], + mongo_port: config[:mongo_port], + mongo_user: config[:mongo_user], + mongo_password: config[:mongo_password] + } + add_connection(account.account_name, Static.new(options)) + end + + def create_account hash + Devops::Model::StaticProviderAccount.new(hash) + end + end end From cfd25be46a6b017a071674df189b2efb87bf3425 Mon Sep 17 00:00:00 2001 From: Anton Chuchkalov Date: Wed, 16 Mar 2016 21:39:19 +0200 Subject: [PATCH 2/2] CID-471: add docs --- devops-service/providers/ec2.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/devops-service/providers/ec2.rb b/devops-service/providers/ec2.rb index e122c1b..5aeaeb9 100644 --- a/devops-service/providers/ec2.rb +++ b/devops-service/providers/ec2.rb @@ -423,6 +423,7 @@ module Provider # When you create an instance with with ephemeral storages available within AWS console, # they are mapped automatically. But in case of creating within API we should map them manually. + # Result example: [{'VirtualName' => 'ephemeral0', 'DeviceName' => '/dev/xvdb'}] def ephemeral_storages_mappings(flavor) require 'fog/aws/models/compute/flavors' details = Fog::Compute::AWS::FLAVORS.detect {|f| f[:id] == flavor}