Skip to content

Commit

Permalink
[COOK-3765] - ssh-keyscan using an alternative port number
Browse files Browse the repository at this point in the history
Signed-off-by: Sean OMeara <someara@opscode.com>
  • Loading branch information
stissot authored and Sean OMeara committed Nov 5, 2013
1 parent c13eed2 commit 6258797
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ end
<td><tt>ssh-rsa ...</tt></td>
<td><tt>ssh-keyscan -H #{host}</tt></td>
</tr>
<tr>
<td>port</td>
<td>(optional) the server port that ssh-keyscan will use to gather the public key</td>
<td><tt>2222</tt></td>
<td><tt>22</tt></td>
</tr>
</tbody>
</table>

Expand Down
2 changes: 1 addition & 1 deletion providers/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

action :create do
key = (new_resource.key || `ssh-keyscan -H #{new_resource.host} 2>&1`)
key = (new_resource.key || `ssh-keyscan -H -p #{new_resource.port} #{new_resource.host} 2>&1`)
comment = key.split("\n").first || ""

Chef::Application.fatal! "Could not resolve #{new_resource.host}" if key =~ /getaddrinfo/
Expand Down
1 change: 1 addition & 0 deletions resources/entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

attribute :host, :kind_of => String, :name_attribute => true
attribute :key, :kind_of => String
attribute :port, :kind_of => Fixnum, :default => 22

def initialize(*args)
super
Expand Down

0 comments on commit 6258797

Please sign in to comment.