guignol 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +17 -0
- data/lib/guignol/models/instance.rb +13 -4
- data/lib/guignol/version.rb +1 -1
- data/spec/guignol/configuration_spec.rb +1 -1
- data/spec/guignol/instance_spec.rb +6 -0
- data/spec/spec_helper.rb +3 -1
- metadata +152 -157
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -149,6 +149,23 @@ Note that Guignol does not delete volumes when tearing down instances.
|
|
149
149
|
|
150
150
|
|
151
151
|
|
152
|
+
## "User data" boot script
|
153
|
+
|
154
|
+
EC2 instances will run the script passed as `user_data` at boot time, letting you perform one-time setup.
|
155
|
+
|
156
|
+
Guignol parses this setting through ERB, and lets your access the configuration hash.
|
157
|
+
Possible use case:
|
158
|
+
|
159
|
+
# ~/.guignol.yml
|
160
|
+
---
|
161
|
+
hello-world:
|
162
|
+
:uuid: AF123799-3F55-4F0B-8E58-87C67A5977BA
|
163
|
+
:domain: example.com
|
164
|
+
:user_data: |
|
165
|
+
#!/bin/sh
|
166
|
+
echo "<%= name %>.<%= domain %>" > /etc/hostname
|
167
|
+
|
168
|
+
|
152
169
|
## Managing existing instances
|
153
170
|
|
154
171
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'erb'
|
2
2
|
require 'yaml'
|
3
3
|
require 'fog'
|
4
4
|
require 'active_support/core_ext/hash/slice'
|
@@ -6,13 +6,22 @@ require 'guignol'
|
|
6
6
|
require 'guignol/models/base'
|
7
7
|
require 'guignol/models/volume'
|
8
8
|
|
9
|
-
require 'pry'
|
10
|
-
|
11
9
|
module Guignol::Models
|
12
10
|
class Instance < Base
|
13
11
|
class Error < Exception; end
|
14
12
|
|
13
|
+
class HashERB < OpenStruct
|
14
|
+
def parse(data)
|
15
|
+
ERB.new(data).result(binding)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
15
19
|
def initialize(name, options)
|
20
|
+
if options[:user_data]
|
21
|
+
options[:name] = name
|
22
|
+
options[:user_data] = HashERB.new(options).parse(options[:user_data])
|
23
|
+
end
|
24
|
+
|
16
25
|
super
|
17
26
|
subject.username = options[:username] if options[:username] && exists?
|
18
27
|
end
|
@@ -24,7 +33,7 @@ module Guignol::Models
|
|
24
33
|
|
25
34
|
def create
|
26
35
|
log "server already exists" and return self if exist?
|
27
|
-
|
36
|
+
|
28
37
|
create_options = Guignol::DefaultServerOptions.merge options.slice(:image_id, :flavor_id, :key_name, :security_group_ids, :user_data, :username)
|
29
38
|
|
30
39
|
# check for pre-existing volume(s). if any exist, add their AZ to the server's options
|
data/lib/guignol/version.rb
CHANGED
@@ -28,6 +28,12 @@ describe Guignol::Models::Instance do
|
|
28
28
|
it 'should pass with minimal options' do
|
29
29
|
subject
|
30
30
|
end
|
31
|
+
|
32
|
+
it 'parses ERB in user data' do
|
33
|
+
options[:foo] = 'bar'
|
34
|
+
options[:user_data] = "foo=<%= foo %>,<%= name %>"
|
35
|
+
subject.options[:user_data].should == 'foo=bar,foobar'
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,181 +1,185 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: guignol
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 0
|
10
|
-
version: 0.3.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Julien Letessier
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2012-10-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
23
17
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 23
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 0
|
31
|
-
- 0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
32
21
|
version: 1.0.0
|
33
|
-
prerelease: false
|
34
|
-
name: bundler
|
35
22
|
type: :development
|
36
|
-
|
37
|
-
|
38
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
39
33
|
none: false
|
40
|
-
requirements:
|
34
|
+
requirements:
|
41
35
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 31
|
44
|
-
segments:
|
45
|
-
- 2
|
46
|
-
- 4
|
47
|
-
- 0
|
36
|
+
- !ruby/object:Gem::Version
|
48
37
|
version: 2.4.0
|
49
|
-
prerelease: false
|
50
|
-
name: rspec
|
51
38
|
type: :development
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
39
|
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.4.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
64
47
|
name: rake
|
65
|
-
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
69
49
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
- 0
|
76
|
-
version: "0"
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
77
55
|
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
78
63
|
name: pry
|
79
|
-
|
80
|
-
version_requirements: *id004
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
83
65
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
|
89
|
-
- 0
|
90
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
91
71
|
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
92
79
|
name: pry-nav
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
93
86
|
type: :development
|
94
|
-
|
95
|
-
|
96
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: fog
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
|
-
requirements:
|
98
|
+
requirements:
|
99
99
|
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
hash: 15
|
102
|
-
segments:
|
103
|
-
- 1
|
104
|
-
- 6
|
105
|
-
- 0
|
100
|
+
- !ruby/object:Gem::Version
|
106
101
|
version: 1.6.0
|
107
|
-
prerelease: false
|
108
|
-
name: fog
|
109
102
|
type: :runtime
|
110
|
-
|
111
|
-
|
112
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
105
|
none: false
|
114
|
-
requirements:
|
106
|
+
requirements:
|
115
107
|
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
|
119
|
-
- 0
|
120
|
-
- 5
|
121
|
-
- 14
|
122
|
-
version: 0.5.14
|
123
|
-
prerelease: false
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.6.0
|
110
|
+
- !ruby/object:Gem::Dependency
|
124
111
|
name: parallel
|
125
|
-
|
126
|
-
version_requirements: *id007
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
129
113
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
|
135
|
-
- 0
|
136
|
-
version: "0"
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.5.14
|
118
|
+
type: :runtime
|
137
119
|
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.5.14
|
126
|
+
- !ruby/object:Gem::Dependency
|
138
127
|
name: active_support
|
139
|
-
|
140
|
-
version_requirements: *id008
|
141
|
-
- !ruby/object:Gem::Dependency
|
142
|
-
requirement: &id009 !ruby/object:Gem::Requirement
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
143
129
|
none: false
|
144
|
-
requirements:
|
145
|
-
- -
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
|
148
|
-
|
149
|
-
- 0
|
150
|
-
version: "0"
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :runtime
|
151
135
|
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
152
143
|
name: uuidtools
|
153
|
-
|
154
|
-
version_requirements: *id009
|
155
|
-
- !ruby/object:Gem::Dependency
|
156
|
-
requirement: &id010 !ruby/object:Gem::Requirement
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
157
145
|
none: false
|
158
|
-
requirements:
|
159
|
-
- -
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
|
162
|
-
|
163
|
-
- 0
|
164
|
-
version: "0"
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :runtime
|
165
151
|
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
166
159
|
name: thor
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
167
166
|
type: :runtime
|
168
|
-
|
169
|
-
|
170
|
-
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
description: ! "\n Create, start, stop, destroy instances from the command line\n
|
175
|
+
\ based on a YAML description of your instances.\n "
|
176
|
+
email:
|
171
177
|
- julien.letessier@gmail.com
|
172
|
-
executables:
|
178
|
+
executables:
|
173
179
|
- guignol
|
174
180
|
extensions: []
|
175
|
-
|
176
181
|
extra_rdoc_files: []
|
177
|
-
|
178
|
-
files:
|
182
|
+
files:
|
179
183
|
- .gitignore
|
180
184
|
- .rspec
|
181
185
|
- Gemfile
|
@@ -214,43 +218,34 @@ files:
|
|
214
218
|
- spec/spec.opts
|
215
219
|
- spec/spec_helper.rb
|
216
220
|
- tmp/.keepme
|
217
|
-
has_rdoc: true
|
218
221
|
homepage: https://github.com/mezis/guignol
|
219
222
|
licenses: []
|
220
|
-
|
221
223
|
post_install_message:
|
222
224
|
rdoc_options: []
|
223
|
-
|
224
|
-
require_paths:
|
225
|
+
require_paths:
|
225
226
|
- lib
|
226
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
227
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
227
228
|
none: false
|
228
|
-
requirements:
|
229
|
-
- -
|
230
|
-
- !ruby/object:Gem::Version
|
231
|
-
|
232
|
-
segments:
|
229
|
+
requirements:
|
230
|
+
- - ! '>='
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '0'
|
233
|
+
segments:
|
233
234
|
- 0
|
234
|
-
|
235
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
|
+
hash: 2633968983297838480
|
236
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
237
|
none: false
|
237
|
-
requirements:
|
238
|
-
- -
|
239
|
-
- !ruby/object:Gem::Version
|
240
|
-
hash: 23
|
241
|
-
segments:
|
242
|
-
- 1
|
243
|
-
- 3
|
244
|
-
- 6
|
238
|
+
requirements:
|
239
|
+
- - ! '>='
|
240
|
+
- !ruby/object:Gem::Version
|
245
241
|
version: 1.3.6
|
246
242
|
requirements: []
|
247
|
-
|
248
243
|
rubyforge_project:
|
249
|
-
rubygems_version: 1.
|
244
|
+
rubygems_version: 1.8.23
|
250
245
|
signing_key:
|
251
246
|
specification_version: 3
|
252
247
|
summary: Manipulate Amazon EC2 instances
|
253
|
-
test_files:
|
248
|
+
test_files:
|
254
249
|
- spec/guignol/configuration_spec.rb
|
255
250
|
- spec/guignol/instance_spec.rb
|
256
251
|
- spec/guignol/volume_spec.rb
|