lib/boot.rb in forj-1.0.9 vs lib/boot.rb in forj-1.0.10
- old
+ new
@@ -27,11 +27,11 @@
attr_accessor :account
def self.deprecated_name?(blueprint, on_or_name,
old_accountname, as,
old_name
- )
+ )
# depreciated: <BluePrint> on <AccountName> as <InstanceName>
if old_accountname && as && old_name
msg = format(
"The syntax `forj boot '%s' on '%s' as '%s'`" \
" is depreciated. \nUse `forj boot '%s' '%s' ",
@@ -98,10 +98,14 @@
PrcLib.info("Starting boot process of '%s' with blueprint '%s'.",
@account[:instance_name], @account[:blueprint])
end
end
+ # rubocop: disable Metrics/CyclomaticComplexity
+ # rubocop: disable Metrics/MethodLength
+
+ # Boot process
def self.boot(blueprint, on_or_name, deprecated_name, options)
@account = Lorj::Account.new(options[:config])
name = deprecated_name?(blueprint, on_or_name, deprecated_name[0],
deprecated_name[1], deprecated_name[2])
@@ -113,17 +117,25 @@
# Options are added if they are set.
# Otherwise, get will retrieve the default value.
@account[:account_name] = options[:account_name] if options[:account_name]
- @account.ac_load @account[:account_name]
+ unless @account.ac_load @account[:account_name]
+ PrcLib.fatal(1, "Account '%s' not loaded. You need to call "\
+ '`forj setup %s [provider]` to use this account.',
+ @account[:account_name], @account[:account_name])
+ end
- options_map = { :infra => :infra_repo, :key_name => :keypair_name,
- :key_path => :keypair_path,
+ options_map = { :infra => :infra_repo,
+ :key_name => :keypair_name,
+ :key_path => :keypair_path,
:security_group => :security_group,
- :image_name => :image_name, :maestro_flavor => :flavor,
- :bp_flavor => :bp_flavor, :maestro_repo => :maestro_repo,
- :branch => :branch, :test_box => :test_box,
+ :image_name => :image_name,
+ :maestro_flavor => :flavor,
+ :bp_flavor => :bp_flavor,
+ :maestro_repo => :maestro_repo,
+ :branch => :branch,
+ :test_box => :test_box,
:extra_metadata => :extra_metadata }
load_options(options, options_map) do |key, value|
case key
when :test_box