lib/chef/knife/cluster_proxy.rb in ironfan-3.1.5 vs lib/chef/knife/cluster_proxy.rb in ironfan-3.1.6

- old
+ new

@@ -31,11 +31,11 @@ # bad. Though ugly, exec'ing the command works. # class ClusterProxy < Ironfan::Script import_banner_and_options(Chef::Knife::ClusterSsh, :except => [:concurrency, ]) - banner 'knife cluster proxy CLUSTER-[FACET-[INDEXES]] (options) - Runs the ssh command to open a SOCKS proxy to the given host, and writes a PAC (automatic proxy config) file to /tmp/ironfan_proxy-YOURNAME.pac. Only the first host is used, even if multiple match.' + banner 'knife cluster proxy CLUSTER[-FACET[-INDEXES]] (options) - Runs the ssh command to open a SOCKS proxy to the given host, and writes a PAC (automatic proxy config) file to /tmp/ironfan_proxy-YOURNAME.pac. Only the first host is used, even if multiple match.' option :background, :long => "--[no-]background", :description => "Requests ssh to go to background after setting up the proxy", :boolean => true, @@ -63,12 +63,13 @@ config[:attribute] ||= Chef::Config[:knife][:ssh_address_attribute] || "fqdn" config[:ssh_user] ||= Chef::Config[:knife][:ssh_user] config[:identity_file] ||= svr.cloud.ssh_identity_file config[:host_key_verify] ||= Chef::Config[:knife][:host_key_verify] || (not config[:no_host_key_verify]) # pre-vs-post 0.10.4 - if (svr.cloud.public_ip) then address = svr.cloud.public_ip ; end - if (not address) && (svr.chef_node) then address = format_for_display( svr.chef_node )[config[:attribute]] ; end - if (not address) && (svr.fog_server) then address = svr.fog_server.public_ip_address ; end + address = svr.public_hostname + if address.blank? && (svr.chef_node) + address = format_for_display( svr.chef_node )[config[:attribute]] + end cmd = [ 'ssh', '-N' ] cmd += [ '-D', config[:socks_port].to_s ] cmd += [ '-p', config[:port].to_s ] if config[:port].present? cmd << '-f' if config[:background]