Change the way we load secrets so that we do not have to pass them as ENV vars.

they will be pulled from the provider config, similarily to the other providers
This commit is contained in:
Samuel Beaulieu 2022-07-08 08:56:12 -05:00
parent 65c797137e
commit 0bff2df079
No known key found for this signature in database
GPG key ID: 12030F74136D0F34
4 changed files with 42 additions and 14 deletions

View file

@ -11,7 +11,7 @@ module Vmpooler
ROOT_KEYS_SYNC_CMD = "curl -k -o - -L #{ROOT_KEYS_SCRIPT} | %s"
def self.setup_node_by_ssh(host, platform)
@key_file = ENV['KEY_FILE_LOCATION'] || '/app/abs/.ssh/abs-aws-ec2.rsa'
@key_file = ENV['AWS_KEY_FILE_LOCATION']
conn = check_ssh_accepting_connections(host, platform)
configure_host(host, platform, conn)
end

View file

@ -17,8 +17,8 @@ module Vmpooler
def initialize(config, logger, metrics, redis_connection_pool, name, options)
super(config, logger, metrics, redis_connection_pool, name, options)
@aws_access_key = ENV['ABS_AWS_ACCESS_KEY']
@aws_secret_key = ENV['ABS_AWS_SECRET_KEY']
@aws_access_key = ENV['ABS_AWS_ACCESS_KEY'] || provider_config['ABS_AWS_ACCESS_KEY']
@aws_secret_key = ENV['ABS_AWS_SECRET_KEY'] || provider_config['ABS_AWS_SECRET_KEY']
task_limit = global_config[:config].nil? || global_config[:config]['task_limit'].nil? ? 10 : global_config[:config]['task_limit'].to_i
# The default connection pool size is:
@ -123,10 +123,16 @@ module Vmpooler
pool = pool_config(pool_name)
raise("Pool #{pool_name} does not exist for the provider #{name}") if pool.nil?
filters = [{
name: 'tag:pool',
values: [pool_name]
}]
filters = [
{
name: 'tag:pool',
values: [pool_name]
},
{
name: 'instance-state-name',
values: %w[pending running shutting-down stopping stopped]
}
]
instance_list = connection.instances(filters: filters)
return vms if instance_list.first.nil?