vagrant-linode 0.2.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -3
- data/Gemfile +2 -3
- data/README.md +21 -15
- data/lib/vagrant-linode/actions.rb +3 -1
- data/lib/vagrant-linode/actions/connect_linode.rb +1 -1
- data/lib/vagrant-linode/actions/create.rb +1 -1
- data/lib/vagrant-linode/actions/list_kernels.rb +1 -1
- data/lib/vagrant-linode/actions/message_not_off.rb +16 -0
- data/lib/vagrant-linode/actions/rebuild.rb +17 -10
- data/lib/vagrant-linode/config.rb +0 -6
- data/lib/vagrant-linode/helpers/client.rb +1 -1
- data/lib/vagrant-linode/version.rb +1 -1
- data/locales/en.yml +1 -0
- data/test/Vagrantfile +12 -10
- data/vagrant-linode.gemspec +1 -2
- metadata +6 -31
- data/features/provision.feature +0 -34
- data/features/steps/sdk_steps.rb +0 -13
- data/features/steps/server_steps.rb +0 -25
- data/features/support/env.rb +0 -34
- data/features/support/fog_mock.rb +0 -16
- data/features/vagrant-linode.feature +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 512f23fdd3c5ee70ed9a4e3c49bb03225d751c62
|
4
|
+
data.tar.gz: 6bf4e88684a6bcfb94f182dfdef854096eefc586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ee6d317e49fc873b7f23c5cf47dfcc2b4a80c87556aeebfc307142bb94da6b4af86329ee116b90a08c38cbe844aee637cd8a9e90c8a7f9b360b576a1ff84788
|
7
|
+
data.tar.gz: 29c025f0a4dbcf30be82293d2dacae042ad53e33b015864278cc5710179add7599be813a55bee2e69bbc371bb0578039480a818ed40a86ca7794c4aae9fb9d63
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
|
-
v0.
|
4
|
-
|
5
|
-
|
3
|
+
v0.3.0 fixes for Vagrant 2.0.1 (now requires Ruby 2.2.0+)
|
4
|
+
xen-only kernels are no longer available (Fixes KVM Grub options)
|
5
|
+
rebuild command warns / quits if Linode is not powered down
|
6
|
+
v0.2.8 fixes for Vagrant 1.9
|
7
|
+
v0.2.7 Update default plan (and ways to set it) and default distro
|
8
|
+
v0.2.6 added StackScript support
|
6
9
|
v0.2.5 destroy works when linode is already deleted
|
7
10
|
v0.2.4 fixed the box image
|
8
11
|
v0.2.3 fixed rsync before provision on startup
|
data/Gemfile
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gemspec
|
2
|
+
ruby '~> 2.2.0'
|
4
3
|
|
5
4
|
group :development do
|
6
5
|
# We depend on Vagrant for development, but we don't add it as a
|
@@ -12,5 +11,5 @@ group :development do
|
|
12
11
|
end
|
13
12
|
|
14
13
|
group :plugins do
|
15
|
-
|
14
|
+
gemspec
|
16
15
|
end
|
data/README.md
CHANGED
@@ -96,19 +96,24 @@ attribute is `true`.
|
|
96
96
|
### provider.plan
|
97
97
|
|
98
98
|
Each Linode Tier has been assigned a Plan Identifcation Number.
|
99
|
-
Current Plan-ID table follows:
|
100
|
-
|
101
|
-
| PlanID | Plan
|
102
|
-
|:-------
|
103
|
-
| 1 |
|
104
|
-
| 2 |
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
99
|
+
Current (Feb 2017) Plan-ID table follows:
|
100
|
+
|
101
|
+
| PlanID | Plan |
|
102
|
+
|:------- |:----------------------------- |
|
103
|
+
| 1 | 1GB Standard (Linode 1024) |
|
104
|
+
| 2 | 2GB Standard (Linode 2048) |
|
105
|
+
| 3 | 4GB Standard (Linode 4096) |
|
106
|
+
| 4 | 8GB Standard (Linode 8192) |
|
107
|
+
| 5 | 12GB Standard (Linode 12288) |
|
108
|
+
| 6 | 24GB Standard (Linode 24576) |
|
109
|
+
| 7 | 48GB Standard (Linode 49152) |
|
110
|
+
| 8 | 64GB Standard (Linode 65536) |
|
111
|
+
| 9 | 80GB Standard (Linode 81920) |
|
112
|
+
| 10 | 16GB HighMem (Linode 16384) |
|
113
|
+
| 11 | 32GB HighMem (Linode 32768) |
|
114
|
+
| 12 | 60GB HighMem (Linode 61440) |
|
115
|
+
| 13 | 100GB HighMem (Linode 102400) |
|
116
|
+
| 14 | 200GB HighMem (Linode 204800) |
|
112
117
|
|
113
118
|
This can be obtained through vagrant with:
|
114
119
|
```
|
@@ -127,7 +132,7 @@ More detail: [Linode API - Plans](https://www.linode.com/api/utility/avail.linod
|
|
127
132
|
### provider.datacenter
|
128
133
|
|
129
134
|
Each region has been specified with a Data Center ID.
|
130
|
-
Current
|
135
|
+
Current (Feb 2017) Datacenter-ID table is:
|
131
136
|
|
132
137
|
| DatacenterID | Datacenter | Location |
|
133
138
|
|:------- |:------ |:--------------------|
|
@@ -139,6 +144,7 @@ Current Region-ID table is:
|
|
139
144
|
| 8 | tokyo | Tokyo, JP |
|
140
145
|
| 9 | singapore | Singapore, SGP |
|
141
146
|
| 10 | frankfurt | Frankfurt, DE |
|
147
|
+
| 11 | shinagawa1 | Tokyo 2, JP |
|
142
148
|
|
143
149
|
You can find latest datacenter ID number using Vagrant subcommands:
|
144
150
|
|
@@ -219,7 +225,7 @@ to install dependencies:
|
|
219
225
|
|
220
226
|
$ bundle
|
221
227
|
|
222
|
-
To run the provider's tests:
|
228
|
+
To run the provider's tests, first install vagrant [as shown here](https://www.vagrantup.com/downloads.html) and then use rake:
|
223
229
|
|
224
230
|
$ bundle exec rake test
|
225
231
|
|
@@ -188,6 +188,8 @@ module VagrantPlugins
|
|
188
188
|
b2.use SetupUser
|
189
189
|
b2.use SetupHostname
|
190
190
|
b2.use Provision
|
191
|
+
else
|
192
|
+
b2.use MessageNotOff
|
191
193
|
end
|
192
194
|
end
|
193
195
|
else
|
@@ -258,11 +260,11 @@ module VagrantPlugins
|
|
258
260
|
autoload :ConnectLinode, action_root.join('connect_linode')
|
259
261
|
autoload :ReadState, action_root.join('read_state')
|
260
262
|
autoload :Create, action_root.join('create')
|
261
|
-
autoload :Destroy, action_root.join('destroy')
|
262
263
|
autoload :IsCreated, action_root.join('is_created')
|
263
264
|
autoload :IsStopped, action_root.join('is_stopped')
|
264
265
|
autoload :MessageAlreadyActive, action_root.join('message_already_active')
|
265
266
|
autoload :MessageAlreadyOff, action_root.join('message_already_off')
|
267
|
+
autoload :MessageNotOff, action_root.join('message_not_off')
|
266
268
|
autoload :MessageNotCreated, action_root.join('message_not_created')
|
267
269
|
autoload :MessageOff, action_root.join('message_off')
|
268
270
|
autoload :ModifyProvisionPath, action_root.join('modify_provision_path')
|
@@ -70,7 +70,7 @@ module VagrantPlugins
|
|
70
70
|
end
|
71
71
|
|
72
72
|
if @machine.provider_config.kernel
|
73
|
-
kernels = @client.avail.kernels
|
73
|
+
kernels = @client.avail.kernels(isxen: nil, iskvm: 1)
|
74
74
|
kernel = kernels.find { |k| k.label.downcase.include? @machine.provider_config.kernel.downcase }
|
75
75
|
raise( Errors::KernelMatch, kernel: @machine.provider_config.kernel.to_s ) if kernel == nil
|
76
76
|
kernel_id = kernel.kernelid || nil
|
@@ -9,7 +9,7 @@ module VagrantPlugins
|
|
9
9
|
def call(env)
|
10
10
|
linode_api = env[:linode_api]
|
11
11
|
env[:ui].info ('%-4s %-6s %-6s %s' % ['ID', 'IsXen', 'IsKVM', 'Kernel Name'])
|
12
|
-
linode_api.avail.kernels.sort_by(&:kernelid).each do |kernel|
|
12
|
+
linode_api.avail.kernels(isxen: nil, iskvm: 1).sort_by(&:kernelid).each do |kernel|
|
13
13
|
env[:ui].info ('%-4s %-6s %-6s %s' % [kernel.kernelid, kernel.isxen, kernel.iskvm, kernel.label])
|
14
14
|
end
|
15
15
|
@app.call(env)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Linode
|
3
|
+
module Actions
|
4
|
+
class MessageNotOff
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
env[:ui].info(I18n.t("vagrant_linode.info.not_off"))
|
11
|
+
@app.call(env)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -70,7 +70,7 @@ module VagrantPlugins
|
|
70
70
|
end
|
71
71
|
|
72
72
|
if @machine.provider_config.kernel
|
73
|
-
kernels = @client.avail.kernels
|
73
|
+
kernels = @client.avail.kernels(isxen: nil, iskvm: 1)
|
74
74
|
kernel = kernels.find { |k| k.label.downcase.include? @machine.provider_config.kernel.downcase }
|
75
75
|
raise( Errors::KernelMatch, kernel: @machine.provider_config.kernel.to_s ) if kernel == nil
|
76
76
|
kernel_id = kernel.kernelid || nil
|
@@ -116,26 +116,33 @@ module VagrantPlugins
|
|
116
116
|
elsif disk_sanity == false
|
117
117
|
fail Errors::DiskSize, current: (xvda_size.to_i + swap_size.to_i), max: ( plan['disk'].to_i * 1024)
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
|
+
env[:ui].info I18n.t('vagrant_linode.info.powering_off')
|
121
|
+
|
122
|
+
shutdownjob = @client.linode.shutdown(
|
123
|
+
linodeid: @machine.id
|
124
|
+
)
|
125
|
+
wait_for_event(env, shutdownjob['jobid'])
|
126
|
+
|
120
127
|
env[:ui].info I18n.t('vagrant_linode.info.destroying')
|
121
|
-
|
128
|
+
|
122
129
|
diskList = @client.linode.disk.list(
|
123
130
|
linodeid: @machine.id
|
124
131
|
)
|
125
|
-
|
132
|
+
|
126
133
|
diskList.each do |diskEntry|
|
127
134
|
diskDeleteResult = @client.linode.disk.delete(
|
128
135
|
linodeid: @machine.id,
|
129
136
|
diskid: diskEntry['diskid']
|
130
137
|
)
|
131
|
-
|
138
|
+
|
132
139
|
job = diskDeleteResult['jobid']
|
133
|
-
|
140
|
+
|
134
141
|
jobStatus = @client.linode.job.list(
|
135
142
|
linodeid: @machine.id,
|
136
143
|
jobid: job
|
137
144
|
)
|
138
|
-
|
145
|
+
|
139
146
|
while jobStatus[0]['host_finish_dt'].nil? || jobStatus[0]['host_finish_dt'].empty? do
|
140
147
|
sleep(5)
|
141
148
|
jobStatus = @client.linode.job.list(
|
@@ -144,18 +151,18 @@ module VagrantPlugins
|
|
144
151
|
)
|
145
152
|
end
|
146
153
|
end
|
147
|
-
|
154
|
+
|
148
155
|
configList = @client.linode.config.list(
|
149
156
|
linodeid: @machine.id
|
150
157
|
)
|
151
|
-
|
158
|
+
|
152
159
|
configList.each do |configEntry|
|
153
160
|
configDeleteResult = @client.linode.config.delete(
|
154
161
|
linodeid: @machine.id,
|
155
162
|
configid: configEntry['configid']
|
156
163
|
)
|
157
164
|
end
|
158
|
-
|
165
|
+
|
159
166
|
env[:ui].info I18n.t('vagrant_linode.info.creating')
|
160
167
|
|
161
168
|
if stackscript_id
|
@@ -21,8 +21,6 @@ module VagrantPlugins
|
|
21
21
|
attr_accessor :stackscript
|
22
22
|
attr_accessor :stackscript_udf_responses
|
23
23
|
attr_accessor :xvda_size
|
24
|
-
attr_accessor :xvdc_size
|
25
|
-
attr_accessor :xvdc_type
|
26
24
|
attr_accessor :swap_size
|
27
25
|
attr_accessor :kernelid
|
28
26
|
attr_accessor :kernel
|
@@ -54,8 +52,6 @@ module VagrantPlugins
|
|
54
52
|
@ssh_key_name = UNSET_VALUE
|
55
53
|
@setup = UNSET_VALUE
|
56
54
|
@xvda_size = UNSET_VALUE
|
57
|
-
@xvdc_size = UNSET_VALUE
|
58
|
-
@xvdc_type = UNSET_VALUE
|
59
55
|
@swap_size = UNSET_VALUE
|
60
56
|
@kernelid = UNSET_VALUE
|
61
57
|
@kernel = UNSET_VALUE
|
@@ -88,8 +84,6 @@ module VagrantPlugins
|
|
88
84
|
@ssh_key_name = 'Vagrant' if @ssh_key_name == UNSET_VALUE
|
89
85
|
@setup = true if @setup == UNSET_VALUE
|
90
86
|
@xvda_size = true if @xvda_size == UNSET_VALUE
|
91
|
-
@xvdc_size = nil if @xvdc_size == UNSET_VALUE
|
92
|
-
@xvdc_type = 'raw' if @xvdc_type == UNSET_VALUE
|
93
87
|
@swap_size = '256' if @swap_size == UNSET_VALUE
|
94
88
|
@kernelid = nil if @kernelid == UNSET_VALUE
|
95
89
|
@kernel = nil if @kernel == UNSET_VALUE
|
@@ -35,7 +35,7 @@ module VagrantPlugins
|
|
35
35
|
def initialize(machine)
|
36
36
|
@logger = Log4r::Logger.new('vagrant::linode::apiclient')
|
37
37
|
@config = machine.provider_config
|
38
|
-
@client = ::LinodeAPI::
|
38
|
+
@client = ::LinodeAPI::Retryable.new(apikey: @config.api_key, endpoint: @config.api_url || nil)
|
39
39
|
end
|
40
40
|
|
41
41
|
attr_reader :client
|
data/locales/en.yml
CHANGED
data/test/Vagrantfile
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
# vi: set ft=ruby :
|
3
3
|
|
4
4
|
Vagrant.configure('2') do |config|
|
5
|
-
config.ssh.username = 'tester'
|
6
|
-
config.ssh.private_key_path = '
|
5
|
+
#config.ssh.username = 'tester'
|
6
|
+
config.ssh.private_key_path = '~/.ssh/id_rsa'
|
7
7
|
|
8
|
-
config.vm.synced_folder '.', '/vagrant', disabled: true
|
8
|
+
#config.vm.synced_folder '.', '/vagrant', disabled: true
|
9
|
+
config.vm.network 'forwarded_port', guest: 8080, host: 80
|
9
10
|
|
10
11
|
config.vm.provider :linode do |provider, override|
|
11
12
|
override.vm.box = 'linode'
|
12
|
-
override.vm.box_url = 'https://github.com/displague/vagrant-linode/raw/master/box/linode.box'
|
13
13
|
provider.api_key = ENV['LINODE_API_KEY']
|
14
14
|
provider.ssh_key_name = 'Test Key'
|
15
15
|
provider.distribution = 'Debian 8'
|
@@ -17,6 +17,7 @@ Vagrant.configure('2') do |config|
|
|
17
17
|
provider.plan = '2048'
|
18
18
|
provider.label = 'vagrant-'+Time.new.strftime("%F%T").gsub(/[^0-9]/,'')
|
19
19
|
|
20
|
+
|
20
21
|
# Disk Image Sizes (Optional configuration)
|
21
22
|
|
22
23
|
# Main Disk Image Size
|
@@ -39,17 +40,18 @@ Vagrant.configure('2') do |config|
|
|
39
40
|
# provider.private_networking = true
|
40
41
|
end
|
41
42
|
|
42
|
-
config.vm.provision :shell, path: 'scripts/provision.sh'
|
43
|
+
#config.vm.provision :shell, path: 'scripts/provision.sh'
|
43
44
|
|
44
|
-
config.vm.provision :chef_solo do |chef|
|
45
|
-
|
46
|
-
|
47
|
-
end
|
45
|
+
#config.vm.provision :chef_solo do |chef|
|
46
|
+
# chef.cookbooks_path = 'cookbooks'
|
47
|
+
# chef.add_recipe 'test'
|
48
|
+
#end
|
48
49
|
|
49
50
|
# Linode Specific Configurations
|
50
51
|
config.vm.define :ubuntu do |ubuntu|
|
51
52
|
ubuntu.vm.provider :linode do |provider|
|
52
|
-
provider.distribution = 'Ubuntu
|
53
|
+
provider.distribution = 'Ubuntu 16.04'
|
54
|
+
config.vm.provision :shell, inline: 'sudo apt-get install -y apache2'
|
53
55
|
|
54
56
|
# Optional Settings
|
55
57
|
provider.label = 'Vagrant-Ubuntu'
|
data/vagrant-linode.gemspec
CHANGED
@@ -13,12 +13,11 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.homepage = 'https://www.github.com/displague/vagrant-linode'
|
14
14
|
gem.summary = gem.description
|
15
15
|
|
16
|
-
gem.add_runtime_dependency 'linodeapi', '~>
|
16
|
+
gem.add_runtime_dependency 'linodeapi', '~> 2.0.1'
|
17
17
|
gem.add_runtime_dependency 'log4r', '~> 1.1'
|
18
18
|
|
19
19
|
gem.add_development_dependency 'rake', '~> 12.0'
|
20
20
|
gem.add_development_dependency 'rspec', '~> 3.5'
|
21
|
-
gem.add_development_dependency 'aruba', '~> 0.14'
|
22
21
|
|
23
22
|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
24
23
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-linode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marques Johansson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: linodeapi
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 2.0.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 2.0.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: log4r
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,20 +67,6 @@ dependencies:
|
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '3.5'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: aruba
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0.14'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0.14'
|
84
70
|
description: Enables Vagrant to manage Linode linodes
|
85
71
|
email:
|
86
72
|
- marques@linode.com
|
@@ -104,12 +90,6 @@ files:
|
|
104
90
|
- box/linode.box
|
105
91
|
- box/metadata-debian-7.5.json
|
106
92
|
- box/metadata.json
|
107
|
-
- features/provision.feature
|
108
|
-
- features/steps/sdk_steps.rb
|
109
|
-
- features/steps/server_steps.rb
|
110
|
-
- features/support/env.rb
|
111
|
-
- features/support/fog_mock.rb
|
112
|
-
- features/vagrant-linode.feature
|
113
93
|
- lib/vagrant-linode.rb
|
114
94
|
- lib/vagrant-linode/actions.rb
|
115
95
|
- lib/vagrant-linode/actions/connect_linode.rb
|
@@ -127,6 +107,7 @@ files:
|
|
127
107
|
- lib/vagrant-linode/actions/message_already_active.rb
|
128
108
|
- lib/vagrant-linode/actions/message_already_off.rb
|
129
109
|
- lib/vagrant-linode/actions/message_not_created.rb
|
110
|
+
- lib/vagrant-linode/actions/message_not_off.rb
|
130
111
|
- lib/vagrant-linode/actions/message_off.rb
|
131
112
|
- lib/vagrant-linode/actions/modify_provision_path.rb
|
132
113
|
- lib/vagrant-linode/actions/power_off.rb
|
@@ -189,17 +170,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
170
|
version: '0'
|
190
171
|
requirements: []
|
191
172
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.5.
|
173
|
+
rubygems_version: 2.4.5.3
|
193
174
|
signing_key:
|
194
175
|
specification_version: 4
|
195
176
|
summary: Enables Vagrant to manage Linode linodes
|
196
177
|
test_files:
|
197
|
-
- features/provision.feature
|
198
|
-
- features/steps/sdk_steps.rb
|
199
|
-
- features/steps/server_steps.rb
|
200
|
-
- features/support/env.rb
|
201
|
-
- features/support/fog_mock.rb
|
202
|
-
- features/vagrant-linode.feature
|
203
178
|
- spec/spec_helper.rb
|
204
179
|
- spec/vagrant-linode/actions/list_distributions_spec.rb
|
205
180
|
- spec/vagrant-linode/actions/list_plans_spec.rb
|
data/features/provision.feature
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
@announce
|
2
|
-
@vagrant-linode
|
3
|
-
Feature: vagrant-linode fog tests
|
4
|
-
|
5
|
-
Background:
|
6
|
-
Given I have Linode credentials available
|
7
|
-
And I have a "fog_mock.rb" file
|
8
|
-
|
9
|
-
Scenario: Create a single server (with provisioning)
|
10
|
-
Given a file named "Vagrantfile" with:
|
11
|
-
"""
|
12
|
-
Vagrant.configure("2") do |config|
|
13
|
-
Vagrant.require_plugin "vagrant-linode"
|
14
|
-
|
15
|
-
config.vm.box = "dummy"
|
16
|
-
config.ssh.private_key_path = "~/.ssh/id_rsa"
|
17
|
-
|
18
|
-
|
19
|
-
config.vm.provider :linode do |provider|
|
20
|
-
provider.server_name = 'vagrant-provisioned-server'
|
21
|
-
provider.api_key = ENV['LINODE_API_KEY']
|
22
|
-
provider.datacenter = 'dallas'
|
23
|
-
provider.plan = /Linode 2048/
|
24
|
-
provider.distribution = /Ubuntu/
|
25
|
-
provider.public_key_path = "~/.ssh/id_rsa.pub"
|
26
|
-
end
|
27
|
-
|
28
|
-
config.vm.provision :shell, :inline => "echo Hello, World"
|
29
|
-
end
|
30
|
-
"""
|
31
|
-
When I successfully run `bundle exec vagrant up --provider linode`
|
32
|
-
# I want to capture the ID like I do in tests for other tools, but Vagrant doesn't print it!
|
33
|
-
# And I get the server from "Instance ID:"
|
34
|
-
Then the server "vagrant-provisioned-server" should be active
|
data/features/steps/sdk_steps.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
Given(/^I have Linode credentials available$/) do
|
2
|
-
fail unless ENV['LINODE_API_KEY']
|
3
|
-
end
|
4
|
-
|
5
|
-
Given(/^I have a "fog_mock.rb" file$/) do
|
6
|
-
script = File.open('features/support/fog_mock.rb').read
|
7
|
-
steps %(
|
8
|
-
Given a file named "fog_mock.rb" with:
|
9
|
-
"""
|
10
|
-
#{script}
|
11
|
-
"""
|
12
|
-
)
|
13
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
When(/^I get the server from "(.*?)"$/) do |label|
|
2
|
-
@server_id = all_output.match(/#{label}\s([\w-]*)/)[1]
|
3
|
-
puts "Server: #{@server_id}"
|
4
|
-
end
|
5
|
-
|
6
|
-
When(/^I load the server$/) do
|
7
|
-
@server_id = all_output.strip.lines.to_a.last
|
8
|
-
puts "Server: #{@server_id}"
|
9
|
-
end
|
10
|
-
|
11
|
-
Then(/^the server should be active$/) do
|
12
|
-
unless Fog.mock? # unfortunately we can't assert this with Fog.mock!, since mocked objects do not persist from the subprocess
|
13
|
-
assert_active @server_id
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Then(/^the server "(.+)" should be active$/) do |server_name|
|
18
|
-
server = @compute.servers.all.find { |s| s.name == server_name }
|
19
|
-
assert_active server.id
|
20
|
-
end
|
21
|
-
|
22
|
-
def assert_active(server_id)
|
23
|
-
server = @compute.servers.get server_id
|
24
|
-
server.state.should == 'ACTIVE'
|
25
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'fog'
|
2
|
-
require 'aruba/cucumber'
|
3
|
-
|
4
|
-
Fog.mock! if ENV['LINODE_MOCK'] == 'true'
|
5
|
-
|
6
|
-
Before do | scenario |
|
7
|
-
@aruba_timeout_seconds = 600
|
8
|
-
@scenario = File.basename(scenario.file)
|
9
|
-
ENV['CASSETTE'] = @scenario
|
10
|
-
|
11
|
-
proxy_options = {
|
12
|
-
connection_options: {
|
13
|
-
proxy: ENV['https_proxy'],
|
14
|
-
ssl_verify_peer: false
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
connect_options = {
|
19
|
-
provider: 'linode',
|
20
|
-
linode_api_key: ENV['LINODE_API_KEY'],
|
21
|
-
}
|
22
|
-
connect_options.merge!(proxy_options) unless ENV['https_proxy'].nil?
|
23
|
-
@compute = Fog::Compute.new(connect_options)
|
24
|
-
end
|
25
|
-
|
26
|
-
Around do | _scenario, block |
|
27
|
-
Bundler.with_clean_env do
|
28
|
-
block.call
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
After('@creates_server') do
|
33
|
-
@compute.servers.delete @server_id
|
34
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'fog'
|
2
|
-
if ENV['LINODE_MOCK'] == 'true'
|
3
|
-
Fog.mock!
|
4
|
-
Fog::Linode::MockData.configure do |c|
|
5
|
-
c[:image_name_generator] = proc { 'Ubuntu' }
|
6
|
-
c[:ipv4_generator] = proc { '10.11.12.2' }
|
7
|
-
end
|
8
|
-
connect_options = {
|
9
|
-
provider: 'linode',
|
10
|
-
linode_api_key: ENV['LINODE_API_KEY'],
|
11
|
-
}
|
12
|
-
connect_options.merge!(proxy_options) unless ENV['https_proxy'].nil?
|
13
|
-
compute = Fog::Compute.new(connect_options)
|
14
|
-
# Force creation of Ubuntu image so it will show up in compute.images.list
|
15
|
-
compute.images.get(0)
|
16
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
@announce
|
2
|
-
@vagrant-linode
|
3
|
-
Feature: vagrant-linode fog tests
|
4
|
-
As a Fog developer
|
5
|
-
I want to smoke (or "fog") test vagrant-linode.
|
6
|
-
So I am confident my upstream changes did not create downstream problems.
|
7
|
-
|
8
|
-
Background:
|
9
|
-
Given I have Rackspace credentials available
|
10
|
-
And I have a "fog_mock.rb" file
|
11
|
-
|
12
|
-
Scenario: Create a single server (region)
|
13
|
-
Given a file named "Vagrantfile" with:
|
14
|
-
"""
|
15
|
-
# Testing options
|
16
|
-
require File.expand_path '../fog_mock', __FILE__
|
17
|
-
|
18
|
-
Vagrant.configure("2") do |config|
|
19
|
-
# dev/test method of loading plugin, normally would be 'vagrant plugin install vagrant-linode'
|
20
|
-
Vagrant.require_plugin "vagrant-linode"
|
21
|
-
|
22
|
-
config.vm.box = "dummy"
|
23
|
-
config.ssh.username = "vagrant" if Fog.mock?
|
24
|
-
config.ssh.private_key_path = "~/.ssh/id_rsa" unless Fog.mock?
|
25
|
-
|
26
|
-
config.vm.provider :linode do |provider|
|
27
|
-
provider.server_name = 'vagrant-single-server'
|
28
|
-
provider.api_key = ENV['LINODE_API_KEY']
|
29
|
-
linode.datacenter = ENV['LINODE_DATACENTER'].downcase.to_sym
|
30
|
-
linode.plan = /Linode 2048/
|
31
|
-
linode.distribution = /Ubuntu/
|
32
|
-
linode.public_key_path = "~/.ssh/id_rsa.pub" unless Fog.mock?
|
33
|
-
end
|
34
|
-
end
|
35
|
-
"""
|
36
|
-
When I successfully run `bundle exec vagrant up --provider linode`
|
37
|
-
# I want to capture the ID like I do in tests for other tools, but Vagrant doesn't print it!
|
38
|
-
# And I get the server from "Instance ID:"
|
39
|
-
Then the server "vagrant-single-server" should be active
|
40
|
-
|
41
|
-
Scenario: Create a single server (linode_compute_url)
|
42
|
-
Given a file named "Vagrantfile" with:
|
43
|
-
"""
|
44
|
-
# Testing options
|
45
|
-
require File.expand_path '../fog_mock', __FILE__
|
46
|
-
|
47
|
-
Vagrant.configure("2") do |config|
|
48
|
-
# dev/test method of loading plugin, normally would be 'vagrant plugin install vagrant-linode'
|
49
|
-
Vagrant.require_plugin "vagrant-linode"
|
50
|
-
|
51
|
-
config.vm.box = "dummy"
|
52
|
-
config.ssh.username = "vagrant" if Fog.mock?
|
53
|
-
config.ssh.private_key_path = "~/.ssh/id_rsa" unless Fog.mock?
|
54
|
-
|
55
|
-
config.vm.provider :linode do |provider|
|
56
|
-
provider.server_name = 'vagrant-single-server'
|
57
|
-
provider.api_key = ENV['LINODE_API_KEY']
|
58
|
-
provider.api_url = "https://api.linode.com/"
|
59
|
-
provider.plan = /Linode 2048/
|
60
|
-
provider.distribution = /Ubuntu/
|
61
|
-
provider.public_key_path = "~/.ssh/id_rsa.pub" unless Fog.mock?
|
62
|
-
end
|
63
|
-
end
|
64
|
-
"""
|
65
|
-
When I successfully run `bundle exec vagrant up --provider linode`
|
66
|
-
# I want to capture the ID like I do in tests for other tools, but Vagrant doesn't print it!
|
67
|
-
# And I get the server from "Instance ID:"
|
68
|
-
Then the server "vagrant-single-server" should be active
|