vcap_services_base 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/lib/base/abstract.rb +11 -0
  3. data/lib/base/api/message.rb +31 -0
  4. data/lib/base/asynchronous_service_gateway.rb +529 -0
  5. data/lib/base/backup.rb +206 -0
  6. data/lib/base/barrier.rb +54 -0
  7. data/lib/base/base.rb +159 -0
  8. data/lib/base/base_async_gateway.rb +164 -0
  9. data/lib/base/base_job.rb +5 -0
  10. data/lib/base/catalog_manager_base.rb +67 -0
  11. data/lib/base/catalog_manager_v1.rb +225 -0
  12. data/lib/base/catalog_manager_v2.rb +291 -0
  13. data/lib/base/cloud_controller_services.rb +75 -0
  14. data/lib/base/datamapper_l.rb +148 -0
  15. data/lib/base/gateway.rb +167 -0
  16. data/lib/base/gateway_service_catalog.rb +68 -0
  17. data/lib/base/http_handler.rb +101 -0
  18. data/lib/base/job/async_job.rb +71 -0
  19. data/lib/base/job/config.rb +27 -0
  20. data/lib/base/job/lock.rb +153 -0
  21. data/lib/base/job/package.rb +112 -0
  22. data/lib/base/job/serialization.rb +365 -0
  23. data/lib/base/job/snapshot.rb +354 -0
  24. data/lib/base/node.rb +471 -0
  25. data/lib/base/node_bin.rb +154 -0
  26. data/lib/base/plan.rb +63 -0
  27. data/lib/base/provisioner.rb +1120 -0
  28. data/lib/base/provisioner_v1.rb +125 -0
  29. data/lib/base/provisioner_v2.rb +193 -0
  30. data/lib/base/service.rb +93 -0
  31. data/lib/base/service_advertiser.rb +184 -0
  32. data/lib/base/service_error.rb +122 -0
  33. data/lib/base/service_message.rb +94 -0
  34. data/lib/base/service_plan_change_set.rb +11 -0
  35. data/lib/base/simple_aop.rb +63 -0
  36. data/lib/base/snapshot_v2/snapshot.rb +227 -0
  37. data/lib/base/snapshot_v2/snapshot_client.rb +158 -0
  38. data/lib/base/snapshot_v2/snapshot_job.rb +95 -0
  39. data/lib/base/utils.rb +63 -0
  40. data/lib/base/version.rb +7 -0
  41. data/lib/base/warden/instance_utils.rb +161 -0
  42. data/lib/base/warden/node_utils.rb +205 -0
  43. data/lib/base/warden/service.rb +426 -0
  44. data/lib/base/worker_bin.rb +76 -0
  45. data/lib/vcap_services_base.rb +16 -0
  46. metadata +364 -0
@@ -0,0 +1,76 @@
1
+ # Copyright (c) 2009-2012 VMware, Inc.
2
+ require "rubygems"
3
+ require 'bundler/setup'
4
+ require 'optparse'
5
+ require 'yaml'
6
+ require 'resque'
7
+ require 'steno'
8
+
9
+ require "vcap/common"
10
+
11
+ $LOAD_PATH.unshift File.dirname(__FILE__)
12
+ require "abstract"
13
+ require "job/config"
14
+
15
+ module VCAP
16
+ module Services
17
+ module Base
18
+ end
19
+ end
20
+ end
21
+
22
+ module VCAP::Services::Base
23
+ class WorkerBin
24
+ abstract :default_config_file
25
+
26
+ def start
27
+ config_file = default_config_file
28
+
29
+ OptionParser.new do |opts|
30
+ opts.banner = "Usage: #{$0.split(/\//)[-1]} [options]"
31
+ opts.on("-c", "--config [ARG]", "Configuration File") do |opt|
32
+ config_file = opt
33
+ end
34
+ opts.on("-h", "--help", "Help") do
35
+ puts opts
36
+ exit
37
+ end
38
+ end.parse!
39
+
40
+ begin
41
+ config = YAML.load_file(config_file)
42
+ rescue => e
43
+ puts "Could not read configuration file: #{e}"
44
+ exit
45
+ end
46
+
47
+ required_opts = %w(resque)
48
+ missing_opts = required_opts.select {|o| !config.has_key? o}
49
+ raise ArgumentError, "Missing options: #{missing_opts.join(', ')}" unless missing_opts.empty?
50
+
51
+ logging_config = Steno::Config.from_hash(config["logging"])
52
+ Steno.init(logging_config)
53
+
54
+ redis_config = config["resque"]
55
+ logger = Steno.logger(config["node_id"])
56
+ redis_config = %w(host port password).inject({}){|res, o| res[o.to_sym] = config["resque"][o]; res}
57
+ AsyncJob::Config.redis_config = redis_config
58
+ AsyncJob::Config.logger = logger
59
+
60
+ ENV['WORKER_CONFIG'] = Yajl::Encoder.encode(config)
61
+
62
+ # Use node_id as default queue name if no queues configuration is given
63
+ queues = (config["queues"] || config["node_id"]).split(',')
64
+
65
+ worker = Resque::Worker.new(*queues)
66
+ worker.verbose = config["resque_worker_logging"]
67
+
68
+ pid_file = ENV['PIDFILE']
69
+ raise "worker need PIDFILE env var." unless pid_file
70
+ File.open(pid_file, "w") {|f| f << worker.pid}
71
+
72
+ logger.info("Starting worker: #{worker}")
73
+ worker.work(config["interval"]||5)
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,16 @@
1
+ require 'vcap/common'
2
+ require 'vcap/component'
3
+
4
+ require 'base/gateway'
5
+ require 'base/node_bin'
6
+ require 'base/node'
7
+ require 'base/provisioner'
8
+ require 'base/backup'
9
+ require 'base/service_error'
10
+ require 'base/asynchronous_service_gateway'
11
+ require 'base/datamapper_l'
12
+ require 'base/worker_bin'
13
+ require 'base/base_job'
14
+ require 'base/utils'
15
+ require 'base/warden/service'
16
+ require 'base/warden/node_utils'
metadata ADDED
@@ -0,0 +1,364 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vcap_services_base
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.10
5
+ platform: ruby
6
+ authors:
7
+ - CloudFoundry Services Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nats
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.0.beta.12
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '0.6'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.5.0.beta.12
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.6'
33
+ - !ruby/object:Gem::Dependency
34
+ name: data_mapper
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.2'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.2'
47
+ - !ruby/object:Gem::Dependency
48
+ name: do_sqlite3
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: eventmachine
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: eventmachine_httpserver
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.2.1
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 0.2.1
89
+ - !ruby/object:Gem::Dependency
90
+ name: json
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ - !ruby/object:Gem::Dependency
104
+ name: ruby-hmac
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.4.0
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: 0.4.0
117
+ - !ruby/object:Gem::Dependency
118
+ name: em-http-request
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.0'
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '1.0'
131
+ - !ruby/object:Gem::Dependency
132
+ name: sinatra
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: 1.2.3
138
+ type: :runtime
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: 1.2.3
145
+ - !ruby/object:Gem::Dependency
146
+ name: thin
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: 1.3.1
152
+ - - "<"
153
+ - !ruby/object:Gem::Version
154
+ version: 1.6.0
155
+ type: :runtime
156
+ prerelease: false
157
+ version_requirements: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ version: 1.3.1
162
+ - - "<"
163
+ - !ruby/object:Gem::Version
164
+ version: 1.6.0
165
+ - !ruby/object:Gem::Dependency
166
+ name: vcap_common
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - '='
170
+ - !ruby/object:Gem::Version
171
+ version: 3.0.1
172
+ type: :runtime
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - '='
177
+ - !ruby/object:Gem::Version
178
+ version: 3.0.1
179
+ - !ruby/object:Gem::Dependency
180
+ name: resque
181
+ requirement: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - "~>"
184
+ - !ruby/object:Gem::Version
185
+ version: '1.20'
186
+ type: :runtime
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - "~>"
191
+ - !ruby/object:Gem::Version
192
+ version: '1.20'
193
+ - !ruby/object:Gem::Dependency
194
+ name: resque-status
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ type: :runtime
201
+ prerelease: false
202
+ version_requirements: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ - !ruby/object:Gem::Dependency
208
+ name: curb
209
+ requirement: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - "~>"
212
+ - !ruby/object:Gem::Version
213
+ version: 0.7.16
214
+ type: :runtime
215
+ prerelease: false
216
+ version_requirements: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - "~>"
219
+ - !ruby/object:Gem::Version
220
+ version: 0.7.16
221
+ - !ruby/object:Gem::Dependency
222
+ name: rubyzip
223
+ requirement: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - "~>"
226
+ - !ruby/object:Gem::Version
227
+ version: 0.9.8
228
+ type: :runtime
229
+ prerelease: false
230
+ version_requirements: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - "~>"
233
+ - !ruby/object:Gem::Version
234
+ version: 0.9.8
235
+ - !ruby/object:Gem::Dependency
236
+ name: warden-client
237
+ requirement: !ruby/object:Gem::Requirement
238
+ requirements:
239
+ - - ">="
240
+ - !ruby/object:Gem::Version
241
+ version: '0'
242
+ type: :runtime
243
+ prerelease: false
244
+ version_requirements: !ruby/object:Gem::Requirement
245
+ requirements:
246
+ - - ">="
247
+ - !ruby/object:Gem::Version
248
+ version: '0'
249
+ - !ruby/object:Gem::Dependency
250
+ name: warden-protocol
251
+ requirement: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ version: '0'
256
+ type: :runtime
257
+ prerelease: false
258
+ version_requirements: !ruby/object:Gem::Requirement
259
+ requirements:
260
+ - - ">="
261
+ - !ruby/object:Gem::Version
262
+ version: '0'
263
+ - !ruby/object:Gem::Dependency
264
+ name: cf-uaa-lib
265
+ requirement: !ruby/object:Gem::Requirement
266
+ requirements:
267
+ - - ">="
268
+ - !ruby/object:Gem::Version
269
+ version: '0'
270
+ type: :runtime
271
+ prerelease: false
272
+ version_requirements: !ruby/object:Gem::Requirement
273
+ requirements:
274
+ - - ">="
275
+ - !ruby/object:Gem::Version
276
+ version: '0'
277
+ - !ruby/object:Gem::Dependency
278
+ name: steno
279
+ requirement: !ruby/object:Gem::Requirement
280
+ requirements:
281
+ - - ">="
282
+ - !ruby/object:Gem::Version
283
+ version: '0'
284
+ type: :runtime
285
+ prerelease: false
286
+ version_requirements: !ruby/object:Gem::Requirement
287
+ requirements:
288
+ - - ">="
289
+ - !ruby/object:Gem::Version
290
+ version: '0'
291
+ description: Base class/module to develop CloudFoundry service
292
+ email: cfpi-services@googlegroups.com
293
+ executables: []
294
+ extensions: []
295
+ extra_rdoc_files: []
296
+ files:
297
+ - lib/base/abstract.rb
298
+ - lib/base/api/message.rb
299
+ - lib/base/asynchronous_service_gateway.rb
300
+ - lib/base/backup.rb
301
+ - lib/base/barrier.rb
302
+ - lib/base/base.rb
303
+ - lib/base/base_async_gateway.rb
304
+ - lib/base/base_job.rb
305
+ - lib/base/catalog_manager_base.rb
306
+ - lib/base/catalog_manager_v1.rb
307
+ - lib/base/catalog_manager_v2.rb
308
+ - lib/base/cloud_controller_services.rb
309
+ - lib/base/datamapper_l.rb
310
+ - lib/base/gateway.rb
311
+ - lib/base/gateway_service_catalog.rb
312
+ - lib/base/http_handler.rb
313
+ - lib/base/job/async_job.rb
314
+ - lib/base/job/config.rb
315
+ - lib/base/job/lock.rb
316
+ - lib/base/job/package.rb
317
+ - lib/base/job/serialization.rb
318
+ - lib/base/job/snapshot.rb
319
+ - lib/base/node.rb
320
+ - lib/base/node_bin.rb
321
+ - lib/base/plan.rb
322
+ - lib/base/provisioner.rb
323
+ - lib/base/provisioner_v1.rb
324
+ - lib/base/provisioner_v2.rb
325
+ - lib/base/service.rb
326
+ - lib/base/service_advertiser.rb
327
+ - lib/base/service_error.rb
328
+ - lib/base/service_message.rb
329
+ - lib/base/service_plan_change_set.rb
330
+ - lib/base/simple_aop.rb
331
+ - lib/base/snapshot_v2/snapshot.rb
332
+ - lib/base/snapshot_v2/snapshot_client.rb
333
+ - lib/base/snapshot_v2/snapshot_job.rb
334
+ - lib/base/utils.rb
335
+ - lib/base/version.rb
336
+ - lib/base/warden/instance_utils.rb
337
+ - lib/base/warden/node_utils.rb
338
+ - lib/base/warden/service.rb
339
+ - lib/base/worker_bin.rb
340
+ - lib/vcap_services_base.rb
341
+ homepage: https://github.com/cloudfoundry/vcap-services-base
342
+ licenses: []
343
+ metadata: {}
344
+ post_install_message:
345
+ rdoc_options: []
346
+ require_paths:
347
+ - - lib
348
+ required_ruby_version: !ruby/object:Gem::Requirement
349
+ requirements:
350
+ - - ">="
351
+ - !ruby/object:Gem::Version
352
+ version: '0'
353
+ required_rubygems_version: !ruby/object:Gem::Requirement
354
+ requirements:
355
+ - - ">="
356
+ - !ruby/object:Gem::Version
357
+ version: '0'
358
+ requirements: []
359
+ rubyforge_project:
360
+ rubygems_version: 2.2.2
361
+ signing_key:
362
+ specification_version: 4
363
+ summary: VCAP services base module
364
+ test_files: []