diff --git a/lib/chef/knife/rackspace_server_create.rb b/lib/chef/knife/rackspace_server_create.rb index 8778718..ae5240b 100644 --- a/lib/chef/knife/rackspace_server_create.rb +++ b/lib/chef/knife/rackspace_server_create.rb @@ -68,6 +68,13 @@ class RackspaceServerCreate < Knife :long => "--ssh-password PASSWORD", :description => "The ssh password" + option :ssh_port, + :short => "-p PORT", + :long => "--ssh-port PORT", + :description => "The ssh port", + :default => "22", + :proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key } + option :identity_file, :short => "-i IDENTITY_FILE", :long => "--identity-file IDENTITY_FILE", @@ -110,7 +117,8 @@ class RackspaceServerCreate < Knife :default => "" def tcp_test_ssh(hostname) - tcp_socket = TCPSocket.new(hostname, 22) + ssh_port = Chef::Config[:knife][:ssh_port] || config[:ssh_port] + tcp_socket = TCPSocket.new(hostname, ssh_port) readable = IO.select([tcp_socket], nil, nil, 5) if readable Chef::Log.debug("sshd accepting connections on #{hostname}, banner is #{tcp_socket.gets}") @@ -194,6 +202,7 @@ def bootstrap_for_node(server) bootstrap.config[:run_list] = config[:run_list] bootstrap.config[:ssh_user] = config[:ssh_user] || "root" bootstrap.config[:ssh_password] = server.password + bootstrap.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port] bootstrap.config[:identity_file] = config[:identity_file] bootstrap.config[:chef_node_name] = config[:chef_node_name] || server.id bootstrap.config[:prerelease] = config[:prerelease]