vagrant-cloudstack 0.8.0 → 0.9.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +4 -4
- data/build_rpm.sh +1 -1
- data/lib/vagrant-cloudstack.rb +0 -1
- data/lib/vagrant-cloudstack/action.rb +0 -1
- data/lib/vagrant-cloudstack/action/connect_cloudstack.rb +8 -8
- data/lib/vagrant-cloudstack/action/read_ssh_info.rb +2 -2
- data/lib/vagrant-cloudstack/action/run_instance.rb +34 -37
- data/lib/vagrant-cloudstack/action/start_instance.rb +5 -7
- data/lib/vagrant-cloudstack/action/sync_folders.rb +13 -16
- data/lib/vagrant-cloudstack/action/timed_provision.rb +1 -1
- data/lib/vagrant-cloudstack/config.rb +74 -64
- data/lib/vagrant-cloudstack/plugin.rb +6 -6
- data/lib/vagrant-cloudstack/provider.rb +2 -2
- data/lib/vagrant-cloudstack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8062f1e5775db2aeb409c886f250d1e7ae4823d8
|
4
|
+
data.tar.gz: 4f53a58c31e243b1d551c921461470f927197c3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63564c569d834e3b865aa3f1d51deb927ce7a0987eedece60228035c8dedb131454e256fa6c8c9b1bfd8d67d1f0fc7875d9e50443a7a5bdc566541004da0580e
|
7
|
+
data.tar.gz: 96aa1a3e10ab72e94e0801a8953e6428e5aba96f8725dad9df937d959023d03d0c5dad3166c5b8fa4873244f85f5264040899d588d3d1046bc8539a47cc9a5a5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 0.9.0 (Jun 25, 2014)
|
2
|
+
* Clean up of dead code and comments.
|
3
|
+
* Re-organize imports and code.
|
4
|
+
* Corrects the dependency on Vagrant 1.5+
|
5
|
+
* Updates documentation to refelect the above.
|
6
|
+
* Now supports setting the machine hostname in Vagrantfile
|
7
|
+
|
1
8
|
# 0.8.0 (Jun 24, 2014)
|
2
9
|
* Remove unused code.
|
3
10
|
* Add support for specifying most resources by name. Where applicable there is
|
data/README.md
CHANGED
@@ -8,11 +8,9 @@
|
|
8
8
|
|
9
9
|
This is a fork of [mitchellh AWS Provider](https://github.com/mitchellh/vagrant-aws/).
|
10
10
|
|
11
|
-
This is a [Vagrant](http://www.vagrantup.com) 1.
|
11
|
+
This is a [Vagrant](http://www.vagrantup.com) 1.5+ plugin that adds a [Cloudstack](http://cloudstack.apache.org)
|
12
12
|
provider to Vagrant.
|
13
13
|
|
14
|
-
**NOTE:** This plugin requires Vagrant 1.5+, since v0.4.0.
|
15
|
-
|
16
14
|
## Features
|
17
15
|
|
18
16
|
* SSH into the instances.
|
@@ -90,6 +88,7 @@ Vagrant.configure("2") do |config|
|
|
90
88
|
cloudstack.service_offering_name = "THE-BESTEST"
|
91
89
|
cloudstack.network_name = "WOW-SUCH-FAST-OFFERING"
|
92
90
|
cloudstack.zone_name = "District-9"
|
91
|
+
cloudstack.name = "doge-is-a-hostname-now"
|
93
92
|
# Sadly there is currently no support for the project api in fog.
|
94
93
|
cloudstack.project_id = "AAAAAAAAAAAAAAAAAAA"
|
95
94
|
cloudstack.network_type = "Advanced" # or "Basic"
|
@@ -128,10 +127,11 @@ This gives the possibility to use the easier to remember name instead of the UUI
|
|
128
127
|
this will also enable you to upgrade the different settings in your cloud without having
|
129
128
|
to update UUIDs in your Vagrantfile. If both are specified, the id parameter takes precedence.
|
130
129
|
|
130
|
+
* `name` - Hostname of the created machine
|
131
131
|
* `host` - Cloudstack api host
|
132
132
|
* `path` - Cloudstack api path
|
133
133
|
* `port` - Cloudstack api port
|
134
|
-
* `scheme` - Cloudstack api scheme _(
|
134
|
+
* `scheme` - Cloudstack api scheme _(defaults: https (thanks to the resolution order in fog))_
|
135
135
|
* `api_key` - The api key for accessing Cloudstack
|
136
136
|
* `secret_key` - The secret key for accessing Cloudstack
|
137
137
|
* `instance_ready_timeout` - The number of seconds to wait for the instance
|
data/build_rpm.sh
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
VERSION=0.
|
2
|
+
VERSION=0.9.0
|
3
3
|
mkdir -p /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION
|
4
4
|
cp -r . /tmp/vagrant-cloudstack-build_rpm.$$/vagrant-cloudstack-$VERSION/
|
5
5
|
tar -C /tmp/vagrant-cloudstack-build_rpm.$$/ -czf ~/rpmbuild/SOURCES/vagrant-cloudstack-$VERSION.tar.gz vagrant-cloudstack-$VERSION
|
data/lib/vagrant-cloudstack.rb
CHANGED
@@ -15,25 +15,25 @@ module VagrantPlugins
|
|
15
15
|
|
16
16
|
def call(env)
|
17
17
|
# Get the domain we're going to booting up in
|
18
|
-
domain
|
18
|
+
domain = env[:machine].provider_config.domain_id
|
19
19
|
|
20
20
|
# Get the configs
|
21
21
|
domain_config = env[:machine].provider_config.get_domain_config(domain)
|
22
22
|
|
23
23
|
# Build the fog config
|
24
|
-
fog_config
|
25
|
-
|
26
|
-
|
24
|
+
fog_config = {
|
25
|
+
:provider => :cloudstack
|
26
|
+
#:domain => domain_config
|
27
27
|
}
|
28
28
|
|
29
29
|
if domain_config.api_key
|
30
|
-
fog_config[:cloudstack_api_key]
|
30
|
+
fog_config[:cloudstack_api_key] = domain_config.api_key
|
31
31
|
fog_config[:cloudstack_secret_access_key] = domain_config.secret_key
|
32
32
|
end
|
33
33
|
|
34
|
-
fog_config[:cloudstack_host]
|
35
|
-
fog_config[:cloudstack_path]
|
36
|
-
fog_config[:cloudstack_port]
|
34
|
+
fog_config[:cloudstack_host] = domain_config.host if domain_config.host
|
35
|
+
fog_config[:cloudstack_path] = domain_config.path if domain_config.path
|
36
|
+
fog_config[:cloudstack_port] = domain_config.port if domain_config.port
|
37
37
|
fog_config[:cloudstack_scheme] = domain_config.scheme if domain_config.scheme
|
38
38
|
|
39
39
|
@logger.info("Connecting to Cloudstack...")
|
@@ -30,11 +30,11 @@ module VagrantPlugins
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# Get the Port forwarding config
|
33
|
-
domain
|
33
|
+
domain = machine.provider_config.domain_id
|
34
34
|
domain_config = machine.provider_config.get_domain_config(domain)
|
35
35
|
|
36
36
|
pf_ip_address_id = domain_config.pf_ip_address_id
|
37
|
-
pf_public_port
|
37
|
+
pf_public_port = domain_config.pf_public_port
|
38
38
|
|
39
39
|
if pf_ip_address_id and pf_public_port
|
40
40
|
begin
|
@@ -1,9 +1,6 @@
|
|
1
1
|
require "log4r"
|
2
|
-
require
|
3
|
-
|
4
|
-
require 'vagrant/util/retryable'
|
5
|
-
|
6
|
-
require 'vagrant-cloudstack/util/timer'
|
2
|
+
require "vagrant/util/retryable"
|
3
|
+
require "vagrant-cloudstack/util/timer"
|
7
4
|
|
8
5
|
module VagrantPlugins
|
9
6
|
module Cloudstack
|
@@ -19,34 +16,35 @@ module VagrantPlugins
|
|
19
16
|
|
20
17
|
def call(env)
|
21
18
|
# Initialize metrics if they haven't been
|
22
|
-
env[:metrics]
|
19
|
+
env[:metrics] ||= {}
|
23
20
|
|
24
21
|
# Get the domain we're going to booting up in
|
25
|
-
domain
|
22
|
+
domain = env[:machine].provider_config.domain_id
|
26
23
|
|
27
24
|
# Get the configs
|
28
|
-
domain_config
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
domain_config = env[:machine].provider_config.get_domain_config(domain)
|
26
|
+
hostname = domain_config.name
|
27
|
+
zone_id = domain_config.zone_id
|
28
|
+
zone_name = domain_config.zone_name
|
29
|
+
network_id = domain_config.network_id
|
30
|
+
network_name = domain_config.network_name
|
31
|
+
network_type = domain_config.network_type
|
34
32
|
#TODO: Fog currently does not support the project apis, when that is fixed we should add that here too.
|
35
|
-
project_id
|
36
|
-
service_offering_id
|
37
|
-
service_offering_name
|
38
|
-
template_id
|
39
|
-
template_name
|
40
|
-
keypair
|
41
|
-
pf_ip_address_id
|
42
|
-
pf_public_port
|
43
|
-
pf_private_port
|
44
|
-
display_name
|
45
|
-
group
|
46
|
-
security_group_ids
|
47
|
-
security_group_names
|
48
|
-
security_groups
|
49
|
-
user_data
|
33
|
+
project_id = domain_config.project_id
|
34
|
+
service_offering_id = domain_config.service_offering_id
|
35
|
+
service_offering_name = domain_config.service_offering_name
|
36
|
+
template_id = domain_config.template_id
|
37
|
+
template_name = domain_config.template_name
|
38
|
+
keypair = domain_config.keypair
|
39
|
+
pf_ip_address_id = domain_config.pf_ip_address_id
|
40
|
+
pf_public_port = domain_config.pf_public_port
|
41
|
+
pf_private_port = domain_config.pf_private_port
|
42
|
+
display_name = domain_config.display_name
|
43
|
+
group = domain_config.group
|
44
|
+
security_group_ids = domain_config.security_group_ids
|
45
|
+
security_group_names = domain_config.security_group_names
|
46
|
+
security_groups = domain_config.security_groups
|
47
|
+
user_data = domain_config.user_data
|
50
48
|
|
51
49
|
# If for some reason the user have specified both network_name and network_id, take the id since that is
|
52
50
|
# more specific than the name. But always try to fetch the name of the network to present to the user.
|
@@ -63,16 +61,16 @@ module VagrantPlugins
|
|
63
61
|
end
|
64
62
|
|
65
63
|
if service_offering_id.nil? and service_offering_name
|
66
|
-
service_offering_id
|
64
|
+
service_offering_id = name_to_id(env, service_offering_name, "service_offering")
|
67
65
|
elsif service_offering_id
|
68
66
|
service_offering_name = id_to_name(env, service_offering_id, "service_offering")
|
69
67
|
end
|
70
68
|
|
71
69
|
if template_id.nil? and template_name
|
72
|
-
template_id = name_to_id(env, template_name, "template", {'zoneid'
|
70
|
+
template_id = name_to_id(env, template_name, "template", {'zoneid' => zone_id,
|
73
71
|
'templatefilter' => 'executable'})
|
74
72
|
elsif template_id
|
75
|
-
template_name = id_to_name(env, template_id, "template", {'zoneid'
|
73
|
+
template_name = id_to_name(env, template_id, "template", {'zoneid' => zone_id,
|
76
74
|
'templatefilter' => 'executable'})
|
77
75
|
end
|
78
76
|
|
@@ -208,6 +206,7 @@ module VagrantPlugins
|
|
208
206
|
|
209
207
|
options['project_id'] = project_id if project_id != nil
|
210
208
|
options['key_name'] = keypair if keypair != nil
|
209
|
+
options['name'] = hostname if hostname != nil
|
211
210
|
|
212
211
|
if user_data != nil
|
213
212
|
options['user_data'] = Base64.encode64(user_data)
|
@@ -233,8 +232,6 @@ module VagrantPlugins
|
|
233
232
|
end
|
234
233
|
|
235
234
|
# Immediately save the ID since it is created at this point.
|
236
|
-
# XXX FIXME does cloudstack+fog return the job id rather than
|
237
|
-
# server id?
|
238
235
|
env[:machine].id = server.id
|
239
236
|
|
240
237
|
# Wait for the instance to be ready first
|
@@ -365,21 +362,21 @@ module VagrantPlugins
|
|
365
362
|
|
366
363
|
def translate_from_to(env, resource_type, options)
|
367
364
|
pluralised_type = "#{resource_type}s"
|
368
|
-
full_response
|
369
|
-
full_response["list#{pluralised_type.tr('_','')}response"][resource_type.tr('_','')]
|
365
|
+
full_response = env[:cloudstack_compute].send("list_#{pluralised_type}".to_sym, options)
|
366
|
+
full_response["list#{pluralised_type.tr('_', '')}response"][resource_type.tr('_', '')]
|
370
367
|
end
|
371
368
|
|
372
369
|
def name_to_id(env, resource_name, resource_type, options={})
|
373
370
|
env[:ui].info("Fetching UUID for #{resource_type} named '#{resource_name}'")
|
374
371
|
full_response = translate_from_to(env, resource_type, options)
|
375
|
-
result
|
372
|
+
result = full_response.find { |type| type["name"] == resource_name }
|
376
373
|
result['id']
|
377
374
|
end
|
378
375
|
|
379
376
|
def id_to_name(env, resource_id, resource_type, options={})
|
380
377
|
env[:ui].info("Fetching name for #{resource_type} with UUID '#{resource_id}'")
|
381
378
|
options.merge({'id' => resource_id})
|
382
|
-
full_response
|
379
|
+
full_response = translate_from_to(env, resource_type, options)
|
383
380
|
full_response[0]['name']
|
384
381
|
end
|
385
382
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require "log4r"
|
2
|
-
|
3
|
-
require
|
4
|
-
|
5
|
-
require 'vagrant-cloudstack/util/timer'
|
2
|
+
require "vagrant/util/retryable"
|
3
|
+
require "vagrant-cloudstack/util/timer"
|
6
4
|
|
7
5
|
module VagrantPlugins
|
8
6
|
module Cloudstack
|
@@ -27,8 +25,8 @@ module VagrantPlugins
|
|
27
25
|
begin
|
28
26
|
server.start
|
29
27
|
|
30
|
-
domain
|
31
|
-
domain_config
|
28
|
+
domain = env[:machine].provider_config.domain_id
|
29
|
+
domain_config = env[:machine].provider_config.get_domain_config(domain)
|
32
30
|
|
33
31
|
# Wait for the instance to be ready first
|
34
32
|
env[:metrics]["instance_ready_time"] = Util::Timer.time do
|
@@ -46,7 +44,7 @@ module VagrantPlugins
|
|
46
44
|
rescue Fog::Errors::TimeoutError
|
47
45
|
# Notify the user
|
48
46
|
raise Errors::InstanceReadyTimeout,
|
49
|
-
|
47
|
+
timeout: domain_config.instance_ready_timeout
|
50
48
|
end
|
51
49
|
end
|
52
50
|
rescue Fog::Compute::Cloudstack::Error => e
|
@@ -1,9 +1,6 @@
|
|
1
1
|
require "log4r"
|
2
|
-
|
3
2
|
require "vagrant/util/subprocess"
|
4
|
-
|
5
3
|
require "vagrant/util/scoped_hash_override"
|
6
|
-
|
7
4
|
require "vagrant/util/which"
|
8
5
|
|
9
6
|
module VagrantPlugins
|
@@ -40,7 +37,7 @@ module VagrantPlugins
|
|
40
37
|
|
41
38
|
# Make sure there is a trailing slash on the host path to
|
42
39
|
# avoid creating an additional directory with rsync
|
43
|
-
hostpath
|
40
|
+
hostpath = "#{hostpath}/" if hostpath !~ /\/$/
|
44
41
|
|
45
42
|
# on windows rsync.exe requires cygdrive-style paths
|
46
43
|
if Vagrant::Util::Platform.windows?
|
@@ -53,22 +50,22 @@ module VagrantPlugins
|
|
53
50
|
end
|
54
51
|
|
55
52
|
env[:ui].info(I18n.t("vagrant_cloudstack.rsync_folder",
|
56
|
-
|
57
|
-
|
53
|
+
:hostpath => hostpath,
|
54
|
+
:guestpath => guestpath))
|
58
55
|
|
59
56
|
# Create the guest path
|
60
57
|
env[:machine].communicate.sudo("mkdir -p '#{guestpath}'")
|
61
58
|
env[:machine].communicate.sudo(
|
62
|
-
|
59
|
+
"chown #{ssh_info[:username]} '#{guestpath}'")
|
63
60
|
|
64
61
|
# Rsync over to the guest path using the SSH info
|
65
62
|
private_keys = (ssh_info[:private_key_path].class == Array ? ssh_info[:private_key_path].join(",") : ssh_info[:private_key_path])
|
66
|
-
command
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
63
|
+
command = [
|
64
|
+
"rsync", "--verbose", "--archive", "-z",
|
65
|
+
"--exclude", ".vagrant/",
|
66
|
+
"-e", "ssh -p #{ssh_info[:port]} -o StrictHostKeyChecking=no -i '#{private_keys}'",
|
67
|
+
hostpath,
|
68
|
+
"#{ssh_info[:username]}@#{ssh_info[:host]}:#{guestpath}"]
|
72
69
|
|
73
70
|
# we need to fix permissions when using rsync.exe on windows, see
|
74
71
|
# http://stackoverflow.com/questions/5798807/rsync-permission-denied-created-directories-have-no-permissions
|
@@ -79,9 +76,9 @@ module VagrantPlugins
|
|
79
76
|
r = Vagrant::Util::Subprocess.execute(*command)
|
80
77
|
if r.exit_code != 0
|
81
78
|
raise Errors::RsyncError,
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
:guestpath => guestpath,
|
80
|
+
:hostpath => hostpath,
|
81
|
+
:stderr => r.stderr
|
85
82
|
end
|
86
83
|
end
|
87
84
|
end
|
@@ -8,6 +8,12 @@ module VagrantPlugins
|
|
8
8
|
# @return [String]
|
9
9
|
attr_accessor :host
|
10
10
|
|
11
|
+
# Hostname for the machine instance
|
12
|
+
# This will be passed through to the api.
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :name
|
16
|
+
|
11
17
|
# Cloudstack api path.
|
12
18
|
#
|
13
19
|
# @return [String]
|
@@ -148,45 +154,46 @@ module VagrantPlugins
|
|
148
154
|
#
|
149
155
|
# @return [String]
|
150
156
|
attr_accessor :user_data
|
151
|
-
|
157
|
+
|
152
158
|
|
153
159
|
def initialize(domain_specific=false)
|
154
|
-
@host
|
155
|
-
@
|
156
|
-
@
|
157
|
-
@
|
158
|
-
@
|
159
|
-
@
|
160
|
-
@
|
161
|
-
@
|
162
|
-
@
|
163
|
-
@
|
164
|
-
@
|
165
|
-
@
|
166
|
-
@
|
167
|
-
@
|
168
|
-
@
|
169
|
-
@
|
170
|
-
@
|
171
|
-
@
|
172
|
-
@
|
173
|
-
@
|
174
|
-
@
|
175
|
-
@
|
176
|
-
@
|
177
|
-
@
|
178
|
-
@
|
179
|
-
@
|
180
|
-
@
|
181
|
-
@
|
160
|
+
@host = UNSET_VALUE
|
161
|
+
@name = UNSET_VALUE
|
162
|
+
@path = UNSET_VALUE
|
163
|
+
@port = UNSET_VALUE
|
164
|
+
@scheme = UNSET_VALUE
|
165
|
+
@api_key = UNSET_VALUE
|
166
|
+
@secret_key = UNSET_VALUE
|
167
|
+
@instance_ready_timeout = UNSET_VALUE
|
168
|
+
@domain_id = UNSET_VALUE
|
169
|
+
@network_id = UNSET_VALUE
|
170
|
+
@network_name = UNSET_VALUE
|
171
|
+
@network_type = UNSET_VALUE
|
172
|
+
@project_id = UNSET_VALUE
|
173
|
+
@service_offering_id = UNSET_VALUE
|
174
|
+
@service_offering_name = UNSET_VALUE
|
175
|
+
@template_id = UNSET_VALUE
|
176
|
+
@template_name = UNSET_VALUE
|
177
|
+
@zone_id = UNSET_VALUE
|
178
|
+
@zone_name = UNSET_VALUE
|
179
|
+
@keypair = UNSET_VALUE
|
180
|
+
@pf_ip_address_id = UNSET_VALUE
|
181
|
+
@pf_public_port = UNSET_VALUE
|
182
|
+
@pf_private_port = UNSET_VALUE
|
183
|
+
@security_group_ids = UNSET_VALUE
|
184
|
+
@display_name = UNSET_VALUE
|
185
|
+
@group = UNSET_VALUE
|
186
|
+
@security_group_names = UNSET_VALUE
|
187
|
+
@security_groups = UNSET_VALUE
|
188
|
+
@user_data = UNSET_VALUE
|
182
189
|
|
183
190
|
|
184
191
|
# Internal state (prefix with __ so they aren't automatically
|
185
192
|
# merged)
|
186
193
|
@__compiled_domain_configs = {}
|
187
|
-
@__finalized
|
188
|
-
@__domain_config
|
189
|
-
@__domain_specific
|
194
|
+
@__finalized = false
|
195
|
+
@__domain_config = {}
|
196
|
+
@__domain_specific = domain_specific
|
190
197
|
end
|
191
198
|
|
192
199
|
# Allows domain-specific overrides of any of the settings on this
|
@@ -230,7 +237,7 @@ module VagrantPlugins
|
|
230
237
|
# has it.
|
231
238
|
new_domain_specific = other.instance_variable_get(:@__domain_specific)
|
232
239
|
result.instance_variable_set(
|
233
|
-
|
240
|
+
:@__domain_specific, new_domain_specific || @__domain_specific)
|
234
241
|
|
235
242
|
# Go through all the domain configs and prepend ours onto
|
236
243
|
# theirs.
|
@@ -250,89 +257,92 @@ module VagrantPlugins
|
|
250
257
|
end
|
251
258
|
|
252
259
|
def finalize!
|
253
|
-
#
|
254
|
-
@host
|
260
|
+
# Host must be nil, since we can't default that
|
261
|
+
@host = nil if @host == UNSET_VALUE
|
262
|
+
|
263
|
+
# Name must be nil, since we can't default that
|
264
|
+
@name = nil if @name == UNSET_VALUE
|
255
265
|
|
256
266
|
# Path must be nil, since we can't default that
|
257
|
-
@path
|
267
|
+
@path = nil if @path == UNSET_VALUE
|
258
268
|
|
259
269
|
# Port must be nil, since we can't default that
|
260
|
-
@port
|
270
|
+
@port = nil if @port == UNSET_VALUE
|
261
271
|
|
262
272
|
# We default the scheme to whatever the user has specifid in the .fog file
|
263
273
|
# *OR* whatever is default for the provider in the fog library
|
264
|
-
@scheme
|
274
|
+
@scheme = nil if @scheme == UNSET_VALUE
|
265
275
|
|
266
276
|
# Try to get access keys from environment variables, they will
|
267
277
|
# default to nil if the environment variables are not present
|
268
|
-
@api_key
|
269
|
-
@secret_key
|
278
|
+
@api_key = ENV['CLOUDSTACK_API_KEY'] if @api_key == UNSET_VALUE
|
279
|
+
@secret_key = ENV['CLOUDSTACK_SECRET_KEY'] if @secret_key == UNSET_VALUE
|
270
280
|
|
271
281
|
# Set the default timeout for waiting for an instance to be ready
|
272
282
|
@instance_ready_timeout = 120 if @instance_ready_timeout == UNSET_VALUE
|
273
283
|
|
274
284
|
# Domain id must be nil, since we can't default that
|
275
|
-
@domain_id
|
285
|
+
@domain_id = nil if @domain_id == UNSET_VALUE
|
276
286
|
|
277
287
|
# Network uuid must be nil, since we can't default that
|
278
|
-
@network_id
|
288
|
+
@network_id = nil if @network_id == UNSET_VALUE
|
279
289
|
|
280
290
|
# Network uuid must be nil, since we can't default that
|
281
|
-
@network_name
|
291
|
+
@network_name = nil if @network_name == UNSET_VALUE
|
282
292
|
|
283
293
|
# NetworkType is 'Advanced' by default
|
284
|
-
@network_type
|
294
|
+
@network_type = "Advanced" if @network_type == UNSET_VALUE
|
285
295
|
|
286
296
|
# Project uuid must be nil, since we can't default that
|
287
|
-
@project_id
|
297
|
+
@project_id = nil if @project_id == UNSET_VALUE
|
288
298
|
|
289
299
|
# Service offering uuid must be nil, since we can't default that
|
290
|
-
@service_offering_id
|
300
|
+
@service_offering_id = nil if @service_offering_id == UNSET_VALUE
|
291
301
|
|
292
302
|
# Service offering name must be nil, since we can't default that
|
293
|
-
@service_offering_name
|
303
|
+
@service_offering_name = nil if @service_offering_name == UNSET_VALUE
|
294
304
|
|
295
305
|
# Template uuid must be nil, since we can't default that
|
296
|
-
@template_id
|
306
|
+
@template_id = nil if @template_id == UNSET_VALUE
|
297
307
|
|
298
308
|
# Template name must be nil, since we can't default that
|
299
|
-
@template_name
|
309
|
+
@template_name = nil if @template_name == UNSET_VALUE
|
300
310
|
|
301
311
|
# Zone uuid must be nil, since we can't default that
|
302
|
-
@zone_id
|
312
|
+
@zone_id = nil if @zone_id == UNSET_VALUE
|
303
313
|
|
304
314
|
# Zone uuid must be nil, since we can't default that
|
305
|
-
@zone_name
|
315
|
+
@zone_name = nil if @zone_name == UNSET_VALUE
|
306
316
|
|
307
317
|
# Keypair defaults to nil
|
308
|
-
@keypair
|
318
|
+
@keypair = nil if @keypair == UNSET_VALUE
|
309
319
|
|
310
320
|
# IP address id must be nil, since we can't default that
|
311
|
-
@pf_ip_address_id
|
321
|
+
@pf_ip_address_id = nil if @pf_ip_address_id == UNSET_VALUE
|
312
322
|
|
313
323
|
# Public port must be nil, since we can't default that
|
314
|
-
@pf_public_port
|
324
|
+
@pf_public_port = nil if @pf_public_port == UNSET_VALUE
|
315
325
|
|
316
326
|
# Private port must be nil, since we can't default that
|
317
|
-
@pf_private_port
|
327
|
+
@pf_private_port = nil if @pf_private_port == UNSET_VALUE
|
318
328
|
|
319
329
|
# Security Group IDs must be nil, since we can't default that
|
320
|
-
@security_group_ids
|
330
|
+
@security_group_ids = nil if @security_group_ids == UNSET_VALUE
|
321
331
|
|
322
332
|
# Security Group Names must be nil, since we can't default that
|
323
|
-
@security_group_names
|
333
|
+
@security_group_names = nil if @security_group_names == UNSET_VALUE
|
324
334
|
|
325
335
|
# Security Groups must be nil, since we can't default that
|
326
|
-
@security_groups
|
336
|
+
@security_groups = nil if @security_groups == UNSET_VALUE
|
327
337
|
|
328
338
|
# Display name must be nil, since we can't default that
|
329
|
-
@display_name
|
339
|
+
@display_name = nil if @display_name == UNSET_VALUE
|
330
340
|
|
331
341
|
# Group must be nil, since we can't default that
|
332
|
-
@group
|
342
|
+
@group = nil if @group == UNSET_VALUE
|
333
343
|
|
334
344
|
# User Data is nil by default
|
335
|
-
@user_data
|
345
|
+
@user_data = nil if @user_data == UNSET_VALUE
|
336
346
|
|
337
347
|
# Compile our domain specific configurations only within
|
338
348
|
# NON-DOMAIN-SPECIFIC configurations.
|
@@ -369,13 +379,13 @@ module VagrantPlugins
|
|
369
379
|
|
370
380
|
if !config.use_fog_profile
|
371
381
|
errors << I18n.t("vagrant_cloudstack.config.api_key_required") if \
|
372
|
-
|
382
|
+
config.access_key_id.nil?
|
373
383
|
errors << I18n.t("vagrant_cloudstack.config.secret_key_required") if \
|
374
|
-
|
384
|
+
config.secret_access_key.nil?
|
375
385
|
end
|
376
386
|
end
|
377
387
|
|
378
|
-
{
|
388
|
+
{"Cloudstack Provider" => errors}
|
379
389
|
end
|
380
390
|
|
381
391
|
# This gets the configuration for a specific domain. It shouldn't
|
@@ -6,8 +6,8 @@ end
|
|
6
6
|
|
7
7
|
# This is a sanity check to make sure no one is attempting to install
|
8
8
|
# this into an early Vagrant version.
|
9
|
-
if Vagrant::VERSION < "1.
|
10
|
-
raise "The Vagrant Cloudstack plugin is only compatible with Vagrant 1.
|
9
|
+
if Vagrant::VERSION < "1.5.0"
|
10
|
+
raise "The Vagrant Cloudstack plugin is only compatible with Vagrant 1.5+"
|
11
11
|
end
|
12
12
|
|
13
13
|
module VagrantPlugins
|
@@ -24,7 +24,7 @@ module VagrantPlugins
|
|
24
24
|
Config
|
25
25
|
end
|
26
26
|
|
27
|
-
provider(:cloudstack, parallel: true) do
|
27
|
+
provider(:cloudstack, parallel: true) do # Setup logging and i18n
|
28
28
|
setup_logging
|
29
29
|
setup_i18n
|
30
30
|
|
@@ -61,10 +61,10 @@ module VagrantPlugins
|
|
61
61
|
# Set the logging level on all "vagrant" namespaced
|
62
62
|
# logs as long as we have a valid level.
|
63
63
|
if level
|
64
|
-
logger
|
64
|
+
logger = Log4r::Logger.new("vagrant_cloudstack")
|
65
65
|
logger.outputters = Log4r::Outputter.stderr
|
66
|
-
logger.level
|
67
|
-
logger
|
66
|
+
logger.level = level
|
67
|
+
logger = nil
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -34,8 +34,8 @@ module VagrantPlugins
|
|
34
34
|
state_id = env[:machine_state_id]
|
35
35
|
|
36
36
|
# Get the short and long description
|
37
|
-
short
|
38
|
-
long
|
37
|
+
short = I18n.t("vagrant_cloudstack.states.short_#{state_id}")
|
38
|
+
long = I18n.t("vagrant_cloudstack.states.long_#{state_id}")
|
39
39
|
|
40
40
|
# Return the MachineState object
|
41
41
|
Vagrant::MachineState.new(state_id, short, long)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-cloudstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchell Hashimoto
|
@@ -18,7 +18,7 @@ authors:
|
|
18
18
|
autorequire:
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
|
-
date: 2014-06-
|
21
|
+
date: 2014-06-25 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: fog
|