vagrant-cosmic 0.1.0 → 0.2.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 +4 -0
- data/Gemfile.lock +21 -21
- data/README.md +3 -2
- data/lib/vagrant-cosmic/action/run_instance.rb +27 -1
- data/lib/vagrant-cosmic/config.rb +135 -88
- data/lib/vagrant-cosmic/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/vagrant-cosmic/action/run_instance_spec.rb +48 -0
- data/test/vagrant.log +45 -0
- data/vagrant-cosmic.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bc8b5773c5e921ced5013787149dc97f6033baa4d5ffcac0c174df436e1030e
|
4
|
+
data.tar.gz: 1d2e353c0f413472b6e5c420990de781bf69f36c7ce04c7d26d1ab65b5db8aeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a26617c1e2d5e1e68b3c1c55e241084a47f024e7fb55570e8a05222608d00bb990537261f44df44d359584c82c5df84756ef3facf4e103470b64b620e4ef990
|
7
|
+
data.tar.gz: 7e9626c01b56224007699ab6c8a9ca85a03bc98e746f52f1e8edebd426c638f9375f3f01a232ef14c940617317e525ec6ed783f71d9d38180ca3f374875a8f9a
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
This file is used to list changes made in each version of the `vagrant-cosmic` plugin.
|
4
4
|
|
5
|
+
## 0.2.0 (2020-06-11)
|
6
|
+
|
7
|
+
- Added support to provision instances in an already existing Affinity Group(s).
|
8
|
+
|
5
9
|
## 0.1.0 (2020-02-25)
|
6
10
|
|
7
11
|
- Forked plugin from [MissionCriticalCloud/vagrant-cloudstack](https://github.com/MissionCriticalCloud/vagrant-cloudstack) and renamed to `vagrant-cosmic`
|
data/Gemfile.lock
CHANGED
@@ -28,7 +28,7 @@ GIT
|
|
28
28
|
PATH
|
29
29
|
remote: .
|
30
30
|
specs:
|
31
|
-
vagrant-cosmic (0.
|
31
|
+
vagrant-cosmic (0.2.0)
|
32
32
|
fog-cosmic (~> 0.1.0)
|
33
33
|
|
34
34
|
GEM
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
builder (3.2.4)
|
39
39
|
childprocess (0.6.3)
|
40
40
|
ffi (~> 1.0, >= 1.0.11)
|
41
|
-
coderay (1.1.
|
41
|
+
coderay (1.1.3)
|
42
42
|
concurrent-ruby (1.1.6)
|
43
43
|
coveralls (0.7.1)
|
44
44
|
multi_json (~> 1.3)
|
@@ -53,8 +53,8 @@ GEM
|
|
53
53
|
ed25519 (1.2.4)
|
54
54
|
erubi (1.9.0)
|
55
55
|
erubis (2.7.0)
|
56
|
-
excon (0.
|
57
|
-
ffi (1.
|
56
|
+
excon (0.73.0)
|
57
|
+
ffi (1.13.1)
|
58
58
|
fog-core (2.2.0)
|
59
59
|
builder
|
60
60
|
excon (~> 0.71)
|
@@ -90,10 +90,10 @@ GEM
|
|
90
90
|
logging (2.2.2)
|
91
91
|
little-plugger (~> 1.1)
|
92
92
|
multi_json (~> 1.10)
|
93
|
-
method_source (0.
|
93
|
+
method_source (1.0.0)
|
94
94
|
mime-types (3.3.1)
|
95
95
|
mime-types-data (~> 3.2015)
|
96
|
-
mime-types-data (3.
|
96
|
+
mime-types-data (3.2020.0512)
|
97
97
|
mini_portile2 (2.4.0)
|
98
98
|
multi_json (1.14.1)
|
99
99
|
net-scp (1.2.1)
|
@@ -102,14 +102,14 @@ GEM
|
|
102
102
|
net-ssh (>= 2.6.5)
|
103
103
|
net-ssh (5.1.0)
|
104
104
|
netrc (0.11.0)
|
105
|
-
nokogiri (1.10.
|
105
|
+
nokogiri (1.10.9)
|
106
106
|
mini_portile2 (~> 2.4.0)
|
107
107
|
nori (2.6.0)
|
108
|
-
pry (0.
|
109
|
-
coderay (~> 1.1
|
110
|
-
method_source (~>
|
111
|
-
rake (
|
112
|
-
rb-fsevent (0.10.
|
108
|
+
pry (0.13.1)
|
109
|
+
coderay (~> 1.1)
|
110
|
+
method_source (~> 1.0)
|
111
|
+
rake (13.0.1)
|
112
|
+
rb-fsevent (0.10.4)
|
113
113
|
rb-inotify (0.10.1)
|
114
114
|
ffi (~> 1.0)
|
115
115
|
rb-kqueue (0.2.5)
|
@@ -118,9 +118,9 @@ GEM
|
|
118
118
|
http-cookie (>= 1.0.2, < 2.0)
|
119
119
|
mime-types (>= 1.16, < 4.0)
|
120
120
|
netrc (~> 0.8)
|
121
|
-
rspec-core (3.9.
|
122
|
-
rspec-support (~> 3.9.
|
123
|
-
rspec-expectations (3.9.
|
121
|
+
rspec-core (3.9.2)
|
122
|
+
rspec-support (~> 3.9.3)
|
123
|
+
rspec-expectations (3.9.2)
|
124
124
|
diff-lcs (>= 1.2.0, < 2.0)
|
125
125
|
rspec-support (~> 3.9.0)
|
126
126
|
rspec-its (1.3.0)
|
@@ -129,23 +129,23 @@ GEM
|
|
129
129
|
rspec-mocks (3.9.1)
|
130
130
|
diff-lcs (>= 1.2.0, < 2.0)
|
131
131
|
rspec-support (~> 3.9.0)
|
132
|
-
rspec-support (3.9.
|
132
|
+
rspec-support (3.9.3)
|
133
133
|
ruby_dep (1.3.1)
|
134
134
|
rubyntlm (0.6.2)
|
135
135
|
rubyzip (1.2.4)
|
136
136
|
simplecov (0.18.5)
|
137
137
|
docile (~> 1.1)
|
138
138
|
simplecov-html (~> 0.11)
|
139
|
-
simplecov-html (0.12.
|
139
|
+
simplecov-html (0.12.2)
|
140
140
|
sync (0.5.0)
|
141
141
|
term-ansicolor (1.7.1)
|
142
142
|
tins (~> 1.0)
|
143
143
|
thor (1.0.1)
|
144
|
-
tins (1.
|
144
|
+
tins (1.25.0)
|
145
145
|
sync
|
146
146
|
unf (0.1.4)
|
147
147
|
unf_ext
|
148
|
-
unf_ext (0.0.7.
|
148
|
+
unf_ext (0.0.7.7)
|
149
149
|
vagrant_cloud (2.0.3)
|
150
150
|
rest-client (~> 2.0.2)
|
151
151
|
wdm (0.1.1)
|
@@ -174,7 +174,7 @@ PLATFORMS
|
|
174
174
|
DEPENDENCIES
|
175
175
|
coveralls
|
176
176
|
pry
|
177
|
-
rake (~>
|
177
|
+
rake (~> 13.0, >= 10.4)
|
178
178
|
rspec-core
|
179
179
|
rspec-expectations
|
180
180
|
rspec-its
|
@@ -184,4 +184,4 @@ DEPENDENCIES
|
|
184
184
|
vagrant-cosmic!
|
185
185
|
|
186
186
|
BUNDLED WITH
|
187
|
-
1.
|
187
|
+
2.1.4
|
data/README.md
CHANGED
@@ -101,9 +101,10 @@ to update UUIDs in your Vagrantfile. If both are specified, the id parameter tak
|
|
101
101
|
* `scheme` - Cosmic API scheme _(defaults: https (thanks to the resolution order in fog))_
|
102
102
|
* `api_key` - The API key for accessing Cosmic
|
103
103
|
* `secret_key` - The secret key for accessing Cosmic
|
104
|
-
* `
|
105
|
-
|
104
|
+
* `affinity_group_id` - An affinity group uuid or array of uuid(s) to add the instance to
|
105
|
+
* `affinity_group_name` - An affinity group name or array of name(s) to add the instance to
|
106
106
|
* `domain_id` - Domain id to launch the instance into
|
107
|
+
* `instance_ready_timeout` - The number of seconds to wait for the instance to become "ready" in Cosmic. Defaults to 120 seconds.
|
107
108
|
* `network_id` - Network uuid(s) that the instance should use
|
108
109
|
* `network_id` is single value (e.g. `"AAAA"`) or multiple values (e.g. `["AAAA", "BBBB"]`)
|
109
110
|
* `network_name` - Network name(s) that the instance should use
|
@@ -82,7 +82,22 @@ module VagrantPlugins
|
|
82
82
|
|
83
83
|
def sanitize_domain_config
|
84
84
|
# Accept a single entry as input, convert it to array
|
85
|
-
@domain_config.pf_trusted_networks =
|
85
|
+
@domain_config.pf_trusted_networks = Array(@domain_config.pf_trusted_networks) if @domain_config.pf_trusted_networks
|
86
|
+
|
87
|
+
if @domain_config.affinity_group_id.nil?
|
88
|
+
# Use names if ids are not present
|
89
|
+
@domain_config.affinity_group_id = []
|
90
|
+
|
91
|
+
if @domain_config.affinity_group_name.nil?
|
92
|
+
@domain_config.affinity_group_name = []
|
93
|
+
else
|
94
|
+
@domain_config.affinity_group_name = Array(@domain_config.affinity_group_name)
|
95
|
+
end
|
96
|
+
else
|
97
|
+
# Use ids if present
|
98
|
+
@domain_config.affinity_group_id = Array(@domain_config.affinity_group_id)
|
99
|
+
@domain_config.affinity_group_name = []
|
100
|
+
end
|
86
101
|
|
87
102
|
if @domain_config.network_id.nil?
|
88
103
|
# Use names if ids are not present
|
@@ -101,6 +116,7 @@ module VagrantPlugins
|
|
101
116
|
end
|
102
117
|
|
103
118
|
def initialize_parameters
|
119
|
+
@affinity_groups = CosmicResource.create_list(@domain_config.affinity_group_id, @domain_config.affinity_group_name, 'affinity_group')
|
104
120
|
@zone = CosmicResource.new(@domain_config.zone_id, @domain_config.zone_name, 'zone')
|
105
121
|
@networks = CosmicResource.create_list(@domain_config.network_id, @domain_config.network_name, 'network')
|
106
122
|
@service_offering = CosmicResource.new(@domain_config.service_offering_id, @domain_config.service_offering_name, 'service_offering')
|
@@ -116,6 +132,9 @@ module VagrantPlugins
|
|
116
132
|
@resource_service.sync_resource(@disk_offering, {listall: true, name: @disk_offering.name})
|
117
133
|
@resource_service.sync_resource(@template, {zoneid: @zone.id, templatefilter: 'executable', listall: true, name: @template.name})
|
118
134
|
@resource_service.sync_resource(@pf_ip_address)
|
135
|
+
@affinity_groups.each do |affinity_group|
|
136
|
+
@resource_service.sync_resource(affinity_group)
|
137
|
+
end
|
119
138
|
rescue CosmicResourceNotFound => e
|
120
139
|
@env[:ui].error(e.message)
|
121
140
|
exit(false)
|
@@ -154,6 +173,9 @@ module VagrantPlugins
|
|
154
173
|
# Launch!
|
155
174
|
@env[:ui].info(I18n.t('vagrant_cosmic.launching_instance'))
|
156
175
|
@env[:ui].info(" -- Display Name: #{@domain_config.display_name}")
|
176
|
+
@affinity_groups.each do |affinity_group|
|
177
|
+
@env[:ui].info(" -- Affinity group: #{affinity_group.name} (#{affinity_group.id})")
|
178
|
+
end
|
157
179
|
@env[:ui].info(" -- Group: #{@domain_config.group}") if @domain_config.group
|
158
180
|
@env[:ui].info(" -- Service offering: #{@service_offering.name} (#{@service_offering.id})")
|
159
181
|
@env[:ui].info(" -- Disk offering: #{@disk_offering.name} (#{@disk_offering.id})") unless @disk_offering.id.nil?
|
@@ -200,6 +222,10 @@ module VagrantPlugins
|
|
200
222
|
:image_id => @template.id
|
201
223
|
}
|
202
224
|
|
225
|
+
unless @affinity_groups.empty?
|
226
|
+
ags = @affinity_groups.map(&:id).compact.join(",")
|
227
|
+
options['affinity_group_ids'] = ags unless ags.empty?
|
228
|
+
end
|
203
229
|
unless @networks.empty?
|
204
230
|
nets = @networks.map(&:id).compact.join(",")
|
205
231
|
options['network_ids'] = nets unless nets.empty?
|
@@ -3,23 +3,48 @@ require "vagrant"
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module Cosmic
|
5
5
|
class Config < Vagrant.plugin("2", :config)
|
6
|
-
INSTANCE_VAR_DEFAULT_NIL = %w(
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
INSTANCE_VAR_DEFAULT_NIL = %w(affinity_group_id
|
7
|
+
affinity_group_name
|
8
|
+
display_name
|
9
|
+
domain_id
|
10
|
+
group
|
11
|
+
host
|
12
|
+
keypair
|
13
|
+
name
|
14
|
+
network_id
|
15
|
+
network_name
|
16
|
+
path
|
17
|
+
pf_ip_address
|
18
|
+
pf_ip_address_id
|
19
|
+
pf_private_port
|
20
|
+
pf_public_port
|
21
|
+
pf_public_rdp_port
|
22
|
+
pf_trusted_networks
|
23
|
+
port
|
24
|
+
private_ip_address
|
25
|
+
project_id
|
26
|
+
service_offering_id
|
27
|
+
service_offering_name
|
28
|
+
ssh_key
|
29
|
+
ssh_network_id
|
30
|
+
ssh_network_name
|
31
|
+
ssh_user
|
32
|
+
template_id
|
33
|
+
template_name
|
34
|
+
user_data
|
35
|
+
vm_password
|
36
|
+
vm_user
|
37
|
+
zone_id
|
38
|
+
zone_name).freeze
|
10
39
|
INSTANCE_VAR_DEFAULT_EMPTY_ARRAY = %w(static_nat port_forwarding_rules firewall_rules).freeze
|
11
40
|
|
41
|
+
### API settings
|
42
|
+
|
12
43
|
# Cosmic API host.
|
13
44
|
#
|
14
45
|
# @return [String]
|
15
46
|
attr_accessor :host
|
16
47
|
|
17
|
-
# Hostname for the machine instance
|
18
|
-
# This will be passed through to the api.
|
19
|
-
#
|
20
|
-
# @return [String]
|
21
|
-
attr_accessor :name
|
22
|
-
|
23
48
|
# Cosmic API path.
|
24
49
|
#
|
25
50
|
# @return [String]
|
@@ -45,15 +70,63 @@ module VagrantPlugins
|
|
45
70
|
# @return [String]
|
46
71
|
attr_accessor :secret_key
|
47
72
|
|
73
|
+
### Instance settings
|
74
|
+
|
75
|
+
# Hostname for the machine instance
|
76
|
+
# This will be passed through to the api.
|
77
|
+
#
|
78
|
+
# @return [String]
|
79
|
+
attr_accessor :name
|
80
|
+
|
81
|
+
# Affinity group ID(s) the instance should be applied to
|
82
|
+
#
|
83
|
+
# @return [String]
|
84
|
+
attr_accessor :affinity_group_id
|
85
|
+
|
86
|
+
# Affinity group name(s) the instance should be applied to
|
87
|
+
#
|
88
|
+
# @return [String]
|
89
|
+
attr_accessor :affinity_group_name
|
90
|
+
|
91
|
+
# Disk offering uuid to use for the instance
|
92
|
+
#
|
93
|
+
# @return [String]
|
94
|
+
attr_accessor :disk_offering_id
|
95
|
+
|
96
|
+
# Disk offering name to use for the instance
|
97
|
+
#
|
98
|
+
# @return [String]
|
99
|
+
attr_accessor :disk_offering_name
|
100
|
+
|
101
|
+
# display name for the instance
|
102
|
+
#
|
103
|
+
# @return [String]
|
104
|
+
attr_accessor :display_name
|
105
|
+
|
106
|
+
# Domain id to launch the instance into.
|
107
|
+
#
|
108
|
+
# @return [String]
|
109
|
+
attr_accessor :domain_id
|
110
|
+
|
111
|
+
# flag to enable/disable expunge vm on destroy
|
112
|
+
#
|
113
|
+
# @return [Boolean]
|
114
|
+
attr_accessor :expunge_on_destroy
|
115
|
+
|
116
|
+
# group for the instance
|
117
|
+
#
|
118
|
+
# @return [String]
|
119
|
+
attr_accessor :group
|
120
|
+
|
48
121
|
# The timeout to wait for an instance to become ready.
|
49
122
|
#
|
50
123
|
# @return [Fixnum]
|
51
124
|
attr_accessor :instance_ready_timeout
|
52
125
|
|
53
|
-
#
|
126
|
+
# The name of the keypair to use.
|
54
127
|
#
|
55
128
|
# @return [String]
|
56
|
-
attr_accessor :
|
129
|
+
attr_accessor :keypair
|
57
130
|
|
58
131
|
# Network uuid(s) that the instance should use
|
59
132
|
#
|
@@ -70,6 +143,11 @@ module VagrantPlugins
|
|
70
143
|
# @return [String]
|
71
144
|
attr_accessor :network_type
|
72
145
|
|
146
|
+
# Private ip for the instance
|
147
|
+
#
|
148
|
+
# @return [String]
|
149
|
+
attr_accessor :private_ip_address
|
150
|
+
|
73
151
|
# Project uuid that the instance should belong to
|
74
152
|
#
|
75
153
|
# @return [String]
|
@@ -85,15 +163,30 @@ module VagrantPlugins
|
|
85
163
|
# @return [String]
|
86
164
|
attr_accessor :service_offering_name
|
87
165
|
|
88
|
-
#
|
166
|
+
# The key to be used when loging in to the vm via ssh
|
89
167
|
#
|
90
168
|
# @return [String]
|
91
|
-
attr_accessor :
|
169
|
+
attr_accessor :ssh_key
|
92
170
|
|
93
|
-
#
|
171
|
+
# The network_id to be used when loging in to the vm via ssh
|
94
172
|
#
|
95
173
|
# @return [String]
|
96
|
-
attr_accessor :
|
174
|
+
attr_accessor :ssh_network_id
|
175
|
+
|
176
|
+
# The network_name to be used when loging in to the vm via ssh
|
177
|
+
#
|
178
|
+
# @return [String]
|
179
|
+
attr_accessor :ssh_network_name
|
180
|
+
|
181
|
+
# The username to be used when loging in to the vm via ssh
|
182
|
+
#
|
183
|
+
# @return [String]
|
184
|
+
attr_accessor :ssh_user
|
185
|
+
|
186
|
+
# Paramters for Static NAT
|
187
|
+
#
|
188
|
+
# @return [String]
|
189
|
+
attr_accessor :static_nat
|
97
190
|
|
98
191
|
# Template uuid to use for the instance
|
99
192
|
#
|
@@ -105,6 +198,21 @@ module VagrantPlugins
|
|
105
198
|
# @return [String]
|
106
199
|
attr_accessor :template_name
|
107
200
|
|
201
|
+
# The user data string
|
202
|
+
#
|
203
|
+
# @return [String]
|
204
|
+
attr_accessor :user_data
|
205
|
+
|
206
|
+
# The username to be used when loging in to the vm
|
207
|
+
#
|
208
|
+
# @return [String]
|
209
|
+
attr_accessor :vm_password
|
210
|
+
|
211
|
+
# The username to be used when loging in to the vm
|
212
|
+
#
|
213
|
+
# @return [String]
|
214
|
+
attr_accessor :vm_user
|
215
|
+
|
108
216
|
# Zone uuid to launch the instance into. If nil, it will
|
109
217
|
# launch in default project.
|
110
218
|
#
|
@@ -117,15 +225,20 @@ module VagrantPlugins
|
|
117
225
|
# @return [String]
|
118
226
|
attr_accessor :zone_name
|
119
227
|
|
120
|
-
|
228
|
+
### Firewall settings
|
229
|
+
|
230
|
+
# comma separated list of firewall rules
|
231
|
+
# (hash with rule parameters)
|
121
232
|
#
|
122
|
-
# @return [
|
123
|
-
attr_accessor :
|
233
|
+
# @return [Array]
|
234
|
+
attr_accessor :firewall_rules
|
124
235
|
|
125
|
-
#
|
236
|
+
# flag to enable/disable automatic open firewall rule
|
126
237
|
#
|
127
|
-
# @return [
|
128
|
-
attr_accessor :
|
238
|
+
# @return [Boolean]
|
239
|
+
attr_accessor :pf_open_firewall
|
240
|
+
|
241
|
+
### Port forward settings
|
129
242
|
|
130
243
|
# IP address id to use for port forwarding rule
|
131
244
|
#
|
@@ -162,11 +275,6 @@ module VagrantPlugins
|
|
162
275
|
# @return [String]
|
163
276
|
attr_accessor :pf_private_port
|
164
277
|
|
165
|
-
# flag to enable/disable automatic open firewall rule
|
166
|
-
#
|
167
|
-
# @return [Boolean]
|
168
|
-
attr_accessor :pf_open_firewall
|
169
|
-
|
170
278
|
# CIDR List string of trusted networks
|
171
279
|
#
|
172
280
|
# @return [String]
|
@@ -178,67 +286,6 @@ module VagrantPlugins
|
|
178
286
|
# @return [Array]
|
179
287
|
attr_accessor :port_forwarding_rules
|
180
288
|
|
181
|
-
# comma separated list of firewall rules
|
182
|
-
# (hash with rule parameters)
|
183
|
-
#
|
184
|
-
# @return [Array]
|
185
|
-
attr_accessor :firewall_rules
|
186
|
-
|
187
|
-
# display name for the instance
|
188
|
-
#
|
189
|
-
# @return [String]
|
190
|
-
attr_accessor :display_name
|
191
|
-
|
192
|
-
# group for the instance
|
193
|
-
#
|
194
|
-
# @return [String]
|
195
|
-
attr_accessor :group
|
196
|
-
|
197
|
-
# The user data string
|
198
|
-
#
|
199
|
-
# @return [String]
|
200
|
-
attr_accessor :user_data
|
201
|
-
|
202
|
-
# The key to be used when loging in to the vm via ssh
|
203
|
-
#
|
204
|
-
# @return [String]
|
205
|
-
attr_accessor :ssh_key
|
206
|
-
|
207
|
-
# The username to be used when loging in to the vm via ssh
|
208
|
-
#
|
209
|
-
# @return [String]
|
210
|
-
attr_accessor :ssh_user
|
211
|
-
|
212
|
-
# The network_id to be used when loging in to the vm via ssh
|
213
|
-
#
|
214
|
-
# @return [String]
|
215
|
-
attr_accessor :ssh_network_id
|
216
|
-
|
217
|
-
# The network_name to be used when loging in to the vm via ssh
|
218
|
-
#
|
219
|
-
# @return [String]
|
220
|
-
attr_accessor :ssh_network_name
|
221
|
-
|
222
|
-
# The username to be used when loging in to the vm
|
223
|
-
#
|
224
|
-
# @return [String]
|
225
|
-
attr_accessor :vm_user
|
226
|
-
|
227
|
-
# The username to be used when loging in to the vm
|
228
|
-
#
|
229
|
-
# @return [String]
|
230
|
-
attr_accessor :vm_password
|
231
|
-
|
232
|
-
# Private ip for the instance
|
233
|
-
#
|
234
|
-
# @return [String]
|
235
|
-
attr_accessor :private_ip_address
|
236
|
-
|
237
|
-
# flag to enable/disable expunge vm on destroy
|
238
|
-
#
|
239
|
-
# @return [Boolean]
|
240
|
-
attr_accessor :expunge_on_destroy
|
241
|
-
|
242
289
|
def initialize(domain_specific = false)
|
243
290
|
# Initialize groups in bulk, re-use these groups to set defaults in bulk
|
244
291
|
INSTANCE_VAR_DEFAULT_NIL.each do |instance_variable|
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,8 @@ Dir["#{__dir__}/vagrant-cosmic/support/**/*.rb"].each { |f| require f }
|
|
8
8
|
SimpleCov.start
|
9
9
|
Coveralls.wear!
|
10
10
|
|
11
|
+
AFFINITY_GROUP_NAME = 'Affinity Group Name'.freeze
|
12
|
+
AFFINITY_GROUP_ID = 'Affinity Group UUID'.freeze
|
11
13
|
ZONE_NAME = 'Zone Name'.freeze
|
12
14
|
ZONE_ID = 'Zone UUID'.freeze
|
13
15
|
SERVICE_OFFERING_NAME = 'Service Offering Name'.freeze
|
@@ -38,6 +38,20 @@ describe VagrantPlugins::Cosmic::Action::RunInstance do
|
|
38
38
|
}
|
39
39
|
end
|
40
40
|
|
41
|
+
let(:list_affinitygroups_response) do
|
42
|
+
{
|
43
|
+
'listaffinitygroupsresponse' => {
|
44
|
+
'count' => 1,
|
45
|
+
'affinitygroup' => [
|
46
|
+
{
|
47
|
+
'id' => AFFINITY_GROUP_ID,
|
48
|
+
'name' => AFFINITY_GROUP_NAME,
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
41
55
|
let(:list_public_ip_addresses_response) do
|
42
56
|
{
|
43
57
|
'listpublicipaddressesresponse' => {
|
@@ -325,6 +339,8 @@ describe VagrantPlugins::Cosmic::Action::RunInstance do
|
|
325
339
|
let(:pf_trusted_networks) { nil }
|
326
340
|
let(:pf_public_port_randomrange) { { start: 49_152, end: 65_535 } }
|
327
341
|
let(:pf_open_firewall) { true }
|
342
|
+
let(:affinity_group_id) { nil }
|
343
|
+
let(:affinity_group_name) { nil }
|
328
344
|
let(:disk_offering_name) { nil }
|
329
345
|
|
330
346
|
let(:provider_config) do
|
@@ -341,6 +357,8 @@ describe VagrantPlugins::Cosmic::Action::RunInstance do
|
|
341
357
|
cfg.pf_open_firewall = pf_open_firewall
|
342
358
|
cfg.ssh_key = ssh_key
|
343
359
|
cfg.disk_offering_name = disk_offering_name
|
360
|
+
cfg.affinity_group_id = affinity_group_id
|
361
|
+
cfg.affinity_group_name = affinity_group_name
|
344
362
|
end
|
345
363
|
config.finalize!
|
346
364
|
config.get_domain_config(:cosmic)
|
@@ -391,6 +409,36 @@ describe VagrantPlugins::Cosmic::Action::RunInstance do
|
|
391
409
|
end
|
392
410
|
end
|
393
411
|
|
412
|
+
context 'with affinity group id' do
|
413
|
+
let(:affinity_group_id) { AFFINITY_GROUP_ID }
|
414
|
+
let(:create_servers_parameters) { super().merge('affinity_group_ids' => AFFINITY_GROUP_ID) }
|
415
|
+
|
416
|
+
before(:each) do
|
417
|
+
expect(cosmic_compute).to receive(:send)
|
418
|
+
.with(:list_affinity_groups, {"id"=>"Affinity Group UUID"})
|
419
|
+
.and_return(list_affinitygroups_response)
|
420
|
+
end
|
421
|
+
|
422
|
+
it 'starts a vm' do
|
423
|
+
should eq true
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
context 'with affinity group name' do
|
428
|
+
let(:affinity_group_name) { AFFINITY_GROUP_NAME }
|
429
|
+
let(:create_servers_parameters) { super().merge('affinity_group_ids' => AFFINITY_GROUP_ID) }
|
430
|
+
|
431
|
+
before(:each) do
|
432
|
+
expect(cosmic_compute).to receive(:send)
|
433
|
+
.with(:list_affinity_groups, {})
|
434
|
+
.and_return(list_affinitygroups_response)
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'starts a vm' do
|
438
|
+
should eq true
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
394
442
|
context 'with generated password' do
|
395
443
|
before(:each) do
|
396
444
|
expect(server).to receive(:password_enabled).and_return(true)
|
data/test/vagrant.log
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
Bringing machine 'default' up with 'cosmic' provider...
|
2
|
+
==> default: Warning! The Cosmic provider doesn't support any of the Vagrant
|
3
|
+
==> default: high-level network configurations (`config.vm.network`). They
|
4
|
+
==> default: will be silently ignored.
|
5
|
+
==> default: Fetching UUID for zone with name 'BETA-NL2'
|
6
|
+
default: Syncronized resource: zone - aa4493c5-d73f-48be-ba3c-7b6f0549bac1:BETA-NL2
|
7
|
+
==> default: Fetching UUID for service_offering with name 'MCC_v2.2vCPU.4GB.SBP1'
|
8
|
+
default: Syncronized resource: service_offering - f27bb74b-1b6f-4d68-8bac-67db1af81e4d:MCC_v2.2vCPU.4GB.SBP1
|
9
|
+
==> default: Fetching UUID for template with name 'Centos7-x86_64-Hardened-KVM-latest'
|
10
|
+
default: Syncronized resource: template - 931957fa-acdd-464f-82c4-5dfc477b8d04:Centos7-x86_64-Hardened-KVM-latest
|
11
|
+
==> default: Fetching UUID for public_ip_address with ipaddress '31.22.81.114'
|
12
|
+
default: Syncronized resource: public_ip_address - 5cb86fb4-346d-4184-99d3-4117eb1f85f2:31.22.81.114
|
13
|
+
==> default: Fetching UUID for network with name 'SBP_COOKBOOK_TESTING'
|
14
|
+
default: Syncronized resource: network - 35fde2ef-c923-474a-ae90-66e82a15416d:SBP_COOKBOOK_TESTING
|
15
|
+
==> default: No keypair or ssh_key specified to launch your instance with.
|
16
|
+
==> default: Generating a temporary keypair for this instance...
|
17
|
+
==> default: Launching an instance with the following settings...
|
18
|
+
==> default: -- Display Name: shoekstra_test_1590010606
|
19
|
+
==> default: -- Service offering: MCC_v2.2vCPU.4GB.SBP1 (f27bb74b-1b6f-4d68-8bac-67db1af81e4d)
|
20
|
+
==> default: -- Template: Centos7-x86_64-Hardened-KVM-latest (931957fa-acdd-464f-82c4-5dfc477b8d04)
|
21
|
+
==> default: -- Zone: BETA-NL2 (aa4493c5-d73f-48be-ba3c-7b6f0549bac1)
|
22
|
+
==> default: -- Network: SBP_COOKBOOK_TESTING (35fde2ef-c923-474a-ae90-66e82a15416d)
|
23
|
+
==> default: -- Keypair: vagacs_shoekstra_test_1590010606_5745
|
24
|
+
==> default: Waiting for instance to become "ready"...
|
25
|
+
==> default: Password of virtualmachine: H9Qe5uA69VvA
|
26
|
+
==> default: Creating a port forwarding rule for this instance ...
|
27
|
+
==> default: Fetching UUID for public_ip_address with ipaddress '31.22.81.114'
|
28
|
+
default: Syncronized resource: public_ip_address - 5cb86fb4-346d-4184-99d3-4117eb1f85f2:31.22.81.114
|
29
|
+
==> default: -- IP address : 31.22.81.114 (5cb86fb4-346d-4184-99d3-4117eb1f85f2)
|
30
|
+
==> default: -- Protocol : tcp
|
31
|
+
==> default: -- Public port : 52776
|
32
|
+
==> default: -- Private port : 22
|
33
|
+
==> default: -- Open Firewall : false
|
34
|
+
==> default: Creating a firewall rule ...
|
35
|
+
==> default: Fetching ipaddress for public_ip_address with UUID '5cb86fb4-346d-4184-99d3-4117eb1f85f2'
|
36
|
+
default: Syncronized resource: public_ip_address - 5cb86fb4-346d-4184-99d3-4117eb1f85f2:31.22.81.114
|
37
|
+
==> default: -- IP address : 31.22.81.114 (5cb86fb4-346d-4184-99d3-4117eb1f85f2)
|
38
|
+
==> default: -- Protocol : tcp
|
39
|
+
==> default: -- CIDR list : 213.127.72.193/32
|
40
|
+
==> default: -- Start port : 22
|
41
|
+
==> default: -- End port : 22
|
42
|
+
==> default: -- ICMP code :
|
43
|
+
==> default: -- ICMP type :
|
44
|
+
==> default: Waiting for SSH to become available...
|
45
|
+
==> default: Machine is booted and ready for use!
|
data/vagrant-cosmic.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
|
18
18
|
s.add_runtime_dependency 'fog-cosmic', '~> 0.1.0'
|
19
19
|
|
20
|
-
s.add_development_dependency 'rake', '>= 10.4', '~>
|
20
|
+
s.add_development_dependency 'rake', '>= 10.4', '~> 13.0'
|
21
21
|
s.add_development_dependency 'rspec-core', '~> 2.14', '>= 2.14.7'
|
22
22
|
s.add_development_dependency 'rspec-expectations', '~> 2.14', '>= 2.14.4'
|
23
23
|
s.add_development_dependency 'rspec-mocks', '~> 2.14', '>= 2.14.4'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-cosmic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitchell Hashimoto
|
@@ -23,7 +23,7 @@ authors:
|
|
23
23
|
autorequire:
|
24
24
|
bindir: bin
|
25
25
|
cert_chain: []
|
26
|
-
date: 2020-
|
26
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
27
27
|
dependencies:
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: fog-cosmic
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
version: '10.4'
|
49
49
|
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '
|
51
|
+
version: '13.0'
|
52
52
|
type: :development
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
version: '10.4'
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rspec-core
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,6 +190,7 @@ files:
|
|
190
190
|
- spec/vagrant-cosmic/model/cosmic_resource_spec.rb
|
191
191
|
- spec/vagrant-cosmic/service/cosmic_resource_service_spec.rb
|
192
192
|
- spec/vagrant-cosmic/support/be_a_resource.rb
|
193
|
+
- test/vagrant.log
|
193
194
|
- vagrant-cosmic.gemspec
|
194
195
|
- vagrant-cosmic.spec
|
195
196
|
homepage: https://github.com/MissionCriticalCloud/vagrant-cosmic/
|