nifty 0.0.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -12
  3. data/bin/nifty +2 -0
  4. data/config/nifty.yml +18 -0
  5. data/config/templates/image.erb +38 -0
  6. data/config/templates/template.erb +26 -0
  7. data/lib/nifty/backend.rb +55 -0
  8. data/lib/nifty/backends/opennebula.rb +109 -0
  9. data/lib/nifty/backends/utils/opennebula/datastore_handler.rb +36 -0
  10. data/lib/nifty/backends/utils/opennebula/group_handler.rb +23 -0
  11. data/lib/nifty/backends/utils/opennebula/handler.rb +60 -0
  12. data/lib/nifty/backends/utils/opennebula/helper.rb +44 -0
  13. data/lib/nifty/backends/utils/opennebula/image_handler.rb +209 -0
  14. data/lib/nifty/backends/utils/opennebula/template_handler.rb +91 -0
  15. data/lib/nifty/backends/utils/opennebula.rb +9 -0
  16. data/lib/nifty/backends/utils.rb +2 -0
  17. data/lib/nifty/backends.rb +5 -0
  18. data/lib/nifty/command_executioner.rb +202 -0
  19. data/lib/nifty/errors/api_call_timeout_error.rb +1 -0
  20. data/lib/nifty/errors/argument_error.rb +1 -0
  21. data/lib/nifty/errors/backend_error.rb +1 -0
  22. data/lib/nifty/errors/backends/opennebula/authentication_error.rb +1 -0
  23. data/lib/nifty/errors/backends/opennebula/resource_not_found_error.rb +1 -0
  24. data/lib/nifty/errors/backends/opennebula/resource_retrieval_error.rb +1 -0
  25. data/lib/nifty/errors/backends/opennebula/resource_state_error.rb +1 -0
  26. data/lib/nifty/errors/backends/opennebula/stub_error.rb +1 -0
  27. data/lib/nifty/errors/backends/opennebula/user_not_authorized_error.rb +1 -0
  28. data/lib/nifty/errors/backends/opennebula.rb +5 -0
  29. data/lib/nifty/errors/backends/opennebula_error.rb +1 -0
  30. data/lib/nifty/errors/backends.rb +4 -0
  31. data/lib/nifty/errors/command_execution_error.rb +1 -0
  32. data/lib/nifty/errors/event/converter_error.rb +1 -0
  33. data/lib/nifty/errors/event/loader_error.rb +1 -0
  34. data/lib/nifty/errors/event.rb +5 -0
  35. data/lib/nifty/errors/events/event_error.rb +1 -0
  36. data/lib/nifty/errors/events/expiration_event_error.rb +1 -0
  37. data/lib/nifty/errors/events/registration_event_error.rb +1 -0
  38. data/lib/nifty/errors/events.rb +4 -0
  39. data/lib/nifty/errors/standard_error.rb +1 -0
  40. data/lib/nifty/errors/transfer_method_error.rb +1 -0
  41. data/lib/nifty/errors/transfer_methods/destination_not_directory_error.rb +1 -0
  42. data/lib/nifty/errors/transfer_methods/destination_not_writable_error.rb +1 -0
  43. data/lib/nifty/errors/transfer_methods/image_file_not_readable_error.rb +1 -0
  44. data/lib/nifty/errors/transfer_methods.rb +4 -0
  45. data/lib/nifty/errors.rb +10 -0
  46. data/lib/nifty/event/converter.rb +29 -0
  47. data/lib/nifty/event/loader.rb +27 -0
  48. data/lib/nifty/event/processor.rb +96 -0
  49. data/lib/nifty/event.rb +6 -0
  50. data/lib/nifty/events/event.rb +32 -0
  51. data/lib/nifty/events/opennebula/event.rb +23 -0
  52. data/lib/nifty/events/opennebula/expiration_event.rb +32 -0
  53. data/lib/nifty/events/opennebula/metadata_update_event.rb +12 -0
  54. data/lib/nifty/events/opennebula/registration_event.rb +113 -0
  55. data/lib/nifty/events/opennebula/utils/events_common.rb +69 -0
  56. data/lib/nifty/events/opennebula/utils.rb +4 -0
  57. data/lib/nifty/events/opennebula.rb +6 -0
  58. data/lib/nifty/events.rb +5 -0
  59. data/lib/nifty/exit_codes.rb +8 -0
  60. data/lib/nifty/settings.rb +18 -0
  61. data/lib/nifty/transfer_method.rb +69 -0
  62. data/lib/nifty/transfer_methods/opennebula/cp.rb +52 -0
  63. data/lib/nifty/transfer_methods/opennebula/noop.rb +27 -0
  64. data/lib/nifty/transfer_methods/opennebula.rb +4 -0
  65. data/lib/nifty/transfer_methods.rb +4 -0
  66. data/lib/nifty/version.rb +1 -1
  67. data/lib/nifty.rb +20 -2
  68. data/nifty.gemspec +7 -0
  69. data/schema/appliance.json +295 -0
  70. data/templates/image.erb +8 -0
  71. data/templates/template.erb +13 -0
  72. metadata +166 -3
data/nifty.gemspec CHANGED
@@ -24,11 +24,18 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'simplecov', '~> 0.9.0'
25
25
  spec.add_development_dependency 'rubygems-tasks', '~> 0.2.4'
26
26
  spec.add_development_dependency 'rubocop', '~> 0.32'
27
+ spec.add_development_dependency 'pry', '~> 0.10'
28
+ spec.add_development_dependency 'forgery', '~> 0.6'
27
29
 
28
30
  spec.add_runtime_dependency 'settingslogic', '~> 2.0.9'
29
31
  spec.add_runtime_dependency 'thor', '~> 0.19'
30
32
  spec.add_runtime_dependency 'yell', '~> 2.0'
33
+ spec.add_runtime_dependency 'activesupport', '~> 4.2'
31
34
  spec.add_runtime_dependency 'opennebula', '~> 4.12', '>= 4.12.1'
35
+ spec.add_runtime_dependency 'cloud-appliance-descriptor', '~> 0.2'
36
+ spec.add_runtime_dependency 'json-schema', '~> 2.5'
37
+ spec.add_runtime_dependency 'tilt', '~> 2.0'
38
+ spec.add_runtime_dependency 'chronic_duration', '~> 0.10'
32
39
 
33
40
  spec.required_ruby_version = '>= 1.9.3'
34
41
  end
@@ -0,0 +1,295 @@
1
+ {
2
+ "type": "object",
3
+ "oneOf": [
4
+ { "required": ["registration"] },
5
+ { "required": ["metadata_update"] },
6
+ { "required": ["expiration"] }
7
+ ],
8
+ "properties": {
9
+ "registration": {
10
+ "type": "object",
11
+ "properties": {
12
+ "title": {
13
+ "type": "string"
14
+ },
15
+ "description": {
16
+ "type": "string"
17
+ },
18
+ "version": {
19
+ "type": "string"
20
+ },
21
+ "identifier": {
22
+ "type": "string"
23
+ },
24
+ "memory": {
25
+ "type": "integer"
26
+ },
27
+ "cpu": {
28
+ "type": "integer"
29
+ },
30
+ "groups": {
31
+ "type": "array",
32
+ "items": {
33
+ "type": "string"
34
+ },
35
+ "minItems": 1,
36
+ "uniqueItems": true
37
+ },
38
+ "os": {
39
+ "type": "object",
40
+ "properties": {
41
+ "arch": {
42
+ "type": "string",
43
+ "enum": [
44
+ "x86_64",
45
+ "i686"
46
+ ]
47
+ },
48
+ "type": {
49
+ "type": "string"
50
+ },
51
+ "distribution": {
52
+ "type": "string"
53
+ },
54
+ "version": {
55
+ "type": "string"
56
+ }
57
+ },
58
+ "additionalProperties": false
59
+ },
60
+ "disks": {
61
+ "type": "array",
62
+ "items": {
63
+ "type": "object",
64
+ "properties": {
65
+ "type": {
66
+ "type": "string"
67
+ },
68
+ "format": {
69
+ "type": "string"
70
+ },
71
+ "path": {
72
+ "type": "string"
73
+ },
74
+ "device_prefix": {
75
+ "type": "string"
76
+ },
77
+ "target": {
78
+ "type": "string"
79
+ }
80
+ },
81
+ "additionalProperties": false
82
+ },
83
+ "minItems": 1,
84
+ "additionalItems": false
85
+ },
86
+ "attributes": { }
87
+ },
88
+ "required": [
89
+ "version",
90
+ "identifier",
91
+ "disks",
92
+ "groups"
93
+ ],
94
+ "optional": [
95
+ "title",
96
+ "description",
97
+ "memory",
98
+ "cpu",
99
+ "os",
100
+ "attributes"
101
+ ],
102
+ "additionalProperties": false
103
+ },
104
+ "metadata_update": {
105
+ "type": "object",
106
+ "properties": {
107
+ "title": {
108
+ "type": "string"
109
+ },
110
+ "description": {
111
+ "type": "string"
112
+ },
113
+ "version": {
114
+ "type": "string"
115
+ },
116
+ "identifier": {
117
+ "type": "string"
118
+ },
119
+ "memory": {
120
+ "type": "integer"
121
+ },
122
+ "cpu": {
123
+ "type": "integer"
124
+ },
125
+ "groups": {
126
+ "type": "array",
127
+ "items": {
128
+ "type": "string"
129
+ },
130
+ "minItems": 1,
131
+ "uniqueItems": true
132
+ },
133
+ "os": {
134
+ "type": "object",
135
+ "properties": {
136
+ "arch": {
137
+ "type": "string",
138
+ "enum": [
139
+ "x86_64",
140
+ "i686"
141
+ ]
142
+ },
143
+ "type": {
144
+ "type": "string"
145
+ },
146
+ "distribution": {
147
+ "type": "string"
148
+ },
149
+ "version": {
150
+ "type": "string"
151
+ }
152
+ },
153
+ "additionalProperties": false
154
+ },
155
+ "disks": {
156
+ "type": "array",
157
+ "items": {
158
+ "type": "object",
159
+ "properties": {
160
+ "type": {
161
+ "type": "string"
162
+ },
163
+ "format": {
164
+ "type": "string"
165
+ },
166
+ "path": {
167
+ "type": "string"
168
+ },
169
+ "device_prefix": {
170
+ "type": "string"
171
+ },
172
+ "target": {
173
+ "type": "string"
174
+ }
175
+ },
176
+ "additionalProperties": false
177
+ },
178
+ "minItems": 1,
179
+ "additionalItems": false
180
+ },
181
+ "attributes": { }
182
+ },
183
+ "required": [
184
+ "version",
185
+ "identifier",
186
+ "attributes"
187
+ ],
188
+ "optional": [
189
+ "title",
190
+ "description",
191
+ "memory",
192
+ "cpu",
193
+ "groups",
194
+ "os",
195
+ "disks"
196
+ ],
197
+ "additionalProperties": false
198
+ },
199
+ "expiration": {
200
+ "type": "object",
201
+ "properties": {
202
+ "title": {
203
+ "type": "string"
204
+ },
205
+ "description": {
206
+ "type": "string"
207
+ },
208
+ "version": {
209
+ "type": "string"
210
+ },
211
+ "identifier": {
212
+ "type": "string"
213
+ },
214
+ "memory": {
215
+ "type": "integer"
216
+ },
217
+ "cpu": {
218
+ "type": "integer"
219
+ },
220
+ "groups": {
221
+ "type": "array",
222
+ "items": {
223
+ "type": "string"
224
+ },
225
+ "minItems": 1,
226
+ "uniqueItems": true
227
+ },
228
+ "os": {
229
+ "type": "object",
230
+ "properties": {
231
+ "arch": {
232
+ "type": "string",
233
+ "enum": [
234
+ "x86_64",
235
+ "i686"
236
+ ]
237
+ },
238
+ "type": {
239
+ "type": "string"
240
+ },
241
+ "distribution": {
242
+ "type": "string"
243
+ },
244
+ "version": {
245
+ "type": "string"
246
+ }
247
+ },
248
+ "additionalProperties": false
249
+ },
250
+ "disks": {
251
+ "type": "array",
252
+ "items": {
253
+ "type": "object",
254
+ "properties": {
255
+ "type": {
256
+ "type": "string"
257
+ },
258
+ "format": {
259
+ "type": "string"
260
+ },
261
+ "path": {
262
+ "type": "string"
263
+ },
264
+ "device_prefix": {
265
+ "type": "string"
266
+ },
267
+ "target": {
268
+ "type": "string"
269
+ }
270
+ },
271
+ "additionalProperties": false
272
+ },
273
+ "minItems": 1,
274
+ "additionalItems": false
275
+ },
276
+ "attributes": { }
277
+ },
278
+ "required": [
279
+ "version",
280
+ "identifier"
281
+ ],
282
+ "optional": [
283
+ "title",
284
+ "description",
285
+ "memory",
286
+ "cpu",
287
+ "groups",
288
+ "os",
289
+ "disks",
290
+ "attributes"
291
+ ],
292
+ "additionalProperties": false
293
+ }
294
+ }
295
+ }
@@ -0,0 +1,8 @@
1
+
2
+ NIFTY_ID = "<%= name %>"
3
+ NIFTY_VERSION = "<%= Nifty::VERSION %>"
4
+ NIFTY_APPLIANCE_ID = "<%= appliance.identifier %>"
5
+ NIFTY_APPLIANCE_VERSION = "<%= appliance.version %>"
6
+ NIFTY_APPLIANCE_TILE = "<%= appliance.title %>"
7
+ NIFTY_APPLIANCE_DESCRIPTION = "<%= appliance.description %>"
8
+ NIFTY_APPLIANCE_GROUPS = "<%= appliance.groups.join(',') %>"
@@ -0,0 +1,13 @@
1
+
2
+ NIFTY_ID = "<%= name %>"
3
+ NIFTY_VERSION = "<%= Nifty::VERSION %>"
4
+ NIFTY_APPLIANCE_ID = "<%= appliance.identifier %>"
5
+ NIFTY_APPLIANCE_VERSION = "<%= appliance.version %>"
6
+ NIFTY_APPLIANCE_TILE = "<%= appliance.title %>"
7
+ NIFTY_APPLIANCE_DESCRIPTION = "<%= appliance.description %>"
8
+ NIFTY_APPLIANCE_GROUPS = "<%= appliance.groups.join(',') %>"
9
+
10
+ NIFTY_APPLIANCE_OS_ARCH = "<%= appliance.os.arch %>"
11
+ NIFTY_APPLIANCE_OS_TYPE = "<%= appliance.os.type %>"
12
+ NIFTY_APPLIANCE_OS_DISTRIBUTION = "<%= appliance.os.distribution %>"
13
+ NIFTY_APPLIANCE_OS_VERSION = "<%= appliance.os.version %>"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nifty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Kimle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.32'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: forgery
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.6'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.6'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: settingslogic
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +164,20 @@ dependencies:
136
164
  - - "~>"
137
165
  - !ruby/object:Gem::Version
138
166
  version: '2.0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: activesupport
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '4.2'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '4.2'
139
181
  - !ruby/object:Gem::Dependency
140
182
  name: opennebula
141
183
  requirement: !ruby/object:Gem::Requirement
@@ -156,6 +198,62 @@ dependencies:
156
198
  - - ">="
157
199
  - !ruby/object:Gem::Version
158
200
  version: 4.12.1
201
+ - !ruby/object:Gem::Dependency
202
+ name: cloud-appliance-descriptor
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: '0.2'
208
+ type: :runtime
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - "~>"
213
+ - !ruby/object:Gem::Version
214
+ version: '0.2'
215
+ - !ruby/object:Gem::Dependency
216
+ name: json-schema
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: '2.5'
222
+ type: :runtime
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: '2.5'
229
+ - !ruby/object:Gem::Dependency
230
+ name: tilt
231
+ requirement: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - "~>"
234
+ - !ruby/object:Gem::Version
235
+ version: '2.0'
236
+ type: :runtime
237
+ prerelease: false
238
+ version_requirements: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - "~>"
241
+ - !ruby/object:Gem::Version
242
+ version: '2.0'
243
+ - !ruby/object:Gem::Dependency
244
+ name: chronic_duration
245
+ requirement: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - "~>"
248
+ - !ruby/object:Gem::Version
249
+ version: '0.10'
250
+ type: :runtime
251
+ prerelease: false
252
+ version_requirements: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - "~>"
255
+ - !ruby/object:Gem::Version
256
+ version: '0.10'
159
257
  description: A tool for uploading and registering cloud appliances in OpenNebula.
160
258
  email:
161
259
  - kimle.michal@gmail.com
@@ -173,9 +271,74 @@ files:
173
271
  - README.md
174
272
  - Rakefile
175
273
  - bin/nifty
274
+ - config/nifty.yml
275
+ - config/templates/image.erb
276
+ - config/templates/template.erb
176
277
  - lib/nifty.rb
278
+ - lib/nifty/backend.rb
279
+ - lib/nifty/backends.rb
280
+ - lib/nifty/backends/opennebula.rb
281
+ - lib/nifty/backends/utils.rb
282
+ - lib/nifty/backends/utils/opennebula.rb
283
+ - lib/nifty/backends/utils/opennebula/datastore_handler.rb
284
+ - lib/nifty/backends/utils/opennebula/group_handler.rb
285
+ - lib/nifty/backends/utils/opennebula/handler.rb
286
+ - lib/nifty/backends/utils/opennebula/helper.rb
287
+ - lib/nifty/backends/utils/opennebula/image_handler.rb
288
+ - lib/nifty/backends/utils/opennebula/template_handler.rb
289
+ - lib/nifty/command_executioner.rb
290
+ - lib/nifty/errors.rb
291
+ - lib/nifty/errors/api_call_timeout_error.rb
292
+ - lib/nifty/errors/argument_error.rb
293
+ - lib/nifty/errors/backend_error.rb
294
+ - lib/nifty/errors/backends.rb
295
+ - lib/nifty/errors/backends/opennebula.rb
296
+ - lib/nifty/errors/backends/opennebula/authentication_error.rb
297
+ - lib/nifty/errors/backends/opennebula/resource_not_found_error.rb
298
+ - lib/nifty/errors/backends/opennebula/resource_retrieval_error.rb
299
+ - lib/nifty/errors/backends/opennebula/resource_state_error.rb
300
+ - lib/nifty/errors/backends/opennebula/stub_error.rb
301
+ - lib/nifty/errors/backends/opennebula/user_not_authorized_error.rb
302
+ - lib/nifty/errors/backends/opennebula_error.rb
303
+ - lib/nifty/errors/command_execution_error.rb
304
+ - lib/nifty/errors/event.rb
305
+ - lib/nifty/errors/event/converter_error.rb
306
+ - lib/nifty/errors/event/loader_error.rb
307
+ - lib/nifty/errors/events.rb
308
+ - lib/nifty/errors/events/event_error.rb
309
+ - lib/nifty/errors/events/expiration_event_error.rb
310
+ - lib/nifty/errors/events/registration_event_error.rb
311
+ - lib/nifty/errors/standard_error.rb
312
+ - lib/nifty/errors/transfer_method_error.rb
313
+ - lib/nifty/errors/transfer_methods.rb
314
+ - lib/nifty/errors/transfer_methods/destination_not_directory_error.rb
315
+ - lib/nifty/errors/transfer_methods/destination_not_writable_error.rb
316
+ - lib/nifty/errors/transfer_methods/image_file_not_readable_error.rb
317
+ - lib/nifty/event.rb
318
+ - lib/nifty/event/converter.rb
319
+ - lib/nifty/event/loader.rb
320
+ - lib/nifty/event/processor.rb
321
+ - lib/nifty/events.rb
322
+ - lib/nifty/events/event.rb
323
+ - lib/nifty/events/opennebula.rb
324
+ - lib/nifty/events/opennebula/event.rb
325
+ - lib/nifty/events/opennebula/expiration_event.rb
326
+ - lib/nifty/events/opennebula/metadata_update_event.rb
327
+ - lib/nifty/events/opennebula/registration_event.rb
328
+ - lib/nifty/events/opennebula/utils.rb
329
+ - lib/nifty/events/opennebula/utils/events_common.rb
330
+ - lib/nifty/exit_codes.rb
331
+ - lib/nifty/settings.rb
332
+ - lib/nifty/transfer_method.rb
333
+ - lib/nifty/transfer_methods.rb
334
+ - lib/nifty/transfer_methods/opennebula.rb
335
+ - lib/nifty/transfer_methods/opennebula/cp.rb
336
+ - lib/nifty/transfer_methods/opennebula/noop.rb
177
337
  - lib/nifty/version.rb
178
338
  - nifty.gemspec
339
+ - schema/appliance.json
340
+ - templates/image.erb
341
+ - templates/template.erb
179
342
  homepage: https://github.com/Misenko/nifty
180
343
  licenses:
181
344
  - MIT
@@ -196,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
359
  version: '0'
197
360
  requirements: []
198
361
  rubyforge_project:
199
- rubygems_version: 2.4.8
362
+ rubygems_version: 2.4.6
200
363
  signing_key:
201
364
  specification_version: 4
202
365
  summary: A tool for uploading and registering cloud appliances in OpenNebula.