deltacloud-core 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. data/Rakefile +99 -141
  2. data/bin/deltacloudd +4 -1
  3. data/config.ru +13 -6
  4. data/config/drivers/aruba.yaml +8 -0
  5. data/config/drivers/fgcp.yaml +3 -2
  6. data/deltacloud-core.gemspec +13 -9
  7. data/lib/cimi/collections/cloud_entry_point.rb +1 -1
  8. data/lib/cimi/models.rb +1 -7
  9. data/lib/cimi/models/base.rb +1 -4
  10. data/lib/cimi/models/cloud_entry_point.rb +14 -0
  11. data/lib/cimi/models/machine.rb +4 -4
  12. data/lib/cimi/models/machine_admin.rb +1 -0
  13. data/lib/cimi/models/machine_configuration.rb +4 -4
  14. data/lib/cimi/models/schema.rb +17 -14
  15. data/lib/cimi/models/volume_image.rb +1 -1
  16. data/lib/cimi/server.rb +1 -1
  17. data/lib/deltacloud/api.rb +55 -3
  18. data/lib/deltacloud/collections/addresses.rb +1 -1
  19. data/lib/deltacloud/collections/buckets.rb +12 -10
  20. data/lib/deltacloud/collections/firewalls.rb +2 -1
  21. data/lib/deltacloud/collections/hardware_profiles.rb +1 -1
  22. data/lib/deltacloud/collections/images.rb +2 -2
  23. data/lib/deltacloud/collections/instance_states.rb +6 -3
  24. data/lib/deltacloud/collections/instances.rb +2 -1
  25. data/lib/deltacloud/collections/keys.rb +6 -2
  26. data/lib/deltacloud/collections/load_balancers.rb +8 -7
  27. data/lib/deltacloud/collections/metrics.rb +2 -1
  28. data/lib/deltacloud/collections/realms.rb +1 -1
  29. data/lib/deltacloud/collections/storage_snapshots.rb +2 -1
  30. data/lib/deltacloud/collections/storage_volumes.rb +2 -2
  31. data/lib/deltacloud/core_ext.rb +1 -7
  32. data/lib/deltacloud/core_ext/hash.rb +7 -5
  33. data/lib/deltacloud/core_ext/string.rb +1 -0
  34. data/lib/deltacloud/drivers/aruba/aruba_driver.rb +469 -0
  35. data/lib/deltacloud/drivers/base_driver.rb +12 -17
  36. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +50 -22
  37. data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +1 -1
  38. data/lib/deltacloud/drivers/exceptions.rb +12 -2
  39. data/lib/deltacloud/drivers/features.rb +8 -0
  40. data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +21 -6
  41. data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +169 -57
  42. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +1 -1
  43. data/lib/deltacloud/drivers/mock/mock_client.rb +2 -0
  44. data/lib/deltacloud/drivers/mock/mock_driver.rb +101 -13
  45. data/lib/deltacloud/drivers/opennebula/occi_client.rb +12 -6
  46. data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +10 -18
  47. data/lib/deltacloud/drivers/openstack/openstack_driver.rb +46 -1
  48. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +17 -17
  49. data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +4 -4
  50. data/lib/deltacloud/helpers.rb +4 -4
  51. data/lib/deltacloud/helpers/blob_stream_helper.rb +4 -6
  52. data/lib/deltacloud/helpers/deltacloud_helper.rb +17 -1
  53. data/lib/deltacloud/helpers/driver_helper.rb +7 -3
  54. data/lib/deltacloud/helpers/url_helper.rb +4 -4
  55. data/lib/deltacloud/models/address.rb +1 -1
  56. data/lib/deltacloud/models/base_model.rb +0 -14
  57. data/lib/deltacloud/models/bucket.rb +0 -10
  58. data/lib/deltacloud/models/hardware_profile.rb +5 -26
  59. data/lib/deltacloud/models/image.rb +0 -12
  60. data/lib/deltacloud/models/instance.rb +6 -22
  61. data/lib/deltacloud/models/key.rb +2 -2
  62. data/lib/deltacloud/models/metric.rb +1 -1
  63. data/lib/deltacloud/models/storage_snapshot.rb +4 -0
  64. data/lib/deltacloud/server.rb +8 -2
  65. data/lib/deltacloud_rack.rb +40 -10
  66. data/lib/ec2/query_parser.rb +9 -4
  67. data/lib/ec2/server.rb +1 -1
  68. data/lib/ec2/views/create_key_pair.haml +3 -0
  69. data/lib/ec2/views/delete_key_pair.haml +1 -0
  70. data/lib/ec2/views/describe_availability_zones.haml +6 -0
  71. data/lib/ec2/views/describe_images.haml +10 -0
  72. data/lib/ec2/views/describe_instance_set.haml +24 -0
  73. data/lib/ec2/views/describe_instances.haml +9 -0
  74. data/lib/ec2/views/describe_key_pairs.haml +5 -0
  75. data/lib/ec2/views/error.haml +4 -0
  76. data/lib/ec2/views/instance_action.haml +9 -0
  77. data/lib/ec2/views/reboot_instances.haml +1 -0
  78. data/lib/ec2/views/run_instances.haml +7 -0
  79. data/lib/ec2/views/start_instances.haml +1 -0
  80. data/lib/ec2/views/stop_instances.haml +1 -0
  81. data/lib/ec2/views/terminate_instances.haml +9 -0
  82. data/lib/sinatra.rb +0 -1
  83. data/lib/sinatra/rack_accept.rb +1 -1
  84. data/lib/sinatra/rack_driver_select.rb +2 -2
  85. data/lib/sinatra/rack_etag.rb +5 -1
  86. data/lib/sinatra/rack_logger.rb +127 -0
  87. data/lib/sinatra/rack_matrix_params.rb +1 -1
  88. data/tests/cimi/collections/cloud_entry_point_test.rb +46 -0
  89. data/tests/cimi/collections/common.rb +17 -0
  90. data/tests/cimi/collections/machine_images_test.rb +44 -0
  91. data/tests/cimi/collections/machines_test.rb +41 -0
  92. data/tests/cimi/spec/cimi/model/machine_admin_spec.rb +35 -0
  93. data/tests/cimi/spec/cimi/model/machine_configuration_spec.rb +31 -0
  94. data/tests/cimi/spec/cimi/model/machine_image_spec.rb +33 -0
  95. data/tests/cimi/spec/cimi/model/machine_spec.rb +32 -0
  96. data/tests/cimi/spec/cimi/model/machine_template_spec.rb +32 -0
  97. data/tests/cimi/spec/cimi/model/schema_spec.rb +245 -0
  98. data/tests/cimi/spec/cimi/model/volume_configuration_spec.rb +34 -0
  99. data/tests/cimi/spec/cimi/model/volume_image_spec.rb +33 -0
  100. data/tests/cimi/spec/cimi/model/volume_spec.rb +32 -0
  101. data/tests/cimi/spec/cimi/model/volume_template_spec.rb +32 -0
  102. data/tests/cimi/spec/spec_helper.rb +136 -0
  103. data/tests/deltacloud/base_collection_test.rb +30 -0
  104. data/tests/deltacloud/collections/buckets_collection_test.rb +65 -0
  105. data/tests/deltacloud/collections/drivers_collection_test.rb +37 -0
  106. data/tests/deltacloud/collections/hardware_profiles_collection_test.rb +53 -0
  107. data/tests/deltacloud/collections/images_collection_test.rb +59 -0
  108. data/tests/deltacloud/collections/instance_states_collection_test.rb +34 -0
  109. data/tests/deltacloud/collections/instances_collection_test.rb +63 -0
  110. data/tests/deltacloud/collections/keys_collection_test.rb +63 -0
  111. data/tests/deltacloud/collections_test.rb +35 -0
  112. data/tests/deltacloud/common.rb +14 -0
  113. data/tests/deltacloud/deltacloud_helper_test.rb +55 -0
  114. data/tests/deltacloud/drivers_test.rb +73 -0
  115. data/tests/deltacloud/rack_test.rb +51 -0
  116. data/tests/deltacloud/server_test.rb +149 -0
  117. data/tests/{api → deprecated/api}/common.rb +0 -0
  118. data/tests/{api → deprecated/api}/driver_test.rb +0 -0
  119. data/tests/deprecated/api/library_test.rb +6 -0
  120. data/tests/{cimi → deprecated/cimi}/features/step_definitions/common_steps.rb +0 -0
  121. data/tests/{cimi → deprecated/cimi}/features/step_definitions/machine_images_steps.rb +0 -0
  122. data/tests/{cimi → deprecated/cimi}/features/step_definitions/machines_steps.rb +0 -0
  123. data/tests/{cimi → deprecated/cimi}/features/step_definitions/volumes_steps.rb +0 -0
  124. data/tests/{cimi → deprecated/cimi}/features/support/env.rb +0 -0
  125. data/tests/{common.rb → deprecated/common.rb} +0 -0
  126. data/tests/{core_ext → deprecated/core_ext}/string.rb +0 -0
  127. data/tests/{drivers → deprecated/drivers}/ec2/api_test.rb +0 -0
  128. data/tests/deprecated/drivers/ec2/common.rb +23 -0
  129. data/tests/{drivers → deprecated/drivers}/ec2/drivers_test.rb +0 -0
  130. data/tests/{drivers → deprecated/drivers}/ec2/hardware_profiles_test.rb +0 -0
  131. data/tests/deprecated/drivers/ec2/images_test.rb +230 -0
  132. data/tests/{drivers → deprecated/drivers}/ec2/instances_test.rb +0 -0
  133. data/tests/deprecated/drivers/ec2/keys_test.rb +181 -0
  134. data/tests/deprecated/drivers/ec2/realms_test.rb +146 -0
  135. data/tests/{drivers → deprecated/drivers}/fgcp/api_test.rb +0 -0
  136. data/tests/{drivers → deprecated/drivers}/fgcp/hardware_profiles_test.rb +0 -0
  137. data/tests/{drivers → deprecated/drivers}/fgcp/realms_test.rb +0 -0
  138. data/tests/{drivers → deprecated/drivers}/fgcp/setup.rb +0 -0
  139. data/tests/{drivers → deprecated/drivers}/google/api_test.rb +0 -0
  140. data/tests/{drivers → deprecated/drivers}/google/buckets_test.rb +0 -0
  141. data/tests/{drivers → deprecated/drivers}/google/common.rb +2 -2
  142. data/tests/{drivers → deprecated/drivers}/mock/api_test.rb +0 -0
  143. data/tests/{drivers → deprecated/drivers}/mock/buckets_test.rb +0 -0
  144. data/tests/{drivers → deprecated/drivers}/mock/common.rb +0 -0
  145. data/tests/{drivers → deprecated/drivers}/mock/drivers_test.rb +0 -0
  146. data/tests/{drivers → deprecated/drivers}/mock/hardware_profiles_test.rb +0 -0
  147. data/tests/deprecated/drivers/mock/images_test.rb +197 -0
  148. data/tests/deprecated/drivers/mock/instances_test.rb +343 -0
  149. data/tests/deprecated/drivers/mock/keys_test.rb +161 -0
  150. data/tests/deprecated/drivers/mock/realms_test.rb +132 -0
  151. data/tests/deprecated/drivers/mock/storage_snapshots_test.rb +114 -0
  152. data/tests/deprecated/drivers/mock/storage_volumes_test.rb +122 -0
  153. data/tests/{drivers → deprecated/drivers}/openstack/api_test.rb +0 -0
  154. data/tests/{drivers → deprecated/drivers}/openstack/common.rb +0 -0
  155. data/tests/{drivers → deprecated/drivers}/openstack/hardware_profiles_test.rb +0 -0
  156. data/tests/{drivers → deprecated/drivers}/openstack/images_test.rb +0 -0
  157. data/tests/{drivers → deprecated/drivers}/openstack/instances_test.rb +0 -0
  158. data/tests/{drivers → deprecated/drivers}/openstack/realms_test.rb +0 -0
  159. data/tests/{drivers → deprecated/drivers}/rackspace/api_test.rb +0 -0
  160. data/tests/{drivers → deprecated/drivers}/rackspace/buckets_test.rb +0 -0
  161. data/tests/{drivers → deprecated/drivers}/rackspace/common.rb +0 -0
  162. data/tests/{drivers → deprecated/drivers}/rackspace/hardware_profiles_test.rb +0 -0
  163. data/tests/{drivers → deprecated/drivers}/rackspace/images_test.rb +0 -0
  164. data/tests/{drivers → deprecated/drivers}/rackspace/instances_test.rb +0 -0
  165. data/tests/{drivers → deprecated/drivers}/rackspace/realms_test.rb +0 -0
  166. data/tests/{drivers → deprecated/drivers}/rhevm/api_test.rb +0 -0
  167. data/tests/deprecated/drivers/rhevm/common.rb +21 -0
  168. data/tests/{drivers → deprecated/drivers}/rhevm/hardware_profiles_test.rb +0 -0
  169. data/tests/deprecated/drivers/rhevm/images_test.rb +48 -0
  170. data/tests/{drivers → deprecated/drivers}/rhevm/instances_test.rb +0 -0
  171. data/tests/deprecated/drivers/rhevm/realms_test.rb +40 -0
  172. data/tests/{minitest_common.rb → deprecated/minitest_common.rb} +0 -0
  173. data/tests/{minitest_common_api_test.rb → deprecated/minitest_common_api_test.rb} +0 -0
  174. data/tests/{rabbit_test.rb → deprecated/rabbit_test.rb} +0 -0
  175. data/tests/drivers/base/base_driver_test.rb +124 -0
  176. data/tests/{api → drivers/base}/library_test.rb +2 -8
  177. data/tests/drivers/ec2/common.rb +23 -15
  178. data/tests/drivers/ec2/images_test.rb +30 -211
  179. data/tests/drivers/ec2/instance_test.rb +104 -0
  180. data/tests/drivers/ec2/keys_test.rb +32 -161
  181. data/tests/drivers/ec2/realms_test.rb +26 -128
  182. data/tests/drivers/ec2/storage_snapshots_test.rb +54 -0
  183. data/tests/drivers/mock/images_test.rb +37 -179
  184. data/tests/drivers/mock/instances_test.rb +103 -340
  185. data/tests/drivers/mock/keys_test.rb +30 -145
  186. data/tests/drivers/mock/realms_test.rb +23 -118
  187. data/tests/drivers/mock/storage_snapshots_test.rb +23 -100
  188. data/tests/drivers/mock/storage_volumes_test.rb +41 -104
  189. data/tests/drivers/models/address_test.rb +18 -0
  190. data/tests/drivers/models/base_test.rb +33 -0
  191. data/tests/drivers/models/blob_test.rb +18 -0
  192. data/tests/drivers/models/hardware_profile_test.rb +52 -0
  193. data/tests/drivers/models/instance_address_test.rb +24 -0
  194. data/tests/drivers/models/instance_profile_test.rb +21 -0
  195. data/tests/drivers/models/instance_test.rb +29 -0
  196. data/tests/drivers/models/keys_test.rb +25 -0
  197. data/tests/drivers/models/metrics_test.rb +20 -0
  198. data/tests/drivers/rhevm/common.rb +15 -15
  199. data/tests/drivers/rhevm/images_test.rb +61 -36
  200. data/tests/drivers/rhevm/instance_test.rb +104 -0
  201. data/tests/drivers/rhevm/provider_test.rb +48 -0
  202. data/tests/drivers/rhevm/realms_test.rb +40 -37
  203. data/tests/ec2/common.rb +24 -0
  204. data/tests/ec2/query_parser_test.rb +98 -0
  205. data/tests/ec2/server_test.rb +45 -0
  206. data/tests/helpers/core_ext/array_test.rb +24 -0
  207. data/tests/helpers/core_ext/hash_test.rb +42 -0
  208. data/tests/helpers/core_ext/integer_test.rb +19 -0
  209. data/tests/helpers/core_ext/string_test.rb +74 -0
  210. data/tests/test_helper.rb +66 -0
  211. data/views/api/show.html.haml +1 -2
  212. data/views/api/show.xml.haml +1 -2
  213. data/views/blobs/show.xml.haml +1 -2
  214. data/views/keys/new.html.haml +9 -2
  215. data/views/load_balancers/new.html.haml +35 -34
  216. data/views/metrics/index.html.haml +1 -1
  217. data/views/metrics/show.html.haml +2 -2
  218. data/views/metrics/show.xml.haml +6 -2
  219. data/views/storage_volumes/attach.html.haml +1 -1
  220. data/views/storage_volumes/show.html.haml +1 -1
  221. metadata +853 -544
  222. data/lib/sinatra/accept_media_types.rb +0 -154
data/Rakefile CHANGED
@@ -20,88 +20,18 @@
20
20
  require 'rake'
21
21
  require 'rake/testtask'
22
22
  require 'rubygems/package_task'
23
- require 'rspec/core/rake_task'
24
23
 
25
24
  begin
26
- require 'ci/reporter/rake/test_unit'
25
+ require "bundler"
26
+ Bundler.setup
27
27
  rescue LoadError
28
+ $stderr.puts "Please install bundler with 'gem install bundler'"
29
+ exit(1)
28
30
  end
29
31
 
30
32
  $top_srcdir = File.dirname(__FILE__)
31
33
  $:.unshift File.join($top_srcdir, 'lib')
32
34
 
33
- begin
34
- require 'cucumber'
35
- require 'cucumber/rake/task'
36
- namespace :cucumber do
37
- %w(mock ec2 sbc).each do |driver|
38
- namespace driver do
39
- Cucumber::Rake::Task.new(:test) do |t|
40
- t.cucumber_opts = "../tests/#{driver} --format pretty"
41
- t.rcov = false
42
- end
43
- Cucumber::Rake::Task.new(:features) do |t|
44
- t.cucumber_opts = "../tests/#{driver} --format html --out ../tests/tmp/cucumber_#{driver}.html"
45
- t.rcov = false
46
- end
47
- Cucumber::Rake::Task.new(:junit) do |t|
48
- t.cucumber_opts = "../tests/#{driver} --format junit --out #{File.join(File.dirname(__FILE__), "tmp", "junit_#{driver}")}"
49
- end
50
- end
51
- end
52
- end
53
- Cucumber::Rake::Task.new(:cimi) do |t|
54
- t.cucumber_opts = "tests/cimi/features --format pretty"
55
- t.rcov = false
56
- end
57
- namespace :cimi do
58
- Cucumber::Rake::Task.new(:machines) do |t|
59
- t.cucumber_opts = "tests/cimi/features/machines.feature --format pretty"
60
- t.rcov = false
61
- end
62
- Cucumber::Rake::Task.new(:machine_images) do |t|
63
- t.cucumber_opts = "tests/cimi/features/machine_images.feature --format pretty"
64
- t.rcov = false
65
- end
66
- Cucumber::Rake::Task.new(:volumes) do |t|
67
- t.cucumber_opts = "tests/cimi/features/volumes.feature --format pretty"
68
- t.rcov = false
69
- end
70
- end
71
- rescue LoadError
72
- end
73
-
74
-
75
- desc "Call our Test::Unit suite"
76
- task :test do
77
- %w(mock rackspace rhevm openstack google fgcp).each do |driver|
78
- Rake::Task["test:#{driver}"].reenable
79
- Rake::Task["test:#{driver}"].invoke
80
- end
81
- end
82
-
83
- desc "Call our Cucumber suite"
84
- task :cucumber do
85
- %w(mock ec2 sbc).each do |driver|
86
- Rake::Task["cucumber:#{driver}:test"].reenable
87
- Rake::Task["cucumber:#{driver}:test"].invoke
88
- end
89
- end
90
-
91
- RSpec::Core::RakeTask.new do |t|
92
- t.pattern = FileList['spec/**/*_spec.rb']
93
- t.rspec_opts = [ "--format", "nested", "--color", "-r ./spec/spec_helper.rb"]
94
- end
95
-
96
- Dir['spec/**/*_spec.rb'].each do |file|
97
- RSpec::Core::RakeTask.new("spec:#{File.basename(file).gsub(/_spec\.rb$/, '')}") do |t|
98
- t.pattern = FileList[file]
99
- t.rspec_opts = [ "--format", "nested", "--color", "-r ./spec/spec_helper.rb"]
100
- end
101
- end
102
-
103
-
104
-
105
35
  begin
106
36
  require 'yard'
107
37
  YARD::Rake::YardocTask.new do |t|
@@ -116,25 +46,6 @@ Gem::PackageTask.new(spec) do |pkg|
116
46
  pkg.need_tar = true
117
47
  end
118
48
 
119
- namespace :routes do
120
- desc "List all REST routes for the Deltacloud API"
121
- task :api do
122
- require 'deltacloud/server.rb'
123
- Sinatra::Rabbit::routes.each do |m, path|
124
- puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
125
- end
126
- end
127
-
128
- desc "List all REST routes for the CIMI API"
129
- task :cimi do
130
- require 'cimi/server.rb'
131
- Sinatra::Rabbit::routes.each do |m, path|
132
- puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
133
- end
134
- end
135
- end
136
-
137
-
138
49
  namespace :mock do
139
50
  namespace :fixtures do
140
51
  desc "Setup Mock driver fixtures"
@@ -174,64 +85,111 @@ namespace :mock do
174
85
  end
175
86
  end
176
87
 
177
- namespace :openshift do
178
-
179
- desc "Deploy Deltacloud API to OpenShift"
180
- task :deploy do
181
- print "RHN or OpenShift login with OpenShift Express access: "
182
- STDOUT.flush
183
- login = STDIN.gets.chomp
184
- print "Password: "
185
- system "stty -echo"
186
- password = STDIN.gets.chomp
187
- system "stty echo"
188
- puts `rhc-create-app --rhlogin #{login} --app deltacloudtest --password '#{password}' --type ruby-1.8`
88
+ desc "List the routes defined by Rabbit"
89
+ task :routes do
90
+ load File.join(File.dirname(__FILE__), 'config.ru')
91
+ Deltacloud.collections.each do |c|
92
+ puts "\033[1;32;m#{c.name}\33[0m"
93
+ c.operations.each do |o|
94
+ puts "\033[1;37m%6s\033[0m :%-10s %-30s (%s)" % [
95
+ o.http_method.to_s.upcase,
96
+ o.operation_name,
97
+ o.full_path,
98
+ o.description[0..100]
99
+ ]
100
+ end
101
+ unless c.collections.empty?
102
+ puts
103
+ c.collections.each do |s|
104
+ puts "\033[1;32;m#{s.name}\33[0m"
105
+ s.operations.each do |o|
106
+ puts "\033[1;37m%6s\033[0m :%-10s %-30s (%s)" % [
107
+ o.http_method.to_s.upcase,
108
+ o.operation_name,
109
+ o.full_path,
110
+ o.description[0..100]
111
+ ]
112
+ end
113
+ end
114
+ end
115
+ puts
189
116
  end
190
117
  end
191
118
 
192
- namespace :rabbit do
193
- load File.join(File.dirname(__FILE__), 'config.ru')
119
+ DRIVERS = [:mock, :ec2, :rhevm]
194
120
 
195
- desc "List the routes defined by Rabbit"
196
- task :routes do
197
- Deltacloud.collections.each do |c|
198
- puts "\033[1;32;m#{c.name}\33[0m"
199
- c.operations.each do |o|
200
- puts "\033[1;37m%6s\033[0m :%-10s %-30s (%s)" % [
201
- o.http_method.to_s.upcase,
202
- o.operation_name,
203
- o.full_path,
204
- o.description[0..100]
205
- ]
206
- end
207
- unless c.collections.empty?
208
- puts
209
- c.collections.each do |s|
210
- puts "\033[1;32;m#{s.name}\33[0m"
211
- s.operations.each do |o|
212
- puts "\033[1;37m%6s\033[0m :%-10s %-30s (%s)" % [
213
- o.http_method.to_s.upcase,
214
- o.operation_name,
215
- o.full_path,
216
- o.description[0..100]
217
- ]
218
- end
121
+ desc 'Run all tests'
122
+ task :test do
123
+
124
+ Rake::Task["mock:fixtures:reset"].invoke
125
+ puts "\n[ \033[1;37;mrake test:base\33[0m ]\n"
126
+ Rake::Task["test:base"].invoke
127
+ Rake::Task["mock:fixtures:reset"].invoke
128
+ puts "\n[ \033[1;37;mrake test:ec2\33[0m ]\n"
129
+ Rake::Task["test:ec2"].invoke
130
+ puts "\n[ \033[1;37;mrake test:cimi:models\33[0m ]\n"
131
+ Rake::Task["test:cimi:models"].invoke
132
+ DRIVERS.each do |driver|
133
+ puts "\n[ \033[1;37;mrake drivers:#{driver}\33[0m ]\n"
134
+ Rake::Task["test:drivers:#{driver}"].invoke
135
+ end
136
+ end
137
+
138
+ namespace :test do
139
+
140
+ desc "Run all tests and generate code coverage report"
141
+ task :coverage do
142
+ ENV['COVERAGE'] = '1'
143
+ puts "[ \033[1;37;mCoverage report will be generated to server/coverage\33[0m ]\n\n"
144
+ Rake::Task["test"].invoke
145
+ end
146
+
147
+ namespace :drivers do
148
+
149
+ DRIVERS.each do |driver|
150
+ Rake::TestTask.new(driver) do |t|
151
+ t.ruby_opts << '-r./tests/test_helper.rb' # Load SimpleCov when COVERAGE=1 is set
152
+ unless RUBY_VERSION < '1.9.0'
153
+ t.loader = :testrb
219
154
  end
155
+ t.test_files = FileList["tests/drivers/#{driver}/*test.rb"]
220
156
  end
221
- puts
222
157
  end
158
+
223
159
  end
224
160
 
225
- end
161
+ Rake::TestTask.new(:base) do |t|
162
+ unless RUBY_VERSION < '1.9.0'
163
+ t.loader = :testrb
164
+ end
165
+ t.test_files = FileList[
166
+ 'tests/helpers/core_ext/*test.rb', # Deltacloud extensions (core_ext) and other helpers
167
+ 'tests/drivers/base/*test.rb', # Deltacloud drivers API tests
168
+ 'tests/drivers/models/*test.rb', # Deltacloud models tests
169
+ 'tests/deltacloud/*test.rb', # Deltacloud internal API tests
170
+ 'tests/deltacloud/collections/*test.rb', # Deltacloud collections
171
+ ]
172
+ end
226
173
 
227
- namespace :test do
174
+ Rake::TestTask.new(:ec2) do |t|
175
+ unless RUBY_VERSION < '1.9.0'
176
+ t.loader = :testrb
177
+ end
178
+ t.test_files = FileList[
179
+ 'tests/ec2/*test.rb', # EC2 frontend internal API tests
180
+ ]
181
+ end
228
182
 
229
- %w(mock rackspace rhevm openstack google fgcp ec2).each do |driver|
230
- desc "Run #{driver} unit tests"
231
- Rake::TestTask.new(driver) { |t|
232
- t.test_files = FileList.new("tests/drivers/#{driver}/*_test.rb")
233
- t.verbose = true
234
- t.warning = false
235
- }
183
+ namespace :cimi do
184
+ Rake::TestTask.new(:models) do |t|
185
+ unless RUBY_VERSION < '1.9.0'
186
+ t.loader = :testrb
187
+ end
188
+ t.test_files = FileList[
189
+ 'tests/cimi/spec/cimi/model/*spec.rb', # CIMI frontend serialization API tests
190
+ 'tests/cimi/collections/*test.rb', # CIMI frontend API tests
191
+ ]
192
+ end
236
193
  end
194
+
237
195
  end
data/bin/deltacloudd CHANGED
@@ -75,6 +75,7 @@ BANNER
75
75
  opts.on( '-g', '--group GROUP', 'Group to run daemon as. Use with -d (default: "nobody")') { |group| options[:group] = group }
76
76
  opts.on( '-b', '--pid PID', 'File to store PID (default: tmp/pids/thin.pid)') { |pid| options[:pid] = pid }
77
77
  opts.on( '-l', '--drivers', 'List available drivers') { |env| options[:drivers] = true }
78
+ opts.on( '-L', '--log FILE', 'Log requests to a file (default: disabled)') { |log| ENV['API_LOG'] = log }
78
79
  opts.on( '-s', '--ssl', 'Enable SSL (default: disabled)') { |ssl| options[:ssl] = true }
79
80
  opts.on( '-k', '--ssl-key KEY', 'SSL key file to use') { |key| options[:ssl_key] = key }
80
81
  opts.on( '-C', '--ssl-cert CERT', 'SSL certificate file to use') { |cert| options[:ssl_cert] = cert }
@@ -192,7 +193,9 @@ unless have_thin
192
193
  app = Rack::Builder.new {
193
194
  use Rack::CommonLogger # apache-like logging
194
195
  use Rack::Reloader if options[:env] == "development"
195
- set :root, $top_srcdir # Set Sinatra root since we can't chdir to ../
196
+ unless RUBY_PLATFORM == 'java'
197
+ set :root, $top_srcdir # Set Sinatra root since we can't chdir to ../
198
+ end
196
199
  run inner_app
197
200
  }.to_app
198
201
 
data/config.ru CHANGED
@@ -24,20 +24,26 @@ load File.join(File.dirname(__FILE__), 'lib', 'deltacloud_rack.rb')
24
24
 
25
25
  Deltacloud::configure do |server|
26
26
  server.root_url '/api'
27
- server.version '1.0.0'
27
+ server.version '1.0.2'
28
28
  server.klass 'Deltacloud::API'
29
+ server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
30
+ server.default_driver ENV['API_DRIVER']
29
31
  end
30
32
 
31
33
  Deltacloud::configure(:cimi) do |server|
32
34
  server.root_url '/cimi'
33
- server.version '1.0.0'
35
+ server.version '1.0.2'
34
36
  server.klass 'CIMI::API'
37
+ server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
38
+ server.default_driver ENV['API_DRIVER']
35
39
  end
36
40
 
37
41
  Deltacloud::configure(:ec2) do |server|
38
42
  server.root_url '/'
39
43
  server.version '2012-04-01'
40
44
  server.klass 'Deltacloud::EC2::API'
45
+ server.logger Rack::DeltacloudLogger.setup(ENV['API_LOG'], ENV['API_VERBOSE'])
46
+ server.default_driver ENV['API_DRIVER']
41
47
  end
42
48
 
43
49
  routes = {}
@@ -51,21 +57,22 @@ routes = {}
51
57
  if ENV['API_FRONTEND'].split(',').size > 1
52
58
 
53
59
  ENV['API_FRONTEND'].split(',').each do |frontend|
54
- Deltacloud.require_frontend!(frontend)
60
+ Deltacloud[frontend.to_sym].require!
55
61
  routes.merge!({
56
62
  Deltacloud[frontend].root_url => Deltacloud[frontend].klass
57
63
  })
58
64
  end
59
65
 
60
66
  else
61
- Deltacloud.require_frontend!(ENV['API_FRONTEND'])
67
+ Deltacloud[ENV['API_FRONTEND'].to_sym].require!
68
+ Deltacloud[ENV['API_FRONTEND'].to_sym].default_frontend!
62
69
  class IndexEntrypoint < Sinatra::Base
63
70
  get "/" do
64
- redirect Deltacloud[ENV['API_FRONTEND']].root_url, 301
71
+ redirect Deltacloud.default_frontend.root_url, 301
65
72
  end
66
73
  end
67
74
  routes['/'] = IndexEntrypoint.new
68
- routes[Deltacloud[ENV['API_FRONTEND']].root_url] = Deltacloud[ENV['API_FRONTEND']].klass
75
+ routes[Deltacloud.default_frontend.root_url] = Deltacloud.default_frontend.klass
69
76
  end
70
77
 
71
78
 
@@ -0,0 +1,8 @@
1
+ ---
2
+ :aruba:
3
+ :entrypoints:
4
+ compute:
5
+ dc1: https://api.dc1.computing.cloud.it/WsEndUser/v1.7/WsEndUser.svc?wsdl
6
+ dc2: https://api.dc2.computing.cloud.it/WsEndUser/v1.7/WsEndUser.svc?wsdl
7
+ dc3: https://api.dc3.computing.cloud.it/WsEndUser/v1.7/WsEndUser.svc?wsdl
8
+ :name: Aruba
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  :fgcp:
3
3
  :name: FGCP
4
- :username: Username
4
+ :username: Folder name containing User Certificate
5
5
  :password: Secret Key Password of User Certificate
6
6
  :entrypoints:
7
7
  default:
8
- jp: https://api.oviss.jp.fujitsu.com/ovissapi/endpoint
8
+ jp-east: https://api.oviss.jp.fujitsu.com/ovissapi/endpoint
9
9
  au: https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint
10
10
  sg: https://api.globalcloud.sg.fujitsu.com/ovissapi/endpoint
11
11
  uk: https://api.globalcloud.uk.fujitsu.com/ovissapi/endpoint
12
12
  us: https://api.globalcloud.us.fujitsu.com/ovissapi/endpoint
13
13
  de: https://api.globalcloud.de.fujitsu.com/ovissapi/endpoint
14
+ jp-west: https://api.oviss2.jp.fujitsu.com/ovissapi/endpoint
@@ -17,9 +17,8 @@
17
17
  require 'rake'
18
18
 
19
19
  Gem::Specification.new do |s|
20
-
21
20
  s.author = 'The Apache Software Foundation'
22
- s.homepage = 'http://www.deltacloud.org'
21
+ s.homepage = "http://www.deltacloud.org"
23
22
  s.email = 'dev@deltacloud.apache.org'
24
23
  s.name = 'deltacloud-core'
25
24
 
@@ -30,7 +29,7 @@ Gem::Specification.new do |s|
30
29
  which implements the REST interface.
31
30
  EOF
32
31
 
33
- s.version = '1.0.1'
32
+ s.version = '1.0.2'
34
33
  s.date = Time.now
35
34
  s.summary = %q{Deltacloud REST API}
36
35
  s.files = FileList[
@@ -48,6 +47,7 @@ Gem::Specification.new do |s|
48
47
  'support/condor/config/**',
49
48
  'lib/**/*.rb',
50
49
  'lib/**/*.yml',
50
+ 'lib/**/*.haml',
51
51
  'tests/**/*.rb',
52
52
  'views/**/*.haml',
53
53
  'views/instance_states/*.erb',
@@ -62,21 +62,22 @@ Gem::Specification.new do |s|
62
62
 
63
63
  s.bindir = 'bin'
64
64
  s.executables = 'deltacloudd'
65
- s.test_files= Dir.glob("tests/*_test.rb")
65
+ s.test_files= Dir.glob("tests/**/*_test.rb")
66
66
  s.extra_rdoc_files = Dir["LICENSE", "DISCLAIMER", "NOTICE"]
67
67
  s.required_ruby_version = '>= 1.8.1'
68
68
  s.has_rdoc = 'false'
69
69
  s.add_dependency('rake', '>= 0.8.7')
70
70
  s.add_dependency('haml', '>= 2.2.17')
71
71
  s.add_dependency('sinatra', '>= 0.9.4')
72
- s.add_dependency('sinatra-rabbit', '>= 1.0.5')
72
+ s.add_dependency('sinatra-rabbit', '>= 1.0.10')
73
73
  s.add_dependency('crack')
74
74
  s.add_dependency('rack', '>= 1.0.0')
75
75
  s.add_dependency('rack-accept')
76
76
  s.add_dependency('json', '>= 1.1.9')
77
77
  s.add_dependency('net-ssh', '>= 2.0.0')
78
- s.add_dependency('thin', '>= 1.2.5')
78
+ s.add_dependency('thin', '>= 1.2.5') unless RUBY_PLATFORM == 'java'
79
79
  s.add_dependency('nokogiri', '>= 1.4.3')
80
+ s.add_dependency('require_relative') if RUBY_VERSION < '1.9'
80
81
 
81
82
  # dependencies for various cloud providers:
82
83
  # RHEV-M
@@ -92,8 +93,8 @@ Gem::Specification.new do |s|
92
93
  s.add_dependency('cloudfiles')
93
94
 
94
95
  # Terremark Vcloud Express
95
- s.add_dependency('fog')
96
- s.add_dependency('excon')
96
+ s.add_dependency('fog', '>= 1.4.0')
97
+ s.add_dependency('excon', '>= 0.14.2' )
97
98
 
98
99
  # Rhevm and Condor Cloud
99
100
  s.add_dependency('rest-client')
@@ -102,6 +103,9 @@ Gem::Specification.new do |s|
102
103
  s.add_dependency('uuidtools', '>= 2.1.1')
103
104
 
104
105
  # Openstack Compute and Object-Storage
105
- s.add_dependency('openstack')
106
+ s.add_dependency('openstack', '>= 1.0.1')
107
+
108
+ # Aruba Cloud
109
+ s.add_dependency('savon', '>= 1.0.0')
106
110
 
107
111
  end