lib/boot.rb in forj-1.0.14 vs lib/boot.rb in forj-1.0.15

- old
+ new

@@ -51,12 +51,12 @@ name end def self.load_options(options, options_map) options_map.each do |opt_key, ac_key| - if options.key?(opt_key.to_s) - value = yield(opt_key, options[opt_key.to_s]) + if options.key?(opt_key) + value = yield(opt_key, options[opt_key]) @account.set(ac_key, value) unless value.nil? end end end @@ -98,12 +98,10 @@ PrcLib.info("Starting boot process of '%s' with blueprint '%s'.", @account[:instance_name], @account[:blueprint]) end end end - # rubocop: disable Metrics/CyclomaticComplexity - # rubocop: disable Metrics/MethodLength # module Boot # Boot process def self.boot(blueprint, on_or_name, deprecated_name, options) @@ -125,12 +123,12 @@ 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['tb_path'] = nil if options.key?('test_box') && - !options.key?('tb_path') + options[:tb_path] = nil if options.key?(:test_box) && + !options.key?(:tb_path) options_map = { :infra => :infra_repo, :key_name => :keypair_name, :key_path => :keypair_path, :security_group => :security_group, :image_name => :image_name, @@ -140,11 +138,13 @@ :branch => :branch, :test_box => :test_box, :tb_path => :test_box_path, :ca_root_cert => :ca_root_cert, :extra_metadata => :extra_metadata, - :webproxy => :webproxy } + :webproxy => :webproxy, + :disable_lorj => :lorj_disabled + } load_options(options, options_map) { |k, v| complete_boot_options(k, v) } validate_keypath(options) @@ -155,11 +155,17 @@ PrcLib.high_level_msg("Preparing your forge '%s'.Please be patient. "\ "more output in '%s'\n", @account[:instance_name], PrcLib.log_file) - o_cloud.create(:forge) + o_cloud.create(:forge, + :server_name => "maestro.#{@account[:instance_name]}", + :image_name => @account['maestro#image_name'], + :flavor_name => @account['maestro#flavor_name'], + :network_name => @account['maestro#network_name'], + :security_group => @account['maestro#security_group'], + :ports => @account[:ports]) end end # rubocop: enable Metrics/CyclomaticComplexity # rubocop: enable Metrics/MethodLength @@ -180,12 +186,17 @@ # Function to check the repository path passed. def self.tb_repo_detect(paths) res = {} paths.each do |path| + PrcLib.debug("tb_repo_detect: checking #{path}") cmd = <<-CMD cd "#{path}" +if [ $? -ne 0 ] +then + exit 1 +fi git rev-parse --show-toplevel 2>/dev/null 1>&2 if [ $? -ne 0 ] then exit 1 fi @@ -201,15 +212,26 @@ cmd_res = `#{cmd}`.split # For any reason, $CHILD_STATUS is empty, while $? is not. # Ruby bug. tested with: # ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux] # rubocop: disable Style/SpecialGlobalVars - next unless $?.exitstatus == 0 + unless $?.exitstatus == 0 + PrcLib.warning("tb_repo_detect: #{path} seems not to be a GIT "\ + "repo.\n"\ + "#{cmd_res.join("\n")}") + next + end # rubocop: enable Style/SpecialGlobalVars repo_found = cmd_res[0].match(%r{.*/(.*)(.git)?}) - next unless repo_found + unless repo_found + PrcLib.warning("tb_repo_detect: Unable to find the repo path.\n"\ + "#{cmd_res.join("\n")}") + + next + end res[repo_found[1]] = cmd_res[1] + PrcLib.debug("tb_repo_detect: FOUND #{cmd_res[1]}") end res end # function to detect if test-box.sh is runnable @@ -226,18 +248,20 @@ if script_found.nil? PrcLib.error("Test-box: '%s' is not a valid runnable script. "\ 'test-box is disabled.', script) return nil end + PrcLib.debug("tb_repo_detect: FOUND #{script_found}") return script_found end script_found = nil ENV['PATH'].split(':').each do |path| script_found = tb_check_bin(path) break unless script_found.nil? end + PrcLib.debug("tb_repo_detect: FOUND #{script_found}") script_found end # Script to check the bin and path