lib/rundock/builder/backend_builder.rb in rundock-0.2.2 vs lib/rundock/builder/backend_builder.rb in rundock-0.2.3

- old
+ new

@@ -39,11 +39,11 @@ # replace default ssh options if exists @options.keys.select { |o| o.to_s =~ /(\w+)_ssh_default$/ }.each do |oo| # no use default ssh options if local # set unless scenario file and cli options specified and not localhost - next if @nodename =~ /localhost|127\.0\.0\.1/ + next if localhost? opt = oo.to_s.gsub(/_ssh_default/, '').to_sym if !@node_info[@nodename.to_sym][:ssh_opts][opt] && !@options[opt] @node_info[@nodename.to_sym][:ssh_opts][opt] = @options[oo] end end @@ -54,19 +54,24 @@ opts[:host] = @nodename opts end def parse_backend_type - if @nodename =~ /localhost|127\.0\.0\.1/ && + if localhost? && !@node_info[@nodename.to_sym][:ssh_opts][:port] && !@node_info[@nodename.to_sym][:ssh_opts][:user] && !@node_info[@nodename.to_sym][:ssh_opts][:ssh_config] backend_type = :local else backend_type = :ssh end backend_type + end + + def localhost? + @nodename =~ /localhost|127\.0\.0\.1/ || + @node_info[@nodename.to_sym][:host] =~ /localhost|127\.0\.0\.1/ end end end end