guignol 0.3.8 → 0.3.9
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/.ruby-version +1 -1
- data/Gemfile.lock +21 -13
- data/README.md +3 -0
- data/lib/guignol/models/instance.rb +17 -5
- data/lib/guignol/version.rb +1 -1
- data/spec/guignol/instance_spec.rb +12 -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: 3122effa5c76fb24af333186992f6746ec24ce1d
|
4
|
+
data.tar.gz: 871d6fcb768cd9de2aa8319d46a7b0c78c8489cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6697a1414b262ceb5856635b64622f7208d9fde7e91baa77b80e1b92af2e91a56bfbbdbd79ee4085094a99457c1b715d4a97efd370d99ae0511ff20fabfa2e99
|
7
|
+
data.tar.gz: 168039823e8ae50ed47fecfc19a2279a283164d07b56ed45c479d20403a2e2ed9dbdc58026e700e8ed1bc4ec2db77fb3ae988bdb351cdf112efd01380ed66d10
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0-p247
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
guignol (0.3.
|
4
|
+
guignol (0.3.9)
|
5
5
|
activesupport
|
6
6
|
fog (~> 1.12.0)
|
7
7
|
parallel (~> 0.6.2)
|
@@ -11,12 +11,16 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activesupport (
|
15
|
-
i18n (
|
16
|
-
|
14
|
+
activesupport (4.0.0)
|
15
|
+
i18n (~> 0.6, >= 0.6.4)
|
16
|
+
minitest (~> 4.2)
|
17
|
+
multi_json (~> 1.3)
|
18
|
+
thread_safe (~> 0.1)
|
19
|
+
tzinfo (~> 0.3.37)
|
20
|
+
atomic (1.1.10)
|
17
21
|
builder (3.2.2)
|
18
22
|
coderay (1.0.9)
|
19
|
-
diff-lcs (1.2.
|
23
|
+
diff-lcs (1.2.4)
|
20
24
|
excon (0.23.0)
|
21
25
|
fog (1.12.1)
|
22
26
|
builder
|
@@ -29,33 +33,37 @@ GEM
|
|
29
33
|
nokogiri (~> 1.5.0)
|
30
34
|
ruby-hmac
|
31
35
|
formatador (0.2.4)
|
32
|
-
i18n (0.6.
|
36
|
+
i18n (0.6.4)
|
33
37
|
method_source (0.8.1)
|
34
38
|
mime-types (1.23)
|
39
|
+
minitest (4.7.5)
|
35
40
|
multi_json (1.7.7)
|
36
|
-
net-scp (1.1.
|
41
|
+
net-scp (1.1.2)
|
37
42
|
net-ssh (>= 2.6.5)
|
38
|
-
net-ssh (2.6.
|
43
|
+
net-ssh (2.6.8)
|
39
44
|
nokogiri (1.5.10)
|
40
45
|
parallel (0.6.5)
|
41
|
-
pry (0.9.12)
|
46
|
+
pry (0.9.12.2)
|
42
47
|
coderay (~> 1.0.5)
|
43
48
|
method_source (~> 0.8)
|
44
49
|
slop (~> 3.4)
|
45
50
|
pry-nav (0.2.3)
|
46
51
|
pry (~> 0.9.10)
|
47
|
-
rake (10.0
|
52
|
+
rake (10.1.0)
|
48
53
|
rspec (2.13.0)
|
49
54
|
rspec-core (~> 2.13.0)
|
50
55
|
rspec-expectations (~> 2.13.0)
|
51
56
|
rspec-mocks (~> 2.13.0)
|
52
|
-
rspec-core (2.13.
|
57
|
+
rspec-core (2.13.1)
|
53
58
|
rspec-expectations (2.13.0)
|
54
59
|
diff-lcs (>= 1.1.3, < 2.0)
|
55
|
-
rspec-mocks (2.13.
|
60
|
+
rspec-mocks (2.13.1)
|
56
61
|
ruby-hmac (0.4.0)
|
57
|
-
slop (3.4.
|
62
|
+
slop (3.4.5)
|
58
63
|
thor (0.18.1)
|
64
|
+
thread_safe (0.1.0)
|
65
|
+
atomic
|
66
|
+
tzinfo (0.3.37)
|
59
67
|
uuidtools (2.1.4)
|
60
68
|
|
61
69
|
PLATFORMS
|
data/README.md
CHANGED
@@ -126,6 +126,9 @@ Note that Guignol does not delete volumes when tearing down instances.
|
|
126
126
|
- `:region`
|
127
127
|
The EC2 region. Defaults to `eu-west-1`.
|
128
128
|
|
129
|
+
- `:availability_zone`
|
130
|
+
The EC2 availability zone. Defaults to whatever Amazon chooses.
|
131
|
+
|
129
132
|
- `:image_id`
|
130
133
|
The AMI to use when creating this instance. Defaults to whatever Amazon defaults it to.
|
131
134
|
|
@@ -34,10 +34,22 @@ module Guignol::Models
|
|
34
34
|
def create
|
35
35
|
log "server already exists" and return self if exist?
|
36
36
|
|
37
|
-
create_options = Guignol::DefaultServerOptions.merge options.slice(:image_id, :flavor_id, :key_name, :security_group_ids, :user_data, :username)
|
37
|
+
create_options = Guignol::DefaultServerOptions.merge options.slice(:image_id, :flavor_id, :key_name, :security_group_ids, :user_data, :username, :availability_zone)
|
38
38
|
|
39
|
-
# check for pre-existing volume(s). if any exist, add their AZ to the server's options
|
40
39
|
zones = create_options[:volumes].map { |name,volume_options| Volume.new(name, volume_options).availability_zone }.compact.uniq
|
40
|
+
availability_zone = create_options[:availability_zone]
|
41
|
+
|
42
|
+
# check if provided availability_zone is valid
|
43
|
+
if availability_zone
|
44
|
+
unless availability_zone.match(connection.region)
|
45
|
+
raise "availability zone #{availability_zone} is not in the defined region #{connection.region}"
|
46
|
+
end
|
47
|
+
if zones.first && zones.first != availability_zone
|
48
|
+
raise "volume availability zone differs to configured server availability_zone"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# check for pre-existing volume(s). if any exist, add their AZ to the server's options
|
41
53
|
if zones.size > 1
|
42
54
|
raise "pre-existing volumes volumes are in different availability zones"
|
43
55
|
elsif zones.size == 1
|
@@ -119,7 +131,7 @@ module Guignol::Models
|
|
119
131
|
return
|
120
132
|
end
|
121
133
|
log "updating DNS"
|
122
|
-
|
134
|
+
|
123
135
|
unless dns_zone
|
124
136
|
log "DNS zone does not exist"
|
125
137
|
return self
|
@@ -246,7 +258,7 @@ module Guignol::Models
|
|
246
258
|
|
247
259
|
def dns_record
|
248
260
|
dns_zone.records.find { |record| record.name == fqdn }
|
249
|
-
end
|
261
|
+
end
|
250
262
|
|
251
263
|
def dns_record_matches?(record)
|
252
264
|
!!record and record.value.any? { |dns_name| dns_name == subject.dns_name }
|
@@ -263,4 +275,4 @@ module Guignol::Models
|
|
263
275
|
find { |s| s.tags['UUID'] == uuid }
|
264
276
|
end
|
265
277
|
end
|
266
|
-
end
|
278
|
+
end
|
data/lib/guignol/version.rb
CHANGED
@@ -48,6 +48,17 @@ describe Guignol::Models::Instance do
|
|
48
48
|
subject.create
|
49
49
|
end
|
50
50
|
|
51
|
+
it 'does not break when providing an availibity zone' do
|
52
|
+
instance = described_class.new(name, options.merge(:availability_zone => 'eu-west-1c'))
|
53
|
+
expect { instance.create }.to_not raise_error
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'does not allow an availability zone that does not match the region' do
|
57
|
+
instance = described_class.new(name, options.merge(:availability_zone => 'us-west-1a'))
|
58
|
+
expect { instance.create }.to raise_error('availability zone us-west-1a is not in the defined region eu-west-1')
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'requires existing volumes to live in a given availability zone'
|
51
62
|
it 'reuses existing volumes'
|
52
63
|
it 'fails when existing volumes are in different zones'
|
53
64
|
|
@@ -74,4 +85,4 @@ describe Guignol::Models::Instance do
|
|
74
85
|
subject.destroy
|
75
86
|
end
|
76
87
|
end
|
77
|
-
end
|
88
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guignol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Letessier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|