Skip to content

Commit 53b34dc

Browse files
author
Peter Benjamin
committed
Refactor base_stacker.rb
1 parent 8d00fa6 commit 53b34dc

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

source/lib/base_stacker.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
require 'aws-sdk'
2-
require 'yaml'
32
require 'json'
3+
require 'yaml'
4+
require 'rainbow'
45

5-
VERSION = '0.0.11'
6+
VERSION = '0.1.0'
67
CONFIG_DIR="#{ENV['HOME']}/.restacker"
78
CONFIG_FILE="#{CONFIG_DIR}/restacker.yml"
89
SAMPLE_FILE = "#{__dir__}/../restacker-sample.yml"
910

1011
# needed here (after config_dir and defaults_file)
1112
require_relative 'auth'
1213

13-
DEFAULT_PLANE = :ksp
14-
1514
CREATE_COMPLETE = 'CREATE_COMPLETE'
1615
CREATE_IN_PROGRESS = 'CREATE_IN_PROGRESS'
1716
DELETE_IN_PROGRESS = 'DELETE_IN_PROGRESS'
1817
DELETE_COMPLETE = 'DELETE_COMPLETE'
1918

2019
class BaseStacker
2120
def initialize(options)
22-
@plane = options[:location] ? options[:location].to_sym : DEFAULT_PLANE
23-
config = RestackerConfig.load_config(@plane)
21+
location = RestackerConfig.get_plane(options)
22+
config = RestackerConfig.load_config(location)
23+
2424
# use default region if not passed in from cli
2525
config[:region] = options[:region] if options[:region]
2626
options[:region] = config[:region] unless options[:region]
27-
@cf, @creds = Auth.login(options, config, @plane)
27+
28+
@cf, @creds = Auth.login(options, config, location)
2829
@options = options
2930
end
3031
end

0 commit comments

Comments
 (0)