knife-joyent 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -47,11 +47,13 @@ Currently available commands:
47
47
  The following command will provision an Ubuntu 12.04 with 1GB of memory and bootstrap it with chef
48
48
 
49
49
  knife joyent server create \
50
- --flavor "Small 1GB"
50
+ --flavor "Small 1GB" \
51
51
  --image d2ba0f30-bbe8-11e2-a9a2-6bc116856d85 \
52
52
  --node-name 'chefbuntu-x' \
53
53
  --server-name 'chefbuntu-x'
54
54
 
55
+ Please see ``knife joyent server create --help`` for more options
56
+
55
57
  ## Configuration
56
58
 
57
59
  The following options can be specified in your knife configuration file
@@ -105,6 +107,10 @@ by/from different sources / users.
105
107
  - [Eric Saxby](https://github.com/sax) - ModCloth
106
108
  - [Stephen Lauck](https://github.com/stephenlauck) - ModCloth
107
109
 
110
+ ## Chef for smartos
111
+
112
+ To bootstrap chef on SmartOS, use this [bootstrap template](https://gist.github.com/stephenlauck/3836791)
113
+
108
114
  ## License
109
115
 
110
116
  Copyright 2012 Joyent, Inc
@@ -121,7 +121,6 @@ class Chef
121
121
  exit 1
122
122
  end
123
123
  end
124
- puts ui.color("SSH Ready.", :cyan)
125
124
  end
126
125
 
127
126
 
@@ -151,6 +150,7 @@ class Chef
151
150
  end
152
151
 
153
152
  Chef::Log.debug("Bootstrap IP Address #{bootstrap_ip}")
153
+ puts "\n"
154
154
  puts ui.color("Bootstrap IP Address #{bootstrap_ip}", :cyan)
155
155
  if Chef::Config[:knife][:provisioner]
156
156
  # tag the provision with 'provisioner'
@@ -182,20 +182,31 @@ class Chef
182
182
  puts ui.color("Waiting for SSH to come up on: #{bootstrap_ip}", :cyan)
183
183
  tcp_test_ssh(bootstrap_ip)
184
184
 
185
- puts ui.color("Bootstrapping: #{bootstrap_ip}", :cyan)
185
+ # smartos zoneinit needs to take it's time
186
+ if server.type == 'smartmachine'
187
+ puts ui.color("Waiting for smartos to fully initialize...", :cyan)
188
+ sleep 25
189
+ end
190
+
186
191
  bootstrap_for_node(server, bootstrap_ip).run
187
192
 
188
193
  rescue Excon::Errors::Conflict => e
189
194
  if e.response && e.response.body.kind_of?(String)
190
195
  error = ::Fog::JSON.decode(e.response.body)
191
- puts ui.error(error['message'])
196
+ print ui.error(error['message'])
197
+ if error.key?('errors') && error['errors'].kind_of?(Array)
198
+ error['errors'].each do |err|
199
+ print ui.error " * [#{err['field']}] #{err['message']}"
200
+ end
201
+ end
192
202
  exit 1
193
203
  else
194
204
  puts ui.error(e.message)
195
205
  exit 1
196
206
  end
207
+
197
208
  rescue => e
198
- puts ui.error('Unexpected Error Occured:' + e.message)
209
+ puts ui.error('Unexpected Error Occured:' + e.inspect)
199
210
  exit 1
200
211
  end
201
212
 
@@ -276,23 +287,22 @@ class Chef
276
287
  tcp_socket = TCPSocket.new(hostname, 22)
277
288
  readable = IO.select([tcp_socket], nil, nil, 5)
278
289
  if readable
279
- puts ui.color("SSHD OK [#{hostname}] #{tcp_socket.gets}", :cyan)
280
- Chef::Log.debug("sshd accepting connections on #{hostname}, banner is #{tcp_socket.gets}")
290
+ banner = tcp_socket.gets
291
+ puts ui.color("SSHD accepting connections on #{hostname}: banner is #{banner}")
292
+ Chef::Log.debug("SSHD accepting connections on #{hostname}: banner is #{banner}")
281
293
  true
282
294
  else
283
295
  false
284
296
  end
285
- rescue Errno::ETIMEDOUT
286
- false
287
- rescue Errno::EPERM
288
- false
289
- rescue Errno::ECONNREFUSED
290
- false
291
- rescue Errno::ECONNRESET
292
- false
293
- rescue Errno::ENETUNREACH
294
- false
295
- rescue Errno::EHOSTUNREACH
297
+ rescue SocketError,
298
+ IOError,
299
+ Errno::ETIMEDOUT,
300
+ Errno::EPERM,
301
+ Errno::ECONNREFUSED,
302
+ Errno::ECONNRESET,
303
+ Errno::ENETUNREACH,
304
+ Errno::EHOSTUNREACH
305
+ sleep 2
296
306
  false
297
307
  ensure
298
308
  tcp_socket && tcp_socket.close
@@ -1,3 +1,3 @@
1
1
  module KnifeJoyent
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-joyent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-15 00:00:00.000000000 Z
12
+ date: 2013-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog