deltacloud-core 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. data/LICENSE +145 -0
  2. data/NOTICE +10 -1
  3. data/Rakefile +50 -2
  4. data/bin/deltacloudd +111 -14
  5. data/config/addresses.xml +14 -0
  6. data/config/condor.yaml +30 -0
  7. data/config/drivers/azure.yaml +3 -0
  8. data/config/drivers/condor.yaml +3 -0
  9. data/config/{drivers.yaml → drivers/ec2.yaml} +5 -34
  10. data/config/drivers/eucalyptus.yaml +8 -0
  11. data/config/drivers/gogrid.yaml +3 -0
  12. data/config/drivers/mock.yaml +3 -0
  13. data/config/drivers/opennebula.yaml +4 -0
  14. data/config/drivers/rackspace.yaml +3 -0
  15. data/config/drivers/rhevm.yaml +3 -0
  16. data/config/drivers/rimuhosting.yaml +3 -0
  17. data/config/drivers/sbc.yaml +2 -0
  18. data/config/drivers/terremark.yaml +3 -0
  19. data/config/drivers/vsphere.yaml +8 -0
  20. data/deltacloud-core.gemspec +13 -5
  21. data/deltacloud.rb +4 -2
  22. data/lib/deltacloud/backend_capability.rb +2 -2
  23. data/lib/deltacloud/base_driver/base_driver.rb +23 -52
  24. data/lib/deltacloud/base_driver/exceptions.rb +168 -0
  25. data/lib/deltacloud/base_driver/features.rb +31 -12
  26. data/lib/deltacloud/base_driver/mock_driver.rb +2 -1
  27. data/lib/deltacloud/core_ext/string.rb +2 -0
  28. data/lib/deltacloud/drivers/azure/azure_driver.rb +5 -5
  29. data/lib/deltacloud/drivers/condor/condor_client.rb +273 -0
  30. data/lib/deltacloud/drivers/condor/condor_driver.rb +236 -0
  31. data/lib/deltacloud/drivers/condor/ip_agents/confserver.rb +75 -0
  32. data/lib/deltacloud/drivers/condor/ip_agents/default.rb +84 -0
  33. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +326 -95
  34. data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +3 -3
  35. data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +40 -8
  36. data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +7 -7
  37. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +42 -25
  38. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob1.yml +6 -4
  39. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob2.yml +7 -5
  40. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob3.yml +6 -4
  41. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob4.yml +6 -4
  42. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob5.yml +6 -4
  43. data/lib/deltacloud/drivers/mock/data/buckets/bucket1.yml +7 -1
  44. data/lib/deltacloud/drivers/mock/data/buckets/bucket2.yml +6 -1
  45. data/lib/deltacloud/drivers/mock/data/images/img1.yml +6 -2
  46. data/lib/deltacloud/drivers/mock/data/images/img2.yml +6 -2
  47. data/lib/deltacloud/drivers/mock/data/images/img3.yml +6 -2
  48. data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +11 -10
  49. data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +14 -7
  50. data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +14 -7
  51. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml +3 -2
  52. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml +3 -2
  53. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml +3 -2
  54. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +4 -3
  55. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +4 -3
  56. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +4 -3
  57. data/lib/deltacloud/drivers/mock/mock_client.rb +101 -0
  58. data/lib/deltacloud/drivers/mock/mock_driver.rb +367 -429
  59. data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +6 -0
  60. data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +59 -9
  61. data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +62 -8
  62. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +100 -45
  63. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +3 -2
  64. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +8 -11
  65. data/lib/deltacloud/drivers/sbc/sbc_client.rb +6 -6
  66. data/lib/deltacloud/drivers/sbc/sbc_driver.rb +16 -0
  67. data/lib/deltacloud/drivers/terremark/terremark_driver.rb +17 -12
  68. data/lib/deltacloud/drivers/vsphere/vsphere_client.rb +140 -0
  69. data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +405 -0
  70. data/lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb +182 -0
  71. data/lib/deltacloud/hardware_profile.rb +1 -1
  72. data/lib/deltacloud/helpers.rb +2 -1
  73. data/lib/deltacloud/helpers/application_helper.rb +92 -20
  74. data/lib/deltacloud/helpers/blob_stream.rb +160 -12
  75. data/lib/deltacloud/helpers/conversion_helper.rb +6 -2
  76. data/lib/deltacloud/helpers/json_helper.rb +31 -0
  77. data/lib/deltacloud/models/address.rb +28 -0
  78. data/lib/deltacloud/models/base_model.rb +5 -1
  79. data/lib/deltacloud/models/blob.rb +1 -1
  80. data/lib/deltacloud/models/bucket.rb +10 -0
  81. data/lib/deltacloud/models/firewall.rb +22 -0
  82. data/lib/deltacloud/models/firewall_rule.rb +23 -0
  83. data/lib/deltacloud/models/image.rb +12 -0
  84. data/lib/deltacloud/models/instance.rb +20 -2
  85. data/lib/deltacloud/models/key.rb +1 -1
  86. data/lib/deltacloud/runner.rb +3 -3
  87. data/lib/deltacloud/validation.rb +3 -7
  88. data/lib/drivers.rb +7 -1
  89. data/lib/sinatra/body_proxy.rb +34 -0
  90. data/lib/sinatra/lazy_auth.rb +5 -0
  91. data/lib/sinatra/rabbit.rb +54 -31
  92. data/lib/sinatra/rack_accept.rb +157 -0
  93. data/lib/sinatra/rack_date.rb +38 -0
  94. data/lib/sinatra/rack_etag.rb +2 -3
  95. data/lib/sinatra/rack_matrix_params.rb +51 -29
  96. data/lib/sinatra/rack_runtime.rb +1 -1
  97. data/lib/sinatra/rack_syslog.rb +86 -0
  98. data/lib/sinatra/url_for.rb +14 -1
  99. data/public/images/address.png +0 -0
  100. data/public/images/balancer.png +0 -0
  101. data/public/images/blob.png +0 -0
  102. data/public/images/bucket.png +0 -0
  103. data/public/images/cloud.png +0 -0
  104. data/public/images/firewall.png +0 -0
  105. data/public/images/image.png +0 -0
  106. data/public/images/key.png +0 -0
  107. data/public/images/machine.png +0 -0
  108. data/public/images/profile.png +0 -0
  109. data/public/images/realm.png +0 -0
  110. data/public/images/snapshot.png +0 -0
  111. data/public/images/volume.png +0 -0
  112. data/public/javascripts/application.js +119 -16
  113. data/public/javascripts/jquery.min.js +18 -0
  114. data/public/javascripts/jquery.mobile-1.0b1.min.js +146 -0
  115. data/public/stylesheets/compiled/application.css +8 -0
  116. data/public/stylesheets/images/ajax-loader.png +0 -0
  117. data/public/{images → stylesheets/images}/bread-bg.png +0 -0
  118. data/public/{images → stylesheets/images}/error.png +0 -0
  119. data/public/{images → stylesheets/images}/grid.png +0 -0
  120. data/public/stylesheets/images/icon-search-black.png +0 -0
  121. data/public/stylesheets/images/icons-18-black.png +0 -0
  122. data/public/stylesheets/images/icons-18-white.png +0 -0
  123. data/public/stylesheets/images/icons-36-black.png +0 -0
  124. data/public/stylesheets/images/icons-36-white.png +0 -0
  125. data/public/{images → stylesheets/images}/logo-wide.png +0 -0
  126. data/public/{images → stylesheets/images}/pending.png +0 -0
  127. data/public/{images → stylesheets/images}/rails.png +0 -0
  128. data/public/{images → stylesheets/images}/running.png +0 -0
  129. data/public/{images → stylesheets/images}/stopped.png +0 -0
  130. data/public/{images → stylesheets/images}/topbar-bg.png +0 -0
  131. data/public/stylesheets/jquery.mobile-1.0b1.min.css +8 -0
  132. data/public/stylesheets/new.css +53 -0
  133. data/server.rb +487 -175
  134. data/support/condor/bash/cached_images.sh +8 -0
  135. data/support/condor/bash/cloud_exit_hook.sh +17 -0
  136. data/support/condor/bash/cloud_functions +175 -0
  137. data/support/condor/bash/cloud_prepare_hook.sh +20 -0
  138. data/support/condor/bash/libvirt_cloud_script.sh +13 -0
  139. data/support/condor/config/50condor_cloud.config +37 -0
  140. data/support/condor/config/50condor_cloud_node.config +37 -0
  141. data/support/condor/config/condor-cloud +2 -0
  142. data/support/condor/config/condor_config.local +44 -0
  143. data/support/fedora/deltacloud-core +48 -26
  144. data/support/fedora/deltacloud-core-config +26 -0
  145. data/support/fedora/deltacloud-core.spec +314 -68
  146. data/support/fedora/deltacloudd-fedora +5 -0
  147. data/tests/common.rb +34 -4
  148. data/tests/drivers/mock/api_test.rb +3 -3
  149. data/tests/drivers/mock/images_test.rb +12 -0
  150. data/tests/drivers/mock/instances_test.rb +2 -0
  151. data/tests/rabbit_test.rb +2 -2
  152. data/views/addresses/_address.html.haml +6 -0
  153. data/views/addresses/associate.html.haml +12 -0
  154. data/views/addresses/index.html.haml +9 -0
  155. data/views/addresses/index.xml.haml +4 -0
  156. data/views/addresses/show.html.haml +21 -0
  157. data/views/addresses/show.xml.haml +14 -0
  158. data/views/api/show.html.haml +6 -11
  159. data/views/api/show.xml.haml +2 -0
  160. data/views/blobs/new.html.haml +24 -23
  161. data/views/blobs/show.html.haml +30 -31
  162. data/views/buckets/index.html.haml +9 -21
  163. data/views/buckets/index.xml.haml +3 -7
  164. data/views/buckets/new.html.haml +13 -12
  165. data/views/buckets/show.html.haml +22 -22
  166. data/views/buckets/show.xml.haml +5 -3
  167. data/views/docs/collection.html.haml +23 -34
  168. data/views/docs/collection.xml.haml +2 -2
  169. data/views/docs/index.html.haml +9 -13
  170. data/views/docs/index.xml.haml +1 -1
  171. data/views/docs/operation.html.haml +28 -38
  172. data/views/docs/operation.xml.haml +1 -1
  173. data/views/drivers/index.html.haml +8 -13
  174. data/views/drivers/show.html.haml +18 -18
  175. data/views/error.html.haml +32 -27
  176. data/views/errors/400.html.haml +41 -0
  177. data/views/errors/{validation_failure.xml.haml → 400.xml.haml} +0 -4
  178. data/views/errors/401.html.haml +41 -0
  179. data/views/errors/{auth_exception.xml.haml → 401.xml.haml} +0 -0
  180. data/views/errors/403.html.haml +42 -0
  181. data/views/errors/{not_allowed.xml.haml → 403.xml.haml} +0 -0
  182. data/views/errors/404.html.haml +29 -0
  183. data/views/errors/{not_found.xml.haml → 404.xml.haml} +1 -1
  184. data/views/errors/405.html.haml +29 -0
  185. data/views/errors/405.xml.haml +5 -0
  186. data/views/errors/500.html.haml +43 -0
  187. data/views/errors/500.xml.haml +5 -0
  188. data/views/errors/502.html.haml +43 -0
  189. data/views/errors/{backend_error.xml.haml → 502.xml.haml} +1 -2
  190. data/views/errors/backend_capability_failure.html.haml +27 -9
  191. data/views/firewalls/index.html.haml +15 -0
  192. data/views/firewalls/index.xml.haml +28 -0
  193. data/views/firewalls/new.html.haml +11 -0
  194. data/views/firewalls/new_rule.html.haml +20 -0
  195. data/views/firewalls/show.html.haml +42 -0
  196. data/views/firewalls/show.xml.haml +26 -0
  197. data/views/hardware_profiles/index.html.haml +15 -23
  198. data/views/hardware_profiles/show.html.haml +22 -18
  199. data/views/images/index.html.haml +11 -23
  200. data/views/images/index.xml.haml +4 -13
  201. data/views/images/new.html.haml +12 -13
  202. data/views/images/show.html.haml +26 -20
  203. data/views/images/show.xml.haml +2 -1
  204. data/views/instance_states/show.html.haml +21 -25
  205. data/views/instances/index.html.haml +13 -30
  206. data/views/instances/index.xml.haml +2 -23
  207. data/views/instances/new.html.haml +83 -88
  208. data/views/instances/show.html.haml +53 -55
  209. data/views/instances/show.xml.haml +12 -10
  210. data/views/keys/index.html.haml +13 -24
  211. data/views/keys/new.html.haml +7 -7
  212. data/views/keys/show.html.haml +26 -21
  213. data/views/layout.html.haml +28 -27
  214. data/views/load_balancers/index.html.haml +11 -31
  215. data/views/load_balancers/index.xml.haml +0 -1
  216. data/views/load_balancers/new.html.haml +1 -1
  217. data/views/load_balancers/show.html.haml +33 -34
  218. data/views/load_balancers/show.xml.haml +2 -2
  219. data/views/realms/index.html.haml +11 -24
  220. data/views/realms/index.xml.haml +2 -8
  221. data/views/realms/show.html.haml +17 -15
  222. data/views/realms/show.xml.haml +2 -1
  223. data/views/storage_snapshots/index.html.haml +11 -21
  224. data/views/storage_snapshots/index.xml.haml +2 -5
  225. data/views/storage_snapshots/new.html.haml +1 -1
  226. data/views/storage_snapshots/show.html.haml +21 -13
  227. data/views/storage_snapshots/show.xml.haml +2 -1
  228. data/views/storage_volumes/index.html.haml +11 -34
  229. data/views/storage_volumes/new.html.haml +1 -1
  230. data/views/storage_volumes/show.html.haml +33 -27
  231. data/views/storage_volumes/show.xml.haml +2 -1
  232. metadata +266 -178
  233. data/lib/sinatra/respond_to.rb +0 -248
  234. data/support/fedora/deltacloudd +0 -128
  235. data/support/fedora/rubygem-deltacloud-core.spec +0 -127
  236. data/views/accounts/index.html.haml +0 -11
  237. data/views/accounts/show.html.haml +0 -30
  238. data/views/errors/auth_exception.html.haml +0 -8
  239. data/views/errors/backend_error.html.haml +0 -22
  240. data/views/errors/not_allowed.html.haml +0 -6
  241. data/views/errors/not_found.html.haml +0 -6
  242. data/views/errors/validation_failure.html.haml +0 -11
@@ -0,0 +1,42 @@
1
+ %div{ :'data-role' => :content, :'data-theme' => 'b'}
2
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
3
+ %li{ :'data-role' => 'list-divider'} Server message
4
+ %li
5
+ %h3=[@error.class.name, @error.message].join(' - ')
6
+ %li{ :'data-role' => 'list-divider'} Original request URI
7
+ %li
8
+ %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
9
+ %span=request.env['REQUEST_URI']
10
+ %span{ :class => 'ui-li-count'} Retry
11
+ %li{ :'data-role' => 'list-divider'} Error details
12
+ %li
13
+ - if @error.class.method_defined? :details
14
+ %p= @error.details
15
+ - else
16
+ %em No details
17
+
18
+ - if @error.backtrace
19
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
20
+ %h3 Backtrace
21
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
22
+ %li
23
+ %pre=@error.backtrace.join("\n")
24
+
25
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
26
+ %h3 Parameters
27
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
28
+ - if params.keys.empty?
29
+ %li{ :'data-role' => 'list-divider'} No parameters
30
+ - params.each do |key, value|
31
+ %li{ :'data-role' => 'list-divider'}=key
32
+ %li
33
+ %span{:style => 'font-weight:normal;'}=value.inspect
34
+
35
+
36
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
37
+ %h3 Request details
38
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
39
+ - request.env.each do |key, value|
40
+ %li{ :'data-role' => 'list-divider'}=key
41
+ %li
42
+ %span{:style => 'font-weight:normal;'}=value.inspect
@@ -0,0 +1,29 @@
1
+ %div{ :'data-role' => :content, :'data-theme' => 'b'}
2
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
3
+ %li{ :'data-role' => 'list-divider'} Server message
4
+ %li
5
+ %h3 Not Found
6
+ %li{ :'data-role' => 'list-divider'} Original request URI
7
+ %li
8
+ %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
9
+ %span=request.env['REQUEST_URI']
10
+ %span{ :class => 'ui-li-count'} Retry
11
+
12
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
13
+ %h3 Parameters
14
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
15
+ - if params.keys.empty?
16
+ %li{ :'data-role' => 'list-divider'} No parameters
17
+ - params.each do |key, value|
18
+ %li{ :'data-role' => 'list-divider'}=key
19
+ %li
20
+ %span{:style => 'font-weight:normal;'}=value.inspect
21
+
22
+
23
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
24
+ %h3 Request details
25
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
26
+ - request.env.each do |key, value|
27
+ %li{ :'data-role' => 'list-divider'}=key
28
+ %li
29
+ %span{:style => 'font-weight:normal;'}=value.inspect
@@ -1,2 +1,2 @@
1
1
  %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
- %message Not Found
2
+ %message Resource not found
@@ -0,0 +1,29 @@
1
+ %div{ :'data-role' => :content, :'data-theme' => 'b'}
2
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
3
+ %li{ :'data-role' => 'list-divider'} Server message
4
+ %li
5
+ %h3 Method not allowed on given resource
6
+ %li{ :'data-role' => 'list-divider'} Original request URI
7
+ %li
8
+ %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
9
+ %span=request.env['REQUEST_URI']
10
+ %span{ :class => 'ui-li-count'} Retry
11
+
12
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
13
+ %h3 Parameters
14
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
15
+ - if params.keys.empty?
16
+ %li{ :'data-role' => 'list-divider'} No parameters
17
+ - params.each do |key, value|
18
+ %li{ :'data-role' => 'list-divider'}=key
19
+ %li
20
+ %span{:style => 'font-weight:normal;'}=value.inspect
21
+
22
+
23
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
24
+ %h3 Request details
25
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
26
+ - request.env.each do |key, value|
27
+ %li{ :'data-role' => 'list-divider'}=key
28
+ %li
29
+ %span{:style => 'font-weight:normal;'}=value.inspect
@@ -0,0 +1,5 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %message
3
+ Requested method not allowed
4
+ %method
5
+ =request.env['REQUEST_METHOD']
@@ -0,0 +1,43 @@
1
+ %div{ :'data-role' => :content, :'data-theme' => 'b'}
2
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
3
+ %li{ :'data-role' => 'list-divider'} Server message
4
+ %li
5
+ %h3=[@error.class.name, @error.message].join(' - ')
6
+ %li{ :'data-role' => 'list-divider'} Original request URI
7
+ %li
8
+ %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
9
+ %span=request.env['REQUEST_URI']
10
+ %span{ :class => 'ui-li-count'} Retry
11
+ %li{ :'data-role' => 'list-divider'} Error details
12
+ %li
13
+ - if @error.class.method_defined? :details
14
+ %p= @error.details
15
+ - else
16
+ %em No details
17
+
18
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
19
+ %h3 Backtrace
20
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
21
+ %li
22
+ %pre=@error.backtrace.join("\n")
23
+
24
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
25
+ %h3 Parameters
26
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
27
+ - if params.keys.empty?
28
+ %li{ :'data-role' => 'list-divider'} No parameters
29
+ - params.each do |key, value|
30
+ - next if value.inspect.to_s == '#'
31
+ %li{ :'data-role' => 'list-divider'}=key
32
+ %li
33
+ %span{:style => 'font-weight:normal;'}=value.inspect
34
+
35
+
36
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
37
+ %h3 Request details
38
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
39
+ - request.env.each do |key, value|
40
+ - next if value.inspect.to_s == '#'
41
+ %li{ :'data-role' => 'list-divider'}=key
42
+ %li
43
+ %span{:style => 'font-weight:normal;'}=value.inspect
@@ -0,0 +1,5 @@
1
+ %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
+ %kind backend_error
3
+ %backend{ :driver => driver_symbol }
4
+ %code=response.status
5
+ %message< #{cdata @error.message}
@@ -0,0 +1,43 @@
1
+ %div{ :'data-role' => :content, :'data-theme' => 'b'}
2
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
3
+ %li{ :'data-role' => 'list-divider'} Server message
4
+ %li
5
+ %h3=[@error.class.name, @error.message].join(' - ')
6
+ %li{ :'data-role' => 'list-divider'} Original request URI
7
+ %li
8
+ %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
9
+ %span=request.env['REQUEST_URI']
10
+ %span{ :class => 'ui-li-count'} Retry
11
+ %li{ :'data-role' => 'list-divider'} Error details
12
+ %li
13
+ - if @error.class.method_defined? :details
14
+ %p= @error.details
15
+ - else
16
+ %em No details
17
+
18
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
19
+ %h3 Backtrace
20
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
21
+ %li
22
+ %pre=@error.backtrace.join("\n")
23
+
24
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
25
+ %h3 Parameters
26
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
27
+ - if params.keys.empty?
28
+ %li{ :'data-role' => 'list-divider'} No parameters
29
+ - params.each do |key, value|
30
+ - next if value.inspect.to_s == '#'
31
+ %li{ :'data-role' => 'list-divider'}=key
32
+ %li
33
+ %span{:style => 'font-weight:normal;'}=value.inspect
34
+
35
+
36
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
37
+ %h3 Request details
38
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
39
+ - request.env.each do |key, value|
40
+ - next if value.inspect.to_s == '#'
41
+ %li{ :'data-role' => 'list-divider'}=key
42
+ %li
43
+ %span{:style => 'font-weight:normal;'}=value.inspect
@@ -2,7 +2,6 @@
2
2
  %kind backend_error
3
3
  %backend{ :driver => driver_symbol }
4
4
  %code= @error.code
5
- %cause= @error.cause
6
- - if @error.details
5
+ - if @error.respond_to?(:details) && @error.details
7
6
  %details< #{cdata @error.details.join("\n")}
8
7
  %message< #{cdata @error.message}
@@ -1,11 +1,29 @@
1
- %h1 Backend Capability Failure
1
+ %div{ :'data-role' => :content, :'data-theme' => 'b'}
2
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
3
+ %li{ :'data-role' => 'list-divider'} Server message
4
+ %li
5
+ %h3 Backend capability failure
6
+ %li{ :'data-role' => 'list-divider'} Original request URI
7
+ %li
8
+ %a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
9
+ %span=request.env['REQUEST_URI']
10
+ %span{ :class => 'ui-li-count'} Retry
2
11
 
3
- %p= @error.message
12
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
13
+ %h3 Parameters
14
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
15
+ - if params.keys.empty?
16
+ %li{ :'data-role' => 'list-divider'} No parameters
17
+ - params.each do |key, value|
18
+ %li{ :'data-role' => 'list-divider'}=key
19
+ %li
20
+ %span{:style => 'font-weight:normal;'}=value.inspect
4
21
 
5
- %dl
6
- %di
7
- %dt Request URL
8
- %dd= request.env['REQUEST_URI']
9
- %di
10
- %dt Capability
11
- %dd= @error.capability
22
+
23
+ %div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
24
+ %h3 Request details
25
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
26
+ - request.env.each do |key, value|
27
+ %li{ :'data-role' => 'list-divider'}=key
28
+ %li
29
+ %span{:style => 'font-weight:normal;'}=value.inspect
@@ -0,0 +1,15 @@
1
+ =header "Firewalls" do
2
+ %a{ :href => api_url_for('firewalls/new'), :'data-icon' => :plus, :'data-role' => :button, :class => 'ui-btn-right'} Create new firewall
3
+ =subheader "#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
4
+
5
+ %div{ :'data-role' => :content, :'data-theme' => 'c'}
6
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'a'}
7
+ %li{ :'data-role' => 'list-divider'}=driver_symbol
8
+ - @firewalls.each do |firewall|
9
+ %li
10
+ %a{ :href => firewall_url(firewall.id), :'data-ajax' => 'false'}
11
+ %img{ :class => 'ui-link-thumb', :src => '/images/firewall.png'}
12
+ %h3=firewall.id
13
+ %p=firewall.description
14
+ %span{ :class => 'ui-li-count'}=firewall.owner_id
15
+
@@ -0,0 +1,28 @@
1
+ !!! XML
2
+ %firewalls
3
+ - @firewalls.each do |firewall|
4
+ %firewall{:href => firewall_url(firewall.id), :id => firewall.id}
5
+ %actions
6
+ %link{ :rel => :destroy, :href => destroy_firewall_url(firewall.id), :method => :delete, :id => firewall.id}
7
+ %link{ :rel => :add_rule, :href => "#{firewall_url(firewall.name)}/rules", :method => :post, :id => firewall.id}
8
+ - firewall.attributes.select{ |attr| attr != :id && attr!= :rules}.each do |attribute|
9
+ - haml_tag("#{attribute}".tr('-', '_'), :<) do
10
+ - if [:name, :description].include?(attribute)
11
+ =cdata do
12
+ - haml_concat firewall.send(attribute)
13
+ - else
14
+ - haml_concat firewall.send(attribute)
15
+ %rules
16
+ - firewall.rules.each do |rule|
17
+ %rule{:id => rule.id}
18
+ %actions
19
+ %link{ :rel => :rule, :href => "#{firewall_url(firewall.name)}/#{rule.id}", :method => :delete, :id =>rule.id, :rel => :destroy }
20
+ - rule.attributes.select{|attr| attr != :sources && attr != :id}.each do |rule_attrib|
21
+ - haml_tag("#{rule_attrib}".tr('-', '_'), :<) do
22
+ - haml_concat rule.send(rule_attrib)
23
+ %sources
24
+ - rule.sources.each do |source|
25
+ - if source[:type] == "group"
26
+ %source{:name => source[:name], :type=> source[:type], :owner=> source[:owner]}
27
+ - else
28
+ %source{:prefix => source[:prefix], :address=> source[:address], :family=>source[:family], :type => source[:type]}
@@ -0,0 +1,11 @@
1
+ %h1 New Firewall
2
+
3
+ %form{:action => firewalls_url, :method => :post}
4
+ %label
5
+ Firewall Name
6
+ %input{:name => 'name', :size => 25}/
7
+ %br
8
+ %label
9
+ Firewall Description
10
+ %input{:name => 'description', :size => 100}/
11
+ %input{:type => :submit, :name => "commit", :value=>"create"}
@@ -0,0 +1,20 @@
1
+ =header "New firewall rule"
2
+
3
+ %div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog', :id => "new_rule_form"}
4
+ %form{ :action => "#{firewall_url(@firewall_name)}/rules", :method => :post}
5
+ %div{ 'data-role' => :fieldcontain }
6
+ %label{ :for => :name} Protocol:
7
+ %input{ :type => :text, :id => :protocol, :name => :protocol, :value => '', :size => 10 }
8
+ %div{ 'data-role' => :fieldcontain }
9
+ %label{ :for => :name} From port:
10
+ %input{ :type => :text, :id => :port_from, :name => :port_from, :value => '', :size => 10 }
11
+ %div{ 'data-role' => :fieldcontain }
12
+ %label{ :for => :name} To port:
13
+ %input{ :type => :text, :id => :port_to, :name => :port_to, :value => '', :size => 10 }
14
+ %div{ 'data-role' => :fieldcontain }
15
+ %a{ :href => "javascript:;", :onclick => "make_fields('address');"} Add source IP address
16
+ %br
17
+ %a{ :href => "javascript:;", :onclick => "make_fields('group');"} Add source group
18
+ %br
19
+ #new_rule_form_fields
20
+ %button{ :type => :submit} Create
@@ -0,0 +1,42 @@
1
+ =header "Firewall"
2
+ =subheader @firewall.id
3
+
4
+ %div{ :'data-role' => :content, :'data-theme' => 'c'}
5
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'd'}
6
+ %li{ :'data-role' => 'list-divider'} Identifier
7
+ %li
8
+ %p{ :'data-role' => 'fieldcontain'}=@firewall.id
9
+ %li{ :'data-role' => 'list-divider'} Description
10
+ %li
11
+ %p{ :'data-role' => 'fieldcontain'}=@firewall.description
12
+ %li{ :'data-role' => 'list-divider'} Owner
13
+ %li
14
+ %p{ :'data-role' => 'fieldcontain'}=@firewall.owner_id
15
+ %li{ :'data-role' => 'list-divider'} Actions
16
+ %li
17
+ %div{ :'data-role' => 'controlgroup', :'data-type' => "horizontal" }
18
+ =link_to_action "Destroy", destroy_firewall_url(@firewall.id), :delete
19
+
20
+ =header "Rules", :back => 'false' do
21
+ %a{ :href => api_url_for("firewalls/#{@firewall.id}/new_rule"), :'data-icon' => :plus, :'data-role' => :button, :class => 'ui-btn-right', :'data-ajax' => 'false'} Add new rule
22
+
23
+ %div{ :'data-role' => :content, :'data-theme' => 'c'}
24
+ - @firewall.rules.each do |rule|
25
+ %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'd'}
26
+ %li{ :'data-role' => 'list-divider'}
27
+ %strong=rule.id
28
+ %li
29
+ %p{ :'data-role' => 'fieldcontain'}
30
+ = rule.attributes.select{|attr| ![:sources, :id].include?(attr)}.collect { |a| "<strong>#{a}</strong>=#{rule.send(a)}" }.join(", ")
31
+ %li{ :'data-role' => 'list-divider'} Sources
32
+ - rule.sources.each do |source|
33
+ %li
34
+ %p{ :'data-role' => 'fieldcontain'}
35
+ - if source[:type] == "group"
36
+ type: #{source[:type]}, name: #{source[:name]}, owner: #{source[:owner]}
37
+ - else
38
+ type: #{source[:type]}, family: #{source[:family]}, address: #{source[:address]}, prefix: #{source[:prefix]}
39
+ %li{ :'data-role' => 'list-divider'} Actions
40
+ %li
41
+ %div{ :'data-role' => 'controlgroup', :'data-type' => "horizontal" }
42
+ =link_to_action "Delete", "#{firewall_url(@firewall.name)}/#{rule.id}", :delete
@@ -0,0 +1,26 @@
1
+ !!! XML
2
+ %firewall{:href => firewall_url(@firewall.id), :id => @firewall.id}
3
+ %actions
4
+ %link{ :rel => :destroy, :href => destroy_firewall_url(@firewall.id), :method => :delete}
5
+ %link{ :rel => :update, :href => "#{firewall_url(@firewall_name)}/rules", :method => :post}
6
+ - @firewall.attributes.select{ |attr| attr != :id && attr!= :rules}.each do |attribute|
7
+ - haml_tag("#{attribute}".tr('-', '_'), :<) do
8
+ - if [:name, :description].include?(attribute)
9
+ =cdata do
10
+ - haml_concat @firewall.send(attribute)
11
+ - else
12
+ - haml_concat @firewall.send(attribute)
13
+ %rules
14
+ - @firewall.rules.each do |rule|
15
+ %rule{:href => firewall_url(@firewall.id) + '/' + rule.id, :id => rule.id}
16
+ %actions
17
+ %link{ :rel => :destroy, :href => "#{firewall_url(@firewall.name)}/#{rule.id}", :method => :delete}
18
+ - rule.attributes.select{|attr| attr != :sources && attr != :id}.each do |rule_attrib|
19
+ - haml_tag("#{rule_attrib}".tr('-', '_'), :<) do
20
+ - haml_concat rule.send(rule_attrib)
21
+ %sources
22
+ - rule.sources.each do |source|
23
+ - if source[:type] == "group"
24
+ %source{:name => source[:name], :type=> source[:type], :owner=>source[:owner]}
25
+ - else
26
+ %source{:prefix => source[:prefix], :address=> source[:address], :family=>source[:family], :type => source[:type]}
@@ -1,25 +1,17 @@
1
- %h1
2
- Hardware Profiles
1
+ =header "Hardware profiles"
2
+ =subheader "#{driver_symbol}@#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
3
3
 
4
- %table.display
5
- %thead
6
- %tr
7
- %th
8
- Name
9
- %th
10
- Architecture
11
- %th
12
- Memory
13
- %th
14
- Storage
15
- %tbody
4
+ %div{ :'data-role' => :content, :'data-theme' => 'c'}
5
+ %ul{ :'data-role' => :listview, :'data-inset' => :true }
16
6
  - for profile in @profiles
17
- %tr
18
- %td
19
- = link_to profile.name, hardware_profile_url( profile.name )
20
- %td
21
- = format_hardware_property profile.architecture
22
- %td
23
- = format_hardware_property profile.memory
24
- %td
25
- = format_hardware_property profile.storage
7
+ %li{ :'data-theme' => 'c'}
8
+ %a{ :href => hardware_profile_url(profile.name)}
9
+ %img{ :class => 'ui-link-thumb', :src => '/images/profile.png'}
10
+ %h3= profile.name
11
+ %p
12
+ %strong Architecture:
13
+ = format_hardware_property profile.architecture
14
+ %strong Memory:
15
+ = format_hardware_property profile.memory
16
+ %strong Storage:
17
+ = format_hardware_property profile.storage