knife-digital_ocean 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d6837eb0ed9318f5dc3d7df661b9d7fa74bdb86
4
- data.tar.gz: 6c959c38bbcb222e5792ac208d8fa034e10c0cbb
3
+ metadata.gz: bcaa540a4c2588d80c68a17e3b6452bbcdd27040
4
+ data.tar.gz: 052741d324574109a77856ee2e6b1af7dc14b49f
5
5
  SHA512:
6
- metadata.gz: b43a58d4b73a34bd132db0f7167b7fe68bad93f38e1b63d4c8d04f18778a307056ca75e7ba6b1da8b3555e90358aeb1f26a49f99438e5d44ff20391e15524a58
7
- data.tar.gz: e4bfe933f58ca1670c91f835d1f3e18f3ea1126c307f73168f7b5e92397d8ca7c0bc99eb3d76559d228121ccc61e3a9521547e2c346c740984d81b46cdcf901d
6
+ metadata.gz: af0644ed882e619d058872977e990552d84620dd2e1389cc2d4fcaa069ededfaed41d1890308cb79f83d1963b436f03e25ef6017c2506fd531a5ee7165efbe48
7
+ data.tar.gz: 82c65b7d2ef506181d0f7ac5076aeabbd88ca66901857cf74c89dcd5db67ff2207b0dfac160345c890266a2f29f3ddde2c05e89fdc7505cfd1a5e23da070b7c6
data/CHANGELOG.md CHANGED
@@ -1,7 +1,12 @@
1
1
  ## unreleased
2
2
 
3
- * [Full Changelog](https://github.com/rmoriz/knife-digital_ocean/compare/v0.2.0...master)
3
+ * [Full Changelog](https://github.com/rmoriz/knife-digital_ocean/compare/v0.3.0...master)
4
4
 
5
+ ## 0.3.0 / 2013-11-25
6
+
7
+ * [Full Changelog](https://github.com/rmoriz/knife-digital_ocean/compare/v0.2.0...v0.3.0)
8
+ * support for first_boot_attributes/json-attributes (thanks @zuazo)
9
+ * updated doc examples
5
10
 
6
11
  ## 0.2.0 / 2013-09-07
7
12
 
data/README.md CHANGED
@@ -23,25 +23,25 @@ This knife plugin uses the [digital_ocean](https://github.com/rmoriz/digital_oce
23
23
 
24
24
  This plugin provides the following sub-commands:
25
25
 
26
- * knife digital_ocean droplet create (options)
26
+ * knife digital_ocean droplet create (options)
27
27
  **Creates a virtual machine with or without bootstrapping chef**
28
28
 
29
- * knife digital_ocean droplet destroy (options)
29
+ * knife digital_ocean droplet destroy (options)
30
30
  **Destroys the virtual machine and its data**
31
31
 
32
- * knife digital_ocean droplet list (options)
32
+ * knife digital_ocean droplet list (options)
33
33
  **Lists currently running virtual machines**
34
34
 
35
- * knife digital_ocean image list (options)
35
+ * knife digital_ocean image list (options)
36
36
  **Lists available images (snapshots, backups, OS-images)**
37
37
 
38
- * knife digital_ocean region list (options)
38
+ * knife digital_ocean region list (options)
39
39
  **Lists the server regions/locations/data-center**
40
40
 
41
- * knife digital_ocean size list (options)
41
+ * knife digital_ocean size list (options)
42
42
  **Lists the available server sizes**
43
43
 
44
- * knife digital_ocean sshkey list
44
+ * knife digital_ocean sshkey list
45
45
  **Lists name + id of the uploaded known ssh keys**
46
46
 
47
47
 
@@ -60,8 +60,8 @@ knife[:digital_ocean_api_key] = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
60
60
 
61
61
  There are three different ways of creating a server/droplet instance:
62
62
 
63
- If you just want to launch an instance
64
- form the command line without any bootstrapping, go for option **C**.
63
+ If you just want to launch an instance
64
+ form the command line without any bootstrapping, go for option **C**.
65
65
  If you use ```knife-solo``` try **B** and if you are a ```chef-server```-fan
66
66
  use method **A**:
67
67
  #### A. With bootstrapping in an chef-server environment:
@@ -107,6 +107,7 @@ __Short Syntax__
107
107
  You need to have [knife-solo](http://matschaffer.github.com/knife-solo/) gem installed.
108
108
 
109
109
  This will create a droplet and run `knife solo bootstrap <IP>` equivalent for it.
110
+ Please consult the [knife-solo documentation](http://matschaffer.github.io/knife-solo/#label-Bootstrap+command) for further details.
110
111
 
111
112
  __Example__
112
113
 
@@ -116,6 +117,7 @@ __Example__
116
117
  --location 2 \
117
118
  --size 66 \
118
119
  --ssh-keys 1234,4567 \
120
+ --run-list "<RUNLIST>" \
119
121
  --solo
120
122
  ```
121
123
 
@@ -153,25 +155,27 @@ OK
153
155
 
154
156
  ```shell
155
157
  ➜ knife digital_ocean region list
156
- ID Name
157
- 1 New York 1
158
+ ID Name
159
+ 1 New York 1
158
160
  2 Amsterdam 1
161
+ 3 San Francisco 1
162
+ 4 New York 2
159
163
  ```
160
164
 
161
165
  ### List sizes (instance types)
162
166
 
163
167
  ```shell
164
- ➜ knife digital_ocean size list
165
- ID Name
166
- 63 1GB
167
- 62 2GB
168
- 64 4GB
169
- 65 8GB
170
- 61 16GB
171
- 60 32GB
172
- 70 48GB
173
- 69 64GB
174
- 68 96GB
168
+ ➜ knife digital_ocean size list
169
+ ID Name
170
+ 63 1GB
171
+ 62 2GB
172
+ 64 4GB
173
+ 65 8GB
174
+ 61 16GB
175
+ 60 32GB
176
+ 70 48GB
177
+ 69 64GB
178
+ 68 96GB
175
179
  66 512MB
176
180
  ```
177
181
 
@@ -182,9 +186,9 @@ ID Name
182
186
  ```shell
183
187
  ➜ knife digital_ocean image list
184
188
  ID Distribution Name Global
185
- 11111 Ubuntu app100.ams.nlxxxxx.net 2013-02-01 -
186
- 11112 Ubuntu app100.ams.nlxxxxx.net 2013-02-03 -
187
- 11113 Ubuntu init -
189
+ 11111 Ubuntu app100.ams.nlxxxxx.net 2013-02-01 -
190
+ 11112 Ubuntu app100.ams.nlxxxxx.net 2013-02-03 -
191
+ 11113 Ubuntu init -
188
192
  ```
189
193
 
190
194
 
@@ -192,49 +196,51 @@ ID Distribution Name Global
192
196
 
193
197
  ```shell
194
198
  ➜ knife digital_ocean image list --global
195
- ID Distribution Name Global
196
- 23593 Arch Linux Arch Linux 2012-09 x64 +
197
- 1602 CentOS CentOS 5.8 x32 +
198
- 1601 CentOS CentOS 5.8 x64 +
199
- 1605 CentOS CentOS 6.0 x32 +
200
- 1611 CentOS CentOS 6.2 x64 +
201
- 12578 CentOS CentOS 6.3 x32 +
202
- 12574 CentOS CentOS 6.3 x64 +
203
- 12575 Debian Debian 6.0 x32 +
204
- 12573 Debian Debian 6.0 x64 +
205
- 1606 Fedora Fedora 15 x64 +
206
- 1618 Fedora Fedora 16 x64 Desktop +
207
- 1615 Fedora Fedora 16 x64 Server +
208
- 32399 Fedora Fedora 17 x32 Desktop +
209
- 32387 Fedora Fedora 17 x32 Server +
210
- 32419 Fedora Fedora 17 x64 Desktop +
211
- 32428 Fedora Fedora 17 x64 Server +
212
- 63749 Gentoo Gentoo 2013-1 x64 +
213
- 1607 Gentoo Gentoo x64 +
214
- 46964 Ubuntu LAMP on Ubuntu 12.04 +
215
- 4870 Ubuntu Rails 3.2.2 - Nginx MySQL Passenger +
216
- 14098 Ubuntu Ubuntu 10.04 x32 Server +
217
- 14097 Ubuntu Ubuntu 10.04 x64 Server +
218
- 43462 Ubuntu Ubuntu 11.04x32 Desktop +
219
- 43458 Ubuntu Ubuntu 11.04x64 Server +
220
- 1609 Ubuntu Ubuntu 11.10 x32 Server +
221
- 42735 Ubuntu Ubuntu 12.04 x32 Server +
222
- 14218 Ubuntu Ubuntu 12.04 x64 Desktop +
223
- 2676 Ubuntu Ubuntu 12.04 x64 Server +
224
- 25485 Ubuntu Ubuntu 12.10 x32 Desktop +
225
- 25306 Ubuntu Ubuntu 12.10 x32 Server +
226
- 25493 Ubuntu Ubuntu 12.10 x64 Desktop +
227
- 25489 Ubuntu Ubuntu 12.10 x64 Server +
228
- 13632 openSUSE Open Suse 12.1 x32 +
229
- 13863 openSUSE Open Suse 12.2 X64 +
199
+ ID Distribution Name Global
200
+ 361740 Arch Linux Arch Linux 2013.05 x32 +
201
+ 350424 Arch Linux Arch Linux 2013.05 x64 +
202
+ 1602 CentOS CentOS 5.8 x32 +
203
+ 1601 CentOS CentOS 5.8 x64 +
204
+ 376568 CentOS CentOS 6.4 x32 +
205
+ 562354 CentOS CentOS 6.4 x64 +
206
+ 12575 Debian Debian 6.0 x32 +
207
+ 12573 Debian Debian 6.0 x64 +
208
+ 303619 Debian Debian 7.0 x32 +
209
+ 308287 Debian Debian 7.0 x64 +
210
+ 32387 Fedora Fedora 17 x32 +
211
+ 32399 Fedora Fedora 17 x32 Desktop +
212
+ 32428 Fedora Fedora 17 x64 +
213
+ 32419 Fedora Fedora 17 x64 Desktop +
214
+ 697056 Fedora Fedora 19 x32 +
215
+ 696598 Fedora Fedora 19 x64 +
216
+ 1004145 Ubuntu Docker on Ubuntu 13.04 x64 +
217
+ 959207 Ubuntu Ghost 0.3.3 on Ubuntu 12.04 +
218
+ 1215015 Ubuntu GitLab 6.2.4 CE +
219
+ 459444 Ubuntu LAMP on Ubuntu 12.04 +
220
+ 483575 Ubuntu Redmine on Ubuntu 12.04 +
221
+ 464235 Ubuntu Ruby on Rails on Ubuntu 12.10 (Nginx + Unicorn) +
222
+ 14098 Ubuntu Ubuntu 10.04 x32 +
223
+ 14097 Ubuntu Ubuntu 10.04 x64 +
224
+ 284211 Ubuntu Ubuntu 12.04 x32 +
225
+ 284203 Ubuntu Ubuntu 12.04 x64 +
226
+ 1015250 Ubuntu Ubuntu 12.04.3 x32 +
227
+ 1015253 Ubuntu Ubuntu 12.04.3 x64 +
228
+ 433240 Ubuntu Ubuntu 12.10 x32 +
229
+ 473123 Ubuntu Ubuntu 12.10 x64 +
230
+ 473136 Ubuntu Ubuntu 12.10 x64 Desktop +
231
+ 345791 Ubuntu Ubuntu 13.04 x32 +
232
+ 350076 Ubuntu Ubuntu 13.04 x64 +
233
+ 962304 Ubuntu Ubuntu 13.10 x32 +
234
+ 961965 Ubuntu Ubuntu 13.10 x64 +
235
+ 1061995 Ubuntu Wordpress on Ubuntu 12.10 +
230
236
  ```
231
237
 
232
238
 
233
239
  ### SSH keys (previously uploaded via DigitalOcean's webfrontend)
234
240
 
235
241
  ```shell
236
- ➜ knife digital_ocean sshkey list
237
- ID Name
242
+ ➜ knife digital_ocean sshkey list
243
+ ID Name
238
244
  1234 Alice
239
245
  1235 Bob
240
246
  1236 Chuck
@@ -18,9 +18,6 @@ Gem::Specification.new do |gem|
18
18
  gem.add_dependency 'highline'
19
19
 
20
20
  gem.add_development_dependency 'rspec', '~> 2.13'
21
- gem.add_development_dependency 'guard'
22
- gem.add_development_dependency 'guard-rspec'
23
- gem.add_development_dependency 'rb-fsevent'
24
21
  gem.add_development_dependency 'rake'
25
22
  gem.add_development_dependency 'knife-solo'
26
23
 
@@ -122,6 +122,12 @@ class Chef
122
122
  :proc => Proc.new { |e| Chef::Config[:knife][:environment] = e },
123
123
  :default => '_default'
124
124
 
125
+ option :json_attributes,
126
+ :short => '-j JSON',
127
+ :long => '--json-attributes JSON',
128
+ :description => 'A JSON string to be added to the first run of chef-client',
129
+ :proc => lambda { |o| JSON.parse(o) }
130
+
125
131
  def run
126
132
  $stdout.sync = true
127
133
 
@@ -174,6 +180,10 @@ class Chef
174
180
 
175
181
  puts "Droplet creation for #{locate_config_value(:server_name)} started. Droplet-ID is #{response.droplet.id}"
176
182
 
183
+ unless !config.has_key?(:json_attributes) || config[:json_attributes].empty?
184
+ puts ui.color("JSON Attributes: #{config[:json_attributes]}", :magenta)
185
+ end
186
+
177
187
  print ui.color("Waiting for IPv4-Address", :magenta)
178
188
  print(".") until ip_address = ip_address_available(response.droplet.id) {
179
189
  puts 'done'
@@ -241,6 +251,7 @@ class Chef
241
251
  bootstrap.config[:use_sudo] = true unless config[:ssh_user] == 'root'
242
252
  bootstrap.config[:template_file] = locate_config_value(:template_file)
243
253
  bootstrap.config[:environment] = locate_config_value(:environment)
254
+ bootstrap.config[:first_boot_attributes] = locate_config_value(:json_attributes) || {}
244
255
  bootstrap
245
256
  end
246
257
 
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module DigitalOcean
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -39,7 +39,13 @@ describe Chef::Knife::DigitalOceanDropletCreate do
39
39
  Chef::Knife::DigitalOceanDropletCreate.load_deps
40
40
 
41
41
  # reset
42
- Chef::Config[:knife] = {}
42
+ if Chef::Config[:knife].respond_to?(:reset)
43
+ # mixlib-config >= 2
44
+ Chef::Config[:knife].reset
45
+ else
46
+ # mixlib-config < 2
47
+ Chef::Config[:knife] = {}
48
+ end
43
49
 
44
50
  # config
45
51
  config.merge(custom_config).each do |k, v|
@@ -148,5 +154,20 @@ describe Chef::Knife::DigitalOceanDropletCreate do
148
154
  end
149
155
  end
150
156
  end
157
+
158
+ context 'passing json attributes (-j)' do
159
+ let(:json_attributes) { '{ "apache": { "listen_ports": 80 } }' }
160
+ let(:custom_config) {
161
+ {
162
+ :json_attributes => json_attributes
163
+ }
164
+ }
165
+
166
+ it 'should configure the first boot attributes on Bootstrap' do
167
+ bootstrap = subject.bootstrap_for_node('123.123.123.123')
168
+ bootstrap.config[:first_boot_attributes].should eql(json_attributes)
169
+ end
170
+ end
171
+
151
172
  end
152
173
 
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.2.0
4
+ version: 0.3.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: 2013-09-07 00:00:00.000000000 Z
11
+ date: 2013-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -66,48 +66,6 @@ dependencies:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.13'
69
- - !ruby/object:Gem::Dependency
70
- name: guard
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: guard-rspec
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '>='
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '>='
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rb-fsevent
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
69
  - !ruby/object:Gem::Dependency
112
70
  name: rake
113
71
  requirement: !ruby/object:Gem::Requirement
@@ -191,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
149
  version: '0'
192
150
  requirements: []
193
151
  rubyforge_project:
194
- rubygems_version: 2.0.2
152
+ rubygems_version: 2.0.14
195
153
  signing_key:
196
154
  specification_version: 4
197
155
  summary: A plugin for chef's knife to manage instances of DigitalOcean servers