knife-digital_ocean 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ac6a8d976a9d871f7e2fa1222161c81507fd200
4
- data.tar.gz: 539ce2c8b87cc060ce438ee95ee8531fee0256df
3
+ metadata.gz: 332005be8bd3b557afeaf4951fef63555ae0b425
4
+ data.tar.gz: 627025c5258c0b5536bd624249f7bfd29ac65e4d
5
5
  SHA512:
6
- metadata.gz: a8d42c7cdd0ad77fe3e4fedee79e9677154f45347f917c74bd2bcdfb76cfc66afb7654fbb613b70681c1e70b695b340540f9dc2998a59f501a5e6f2f9a4d7d01
7
- data.tar.gz: 9811fb01af5c753520e8514a6ad3137cf4fe469852427d4eb3b66dbd27b3a88b5704f076b69359da38c3c54fe3b7dfc91215775a64d9c527e96affa0931f72c5
6
+ metadata.gz: 471b6fa0448224595f7f72ca7e957f75fc6411c858c7ac9c429e283d10d449cac7a3ceff8885e0344d00484390508b0502cae468e1437dbba6b814c776095ea0
7
+ data.tar.gz: 979834d8308f3ca504eb7b5cd43bdf8e9bc49a3b353352b791d67801956f0bc87384e510458bd9869101e3a5feb6c463dafaf7366e54a54118e3da5b3631800d
data/.gitignore CHANGED
@@ -5,6 +5,7 @@
5
5
  .yardoc
6
6
  .chef
7
7
  Gemfile.lock
8
+ knife-digital_ocean.gemspec.lock
8
9
  InstalledFiles
9
10
  _yardoc
10
11
  coverage
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ## unreleased
2
2
 
3
- * [Full Changelog](https://github.com/rmoriz/knife-digital_ocean/compare/v0.6.0...master)
3
+ * [Full Changelog](https://github.com/rmoriz/knife-digital_ocean/compare/v0.7.0...master)
4
+
5
+
6
+ ## 0.7.0 / 2014-05-21
7
+
8
+ * [Full Changelog](https://github.com/rmoriz/knife-digital_ocean/compare/v0.6.0...v0.7.0)
9
+ * added --ssh-port option (thanks @popsikle)
4
10
 
5
11
 
6
12
  ## 0.6.0 / 2014-05-02
data/README.md CHANGED
@@ -74,6 +74,7 @@ __Examples__
74
74
  --location 2 \
75
75
  --size 66 \
76
76
  --ssh-keys 1234,1235 \
77
+ --ssh-port 22
77
78
  ```
78
79
 
79
80
  ```shell
@@ -85,6 +86,8 @@ __Examples__
85
86
  --bootstrap \
86
87
  --run-list "role[base],role[webserver]" \
87
88
  --secret-file "~/.ssh/secret_file" \
89
+ --ssh-port 22 \
90
+ --identity-file "~/.ssh/id_rsa" \
88
91
  --private_networking
89
92
  ```
90
93
 
@@ -96,6 +99,7 @@ __Syntax__
96
99
  --location <REGION ID> \
97
100
  --size <SIZE ID> \
98
101
  --ssh-keys <SSH KEY-ID(s), comma-separated> \
102
+ --ssh-port <SSH PORT> \
99
103
  --bootstrap \
100
104
  --run-list "<RUNLIST>" \
101
105
  --secret-file "<FILENAME>" \
@@ -110,6 +114,7 @@ __Short Syntax__
110
114
  -L <REGION ID> \
111
115
  -S <SIZE ID> \
112
116
  -K <SSH KEY-ID(s), comma-separated> \
117
+ -p <SSH PORT> \
113
118
  -B \
114
119
  -r "<RUNLIST>"
115
120
  ```
@@ -138,6 +138,13 @@ class Chef
138
138
  :description => "A file containing the secret key to use to encrypt data bag item values",
139
139
  :proc => Proc.new { |sf| Chef::Config[:knife][:secret_file] = sf }
140
140
 
141
+ option :ssh_port,
142
+ :short => "-p PORT",
143
+ :long => "--ssh-port PORT",
144
+ :description => "The ssh port",
145
+ :default => "22",
146
+ :proc => Proc.new { |port| Chef::Config[:knife][:ssh_port] = port }
147
+
141
148
  def run
142
149
  $stdout.sync = true
143
150
 
@@ -203,7 +210,7 @@ class Chef
203
210
  puts ui.color("IPv4 address is: #{ip_address}", :green)
204
211
 
205
212
  print ui.color('Waiting for sshd:', :magenta)
206
- print('.') until tcp_test_ssh(ip_address, 22) {
213
+ print('.') until tcp_test_ssh(ip_address) {
207
214
  sleep 2
208
215
  puts 'done'
209
216
  }
@@ -228,7 +235,8 @@ class Chef
228
235
  end
229
236
  end
230
237
 
231
- def tcp_test_ssh(hostname, port)
238
+ def tcp_test_ssh(hostname)
239
+ port = Chef::Config[:knife][:ssh_port] || config[:ssh_port]
232
240
  tcp_socket = TCPSocket.new(hostname, port)
233
241
  readable = IO.select([tcp_socket], nil, nil, 5)
234
242
  if readable
@@ -258,6 +266,7 @@ class Chef
258
266
  bootstrap.config.merge! config
259
267
  bootstrap.config[:chef_node_name] = locate_config_value(:server_name)
260
268
  bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version)
269
+ bootstrap.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port]
261
270
  bootstrap.config[:distro] = locate_config_value(:distro)
262
271
  bootstrap.config[:use_sudo] = true unless config[:ssh_user] == 'root'
263
272
  bootstrap.config[:template_file] = locate_config_value(:template_file)
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module DigitalOcean
3
- VERSION = '0.6.0'
3
+ VERSION = '0.7.0'
4
4
  end
5
5
  end
@@ -1,14 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  def mock_api_response(data = {})
4
- Hashie::Rash.new(data)
4
+ Hashie::Mash.new(data)
5
5
  end
6
6
 
7
7
  describe Chef::Knife::DigitalOceanDropletCreate do
8
8
 
9
9
  subject {
10
10
  s = Chef::Knife::DigitalOceanDropletCreate.new
11
- s.stub(:client).and_return mock(DigitalOcean::API)
11
+ s.stub(:client).and_return double(DigitalOcean::API)
12
12
  s
13
13
  }
14
14
 
@@ -64,8 +64,8 @@ describe Chef::Knife::DigitalOceanDropletCreate do
64
64
  let(:subject) {
65
65
  s = super()
66
66
  s.client.stub_chain(:droplets, :create).and_return mock_api_response(api_response)
67
- s.stub!(:ip_address_available).and_return '123.123.123.123'
68
- s.stub!(:tcp_test_ssh).and_return true
67
+ s.stub(:ip_address_available).and_return '123.123.123.123'
68
+ s.stub(:tcp_test_ssh).and_return true
69
69
  s
70
70
  }
71
71
 
@@ -97,8 +97,8 @@ describe Chef::Knife::DigitalOceanDropletCreate do
97
97
  let(:subject) {
98
98
  s = super()
99
99
  s.client.stub_chain(:droplets, :create).and_return mock_api_response(api_response)
100
- s.stub!(:ip_address_available).and_return '123.123.123.123'
101
- s.stub!(:tcp_test_ssh).and_return true
100
+ s.stub(:ip_address_available).and_return '123.123.123.123'
101
+ s.stub(:tcp_test_ssh).and_return true
102
102
  s
103
103
  }
104
104
 
@@ -136,8 +136,8 @@ describe Chef::Knife::DigitalOceanDropletCreate do
136
136
  let(:subject) {
137
137
  s = super()
138
138
  s.client.stub_chain(:droplets, :create).and_return mock_api_response(api_response)
139
- s.stub!(:ip_address_available).and_return '123.123.123.123'
140
- s.stub!(:tcp_test_ssh).and_return true
139
+ s.stub(:ip_address_available).and_return '123.123.123.123'
140
+ s.stub(:tcp_test_ssh).and_return true
141
141
  s
142
142
  }
143
143
 
@@ -183,5 +183,19 @@ describe Chef::Knife::DigitalOceanDropletCreate do
183
183
  end
184
184
  end
185
185
 
186
+ context 'passing ssh_port (--ssh-port)' do
187
+ let(:ssh_port) { 22 }
188
+ let(:custom_config) {
189
+ {
190
+ :ssh_port => ssh_port
191
+ }
192
+ }
193
+
194
+ it 'ssh_port should be available to Bootstrap' do
195
+ bootstrap = subject.bootstrap_for_node('123.123.123.123')
196
+ bootstrap.config[:ssh_port].should eql(ssh_port)
197
+ end
198
+ end
199
+
186
200
  end
187
201
 
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  require 'rspec/autorun'
3
3
 
4
4
  require 'digital_ocean'
5
- require 'rash'
5
+ require 'hashie'
6
6
 
7
7
  require 'chef/knife'
8
8
  require 'chef/knife/digital_ocean_droplet_create'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-digital_ocean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roland Moriz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-02 00:00:00.000000000 Z
11
+ date: 2014-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef