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.
- data/LICENSE +145 -0
- data/NOTICE +10 -1
- data/Rakefile +50 -2
- data/bin/deltacloudd +111 -14
- data/config/addresses.xml +14 -0
- data/config/condor.yaml +30 -0
- data/config/drivers/azure.yaml +3 -0
- data/config/drivers/condor.yaml +3 -0
- data/config/{drivers.yaml → drivers/ec2.yaml} +5 -34
- data/config/drivers/eucalyptus.yaml +8 -0
- data/config/drivers/gogrid.yaml +3 -0
- data/config/drivers/mock.yaml +3 -0
- data/config/drivers/opennebula.yaml +4 -0
- data/config/drivers/rackspace.yaml +3 -0
- data/config/drivers/rhevm.yaml +3 -0
- data/config/drivers/rimuhosting.yaml +3 -0
- data/config/drivers/sbc.yaml +2 -0
- data/config/drivers/terremark.yaml +3 -0
- data/config/drivers/vsphere.yaml +8 -0
- data/deltacloud-core.gemspec +13 -5
- data/deltacloud.rb +4 -2
- data/lib/deltacloud/backend_capability.rb +2 -2
- data/lib/deltacloud/base_driver/base_driver.rb +23 -52
- data/lib/deltacloud/base_driver/exceptions.rb +168 -0
- data/lib/deltacloud/base_driver/features.rb +31 -12
- data/lib/deltacloud/base_driver/mock_driver.rb +2 -1
- data/lib/deltacloud/core_ext/string.rb +2 -0
- data/lib/deltacloud/drivers/azure/azure_driver.rb +5 -5
- data/lib/deltacloud/drivers/condor/condor_client.rb +273 -0
- data/lib/deltacloud/drivers/condor/condor_driver.rb +236 -0
- data/lib/deltacloud/drivers/condor/ip_agents/confserver.rb +75 -0
- data/lib/deltacloud/drivers/condor/ip_agents/default.rb +84 -0
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +326 -95
- data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +3 -3
- data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +40 -8
- data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +7 -7
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +42 -25
- data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob1.yml +6 -4
- data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob2.yml +7 -5
- data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob3.yml +6 -4
- data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob4.yml +6 -4
- data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob5.yml +6 -4
- data/lib/deltacloud/drivers/mock/data/buckets/bucket1.yml +7 -1
- data/lib/deltacloud/drivers/mock/data/buckets/bucket2.yml +6 -1
- data/lib/deltacloud/drivers/mock/data/images/img1.yml +6 -2
- data/lib/deltacloud/drivers/mock/data/images/img2.yml +6 -2
- data/lib/deltacloud/drivers/mock/data/images/img3.yml +6 -2
- data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +11 -10
- data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +14 -7
- data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +14 -7
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml +3 -2
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml +3 -2
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml +3 -2
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +4 -3
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +4 -3
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +4 -3
- data/lib/deltacloud/drivers/mock/mock_client.rb +101 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +367 -429
- data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +6 -0
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +59 -9
- data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +62 -8
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +100 -45
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +3 -2
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +8 -11
- data/lib/deltacloud/drivers/sbc/sbc_client.rb +6 -6
- data/lib/deltacloud/drivers/sbc/sbc_driver.rb +16 -0
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +17 -12
- data/lib/deltacloud/drivers/vsphere/vsphere_client.rb +140 -0
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +405 -0
- data/lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb +182 -0
- data/lib/deltacloud/hardware_profile.rb +1 -1
- data/lib/deltacloud/helpers.rb +2 -1
- data/lib/deltacloud/helpers/application_helper.rb +92 -20
- data/lib/deltacloud/helpers/blob_stream.rb +160 -12
- data/lib/deltacloud/helpers/conversion_helper.rb +6 -2
- data/lib/deltacloud/helpers/json_helper.rb +31 -0
- data/lib/deltacloud/models/address.rb +28 -0
- data/lib/deltacloud/models/base_model.rb +5 -1
- data/lib/deltacloud/models/blob.rb +1 -1
- data/lib/deltacloud/models/bucket.rb +10 -0
- data/lib/deltacloud/models/firewall.rb +22 -0
- data/lib/deltacloud/models/firewall_rule.rb +23 -0
- data/lib/deltacloud/models/image.rb +12 -0
- data/lib/deltacloud/models/instance.rb +20 -2
- data/lib/deltacloud/models/key.rb +1 -1
- data/lib/deltacloud/runner.rb +3 -3
- data/lib/deltacloud/validation.rb +3 -7
- data/lib/drivers.rb +7 -1
- data/lib/sinatra/body_proxy.rb +34 -0
- data/lib/sinatra/lazy_auth.rb +5 -0
- data/lib/sinatra/rabbit.rb +54 -31
- data/lib/sinatra/rack_accept.rb +157 -0
- data/lib/sinatra/rack_date.rb +38 -0
- data/lib/sinatra/rack_etag.rb +2 -3
- data/lib/sinatra/rack_matrix_params.rb +51 -29
- data/lib/sinatra/rack_runtime.rb +1 -1
- data/lib/sinatra/rack_syslog.rb +86 -0
- data/lib/sinatra/url_for.rb +14 -1
- data/public/images/address.png +0 -0
- data/public/images/balancer.png +0 -0
- data/public/images/blob.png +0 -0
- data/public/images/bucket.png +0 -0
- data/public/images/cloud.png +0 -0
- data/public/images/firewall.png +0 -0
- data/public/images/image.png +0 -0
- data/public/images/key.png +0 -0
- data/public/images/machine.png +0 -0
- data/public/images/profile.png +0 -0
- data/public/images/realm.png +0 -0
- data/public/images/snapshot.png +0 -0
- data/public/images/volume.png +0 -0
- data/public/javascripts/application.js +119 -16
- data/public/javascripts/jquery.min.js +18 -0
- data/public/javascripts/jquery.mobile-1.0b1.min.js +146 -0
- data/public/stylesheets/compiled/application.css +8 -0
- data/public/stylesheets/images/ajax-loader.png +0 -0
- data/public/{images → stylesheets/images}/bread-bg.png +0 -0
- data/public/{images → stylesheets/images}/error.png +0 -0
- data/public/{images → stylesheets/images}/grid.png +0 -0
- data/public/stylesheets/images/icon-search-black.png +0 -0
- data/public/stylesheets/images/icons-18-black.png +0 -0
- data/public/stylesheets/images/icons-18-white.png +0 -0
- data/public/stylesheets/images/icons-36-black.png +0 -0
- data/public/stylesheets/images/icons-36-white.png +0 -0
- data/public/{images → stylesheets/images}/logo-wide.png +0 -0
- data/public/{images → stylesheets/images}/pending.png +0 -0
- data/public/{images → stylesheets/images}/rails.png +0 -0
- data/public/{images → stylesheets/images}/running.png +0 -0
- data/public/{images → stylesheets/images}/stopped.png +0 -0
- data/public/{images → stylesheets/images}/topbar-bg.png +0 -0
- data/public/stylesheets/jquery.mobile-1.0b1.min.css +8 -0
- data/public/stylesheets/new.css +53 -0
- data/server.rb +487 -175
- data/support/condor/bash/cached_images.sh +8 -0
- data/support/condor/bash/cloud_exit_hook.sh +17 -0
- data/support/condor/bash/cloud_functions +175 -0
- data/support/condor/bash/cloud_prepare_hook.sh +20 -0
- data/support/condor/bash/libvirt_cloud_script.sh +13 -0
- data/support/condor/config/50condor_cloud.config +37 -0
- data/support/condor/config/50condor_cloud_node.config +37 -0
- data/support/condor/config/condor-cloud +2 -0
- data/support/condor/config/condor_config.local +44 -0
- data/support/fedora/deltacloud-core +48 -26
- data/support/fedora/deltacloud-core-config +26 -0
- data/support/fedora/deltacloud-core.spec +314 -68
- data/support/fedora/deltacloudd-fedora +5 -0
- data/tests/common.rb +34 -4
- data/tests/drivers/mock/api_test.rb +3 -3
- data/tests/drivers/mock/images_test.rb +12 -0
- data/tests/drivers/mock/instances_test.rb +2 -0
- data/tests/rabbit_test.rb +2 -2
- data/views/addresses/_address.html.haml +6 -0
- data/views/addresses/associate.html.haml +12 -0
- data/views/addresses/index.html.haml +9 -0
- data/views/addresses/index.xml.haml +4 -0
- data/views/addresses/show.html.haml +21 -0
- data/views/addresses/show.xml.haml +14 -0
- data/views/api/show.html.haml +6 -11
- data/views/api/show.xml.haml +2 -0
- data/views/blobs/new.html.haml +24 -23
- data/views/blobs/show.html.haml +30 -31
- data/views/buckets/index.html.haml +9 -21
- data/views/buckets/index.xml.haml +3 -7
- data/views/buckets/new.html.haml +13 -12
- data/views/buckets/show.html.haml +22 -22
- data/views/buckets/show.xml.haml +5 -3
- data/views/docs/collection.html.haml +23 -34
- data/views/docs/collection.xml.haml +2 -2
- data/views/docs/index.html.haml +9 -13
- data/views/docs/index.xml.haml +1 -1
- data/views/docs/operation.html.haml +28 -38
- data/views/docs/operation.xml.haml +1 -1
- data/views/drivers/index.html.haml +8 -13
- data/views/drivers/show.html.haml +18 -18
- data/views/error.html.haml +32 -27
- data/views/errors/400.html.haml +41 -0
- data/views/errors/{validation_failure.xml.haml → 400.xml.haml} +0 -4
- data/views/errors/401.html.haml +41 -0
- data/views/errors/{auth_exception.xml.haml → 401.xml.haml} +0 -0
- data/views/errors/403.html.haml +42 -0
- data/views/errors/{not_allowed.xml.haml → 403.xml.haml} +0 -0
- data/views/errors/404.html.haml +29 -0
- data/views/errors/{not_found.xml.haml → 404.xml.haml} +1 -1
- data/views/errors/405.html.haml +29 -0
- data/views/errors/405.xml.haml +5 -0
- data/views/errors/500.html.haml +43 -0
- data/views/errors/500.xml.haml +5 -0
- data/views/errors/502.html.haml +43 -0
- data/views/errors/{backend_error.xml.haml → 502.xml.haml} +1 -2
- data/views/errors/backend_capability_failure.html.haml +27 -9
- data/views/firewalls/index.html.haml +15 -0
- data/views/firewalls/index.xml.haml +28 -0
- data/views/firewalls/new.html.haml +11 -0
- data/views/firewalls/new_rule.html.haml +20 -0
- data/views/firewalls/show.html.haml +42 -0
- data/views/firewalls/show.xml.haml +26 -0
- data/views/hardware_profiles/index.html.haml +15 -23
- data/views/hardware_profiles/show.html.haml +22 -18
- data/views/images/index.html.haml +11 -23
- data/views/images/index.xml.haml +4 -13
- data/views/images/new.html.haml +12 -13
- data/views/images/show.html.haml +26 -20
- data/views/images/show.xml.haml +2 -1
- data/views/instance_states/show.html.haml +21 -25
- data/views/instances/index.html.haml +13 -30
- data/views/instances/index.xml.haml +2 -23
- data/views/instances/new.html.haml +83 -88
- data/views/instances/show.html.haml +53 -55
- data/views/instances/show.xml.haml +12 -10
- data/views/keys/index.html.haml +13 -24
- data/views/keys/new.html.haml +7 -7
- data/views/keys/show.html.haml +26 -21
- data/views/layout.html.haml +28 -27
- data/views/load_balancers/index.html.haml +11 -31
- data/views/load_balancers/index.xml.haml +0 -1
- data/views/load_balancers/new.html.haml +1 -1
- data/views/load_balancers/show.html.haml +33 -34
- data/views/load_balancers/show.xml.haml +2 -2
- data/views/realms/index.html.haml +11 -24
- data/views/realms/index.xml.haml +2 -8
- data/views/realms/show.html.haml +17 -15
- data/views/realms/show.xml.haml +2 -1
- data/views/storage_snapshots/index.html.haml +11 -21
- data/views/storage_snapshots/index.xml.haml +2 -5
- data/views/storage_snapshots/new.html.haml +1 -1
- data/views/storage_snapshots/show.html.haml +21 -13
- data/views/storage_snapshots/show.xml.haml +2 -1
- data/views/storage_volumes/index.html.haml +11 -34
- data/views/storage_volumes/new.html.haml +1 -1
- data/views/storage_volumes/show.html.haml +33 -27
- data/views/storage_volumes/show.xml.haml +2 -1
- metadata +266 -178
- data/lib/sinatra/respond_to.rb +0 -248
- data/support/fedora/deltacloudd +0 -128
- data/support/fedora/rubygem-deltacloud-core.spec +0 -127
- data/views/accounts/index.html.haml +0 -11
- data/views/accounts/show.html.haml +0 -30
- data/views/errors/auth_exception.html.haml +0 -8
- data/views/errors/backend_error.html.haml +0 -22
- data/views/errors/not_allowed.html.haml +0 -6
- data/views/errors/not_found.html.haml +0 -6
- data/views/errors/validation_failure.html.haml +0 -11
data/tests/common.rb
CHANGED
@@ -98,6 +98,11 @@ module DeltacloudTestCommon
|
|
98
98
|
end
|
99
99
|
else
|
100
100
|
get(uri, params || {}, opts[:auth] ? authenticate(opts) : {})
|
101
|
+
if last_response.status.to_s =~ /5(\d{2})/
|
102
|
+
puts "============= [ ERROR ] ================"
|
103
|
+
puts last_response.inspect
|
104
|
+
puts "========================================"
|
105
|
+
end
|
101
106
|
end
|
102
107
|
last_response.status.should_not == 401
|
103
108
|
end
|
@@ -105,6 +110,11 @@ module DeltacloudTestCommon
|
|
105
110
|
def get_auth_url(uri, params={}, opts={})
|
106
111
|
opts.merge!(:auth => true)
|
107
112
|
get_url(uri, params, opts)
|
113
|
+
if last_response.status.to_s =~ /5(\d{2})/
|
114
|
+
puts "============= [ ERROR ] ================"
|
115
|
+
puts last_response.inspect
|
116
|
+
puts "========================================"
|
117
|
+
end
|
108
118
|
end
|
109
119
|
|
110
120
|
def post_url(uri, params={}, opts={})
|
@@ -114,7 +124,12 @@ module DeltacloudTestCommon
|
|
114
124
|
post(uri, params || {}, authenticate(opts))
|
115
125
|
end
|
116
126
|
else
|
117
|
-
|
127
|
+
post(uri, params || {}, authenticate(opts))
|
128
|
+
if last_response.status.to_s =~ /5(\d{2})/
|
129
|
+
puts "============= [ ERROR ] ================"
|
130
|
+
puts last_response.inspect
|
131
|
+
puts "========================================"
|
132
|
+
end
|
118
133
|
end
|
119
134
|
end
|
120
135
|
|
@@ -125,7 +140,12 @@ module DeltacloudTestCommon
|
|
125
140
|
delete(uri, params || {}, authenticate(opts))
|
126
141
|
end
|
127
142
|
else
|
128
|
-
|
143
|
+
delete(uri, params || {}, authenticate(opts))
|
144
|
+
if last_response.status.to_s =~ /5(\d{2})/
|
145
|
+
puts "============= [ ERROR ] ================"
|
146
|
+
puts last_response.inspect
|
147
|
+
puts "========================================"
|
148
|
+
end
|
129
149
|
end
|
130
150
|
end
|
131
151
|
|
@@ -136,7 +156,12 @@ module DeltacloudTestCommon
|
|
136
156
|
put(uri, params || {}, authenticate(opts))
|
137
157
|
end
|
138
158
|
else
|
139
|
-
|
159
|
+
put(uri, params || {}, authenticate(opts))
|
160
|
+
if last_response.status.to_s =~ /5(\d{2})/
|
161
|
+
puts "============= [ ERROR ] ================"
|
162
|
+
puts last_response.inspect
|
163
|
+
puts "========================================"
|
164
|
+
end
|
140
165
|
end
|
141
166
|
end
|
142
167
|
|
@@ -148,8 +173,13 @@ module DeltacloudTestCommon
|
|
148
173
|
|
149
174
|
# Check if given URI require authentication
|
150
175
|
def require_authentication?(uri)
|
176
|
+
# We need to make sure we don't have both API_USER and API_PASSWORD
|
177
|
+
# set in the environment; otherwise LazyAuth will use those instead
|
178
|
+
# of asking for credentials
|
179
|
+
api_user = ENV.delete("API_USER")
|
151
180
|
get uri, {}
|
152
|
-
|
181
|
+
ENV["API_USER"] = api_user
|
182
|
+
last_response.status == 401
|
153
183
|
end
|
154
184
|
|
155
185
|
def with_provider(new_provider, &block)
|
@@ -69,7 +69,7 @@ module DeltacloudUnitTest
|
|
69
69
|
|
70
70
|
with_provider("storage") do
|
71
71
|
get_auth_url '/api/instances'
|
72
|
-
last_response.status.should ==
|
72
|
+
last_response.status.should == 403
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -79,7 +79,7 @@ module DeltacloudUnitTest
|
|
79
79
|
|
80
80
|
with_provider("storage") do
|
81
81
|
get_url '/api/docs/instances'
|
82
|
-
last_response.status.should ==
|
82
|
+
last_response.status.should == 403
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -126,7 +126,7 @@ module DeltacloudUnitTest
|
|
126
126
|
(last_xml_response/'api/link[@rel="instances"]/feature[@name="user_data"]').first.should_not == nil
|
127
127
|
get_auth_url "/api;driver=mock"
|
128
128
|
(last_xml_response/'api/link[@rel="instances"]/feature[@name="user_name"]').first.should_not == nil
|
129
|
-
(last_xml_response/'api/link[@rel="instances"]/feature[@name="
|
129
|
+
(last_xml_response/'api/link[@rel="instances"]/feature[@name="firewalls"]').first.should == nil
|
130
130
|
end
|
131
131
|
|
132
132
|
end
|
@@ -113,6 +113,18 @@ module DeltacloudUnitTest
|
|
113
113
|
Nokogiri::HTML(last_response.body).search('html').first.name.should == 'html'
|
114
114
|
end
|
115
115
|
|
116
|
+
def test_it_creates_and_destroys_image_from_instance
|
117
|
+
post_url "/api/images", { :name => "img4", :description => "Test::Unit image", :instance_id => "inst1"}
|
118
|
+
last_response.status.should == 201
|
119
|
+
last_response.headers['Location'].should_not == nil
|
120
|
+
get_auth_url last_response.headers['Location'], {}
|
121
|
+
(last_xml_response/'instance/name').should_not == nil
|
122
|
+
delete_url "/api/images/img4", {}
|
123
|
+
last_response.status.should == 204
|
124
|
+
get_auth_url "/api/images/img4", {}
|
125
|
+
last_response.status.should == 404
|
126
|
+
end
|
127
|
+
|
116
128
|
private
|
117
129
|
|
118
130
|
def test_image_attributes(image)
|
@@ -197,10 +197,12 @@ module DeltacloudUnitTest
|
|
197
197
|
(instance/'public_addreses').should_not == nil
|
198
198
|
(instance/'public_addresses/address').to_a.size.should > 0
|
199
199
|
(instance/'public_addresses/address').first.text.should_not == ""
|
200
|
+
(instance/'public_addresses/address').first[:type].should == "hostname"
|
200
201
|
|
201
202
|
(instance/'private_addresses').should_not == nil
|
202
203
|
(instance/'private_addresses/address').to_a.size.should > 0
|
203
204
|
(instance/'private_addresses/address').first.text.should_not == ""
|
205
|
+
(instance/'private_addresses/address').first[:type].should == "hostname"
|
204
206
|
|
205
207
|
(instance/'actions/link').to_a.size.should > 0
|
206
208
|
(instance/'actions/link').each do |link|
|
data/tests/rabbit_test.rb
CHANGED
@@ -41,10 +41,10 @@ module DeltacloudUnitTest
|
|
41
41
|
|
42
42
|
def test_effective_params
|
43
43
|
features = @driver.features(:instances).collect { |f| f.name }
|
44
|
-
features.should =~ [:hardware_profiles, :user_name, :authentication_key]
|
44
|
+
features.should =~ [:hardware_profiles, :user_name, :authentication_key, :user_data]
|
45
45
|
|
46
46
|
op = @app.collections[:instances].operations[:create]
|
47
|
-
op.effective_params(@driver).keys.should =~ [:image_id, :hwp_memory, :hwp_id, :keyname, :name, :hwp_storage, :realm_id]
|
47
|
+
op.effective_params(@driver).keys.should =~ [:image_id, :hwp_memory, :hwp_id, :keyname, :name, :hwp_storage, :realm_id, :user_data]
|
48
48
|
|
49
49
|
op.params.keys =~ [:realm_id, :image_id, :hwp_id]
|
50
50
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
=header "Associate to instance"
|
2
|
+
=subheader @address.id
|
3
|
+
|
4
|
+
%div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog'}
|
5
|
+
%form{ :action => associate_address_url(@address.id), :method => :post}
|
6
|
+
%div{ 'data-role' => :fieldcontain }
|
7
|
+
%label{ :for => :name} Instance:
|
8
|
+
%select{:name => 'instance_id'}
|
9
|
+
%option
|
10
|
+
- @instances.each do |inst|
|
11
|
+
%option{ :value => inst.id } #{inst.id} - #{inst.name}
|
12
|
+
%button{ :type => :submit} Associate
|
@@ -0,0 +1,9 @@
|
|
1
|
+
=header "Addresses" do
|
2
|
+
%a{ :href => "#", :onclick => "create_address('#{create_address_url}')", :'data-icon' => :plus, :'data-role' => :button, :class => 'ui-btn-right', :'data-ajax' => "false", :method => :post} Create new address
|
3
|
+
=subheader "#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
|
4
|
+
|
5
|
+
%div{ :'data-role' => :content, :'data-theme' => 'c'}
|
6
|
+
%ul#address_list{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'a'}
|
7
|
+
%li{ :'data-role' => 'list-divider'}=driver_symbol
|
8
|
+
- @elements.each do |address|
|
9
|
+
= haml :"addresses/_address", :locals => { :@address => address, :partial => true }
|
@@ -0,0 +1,21 @@
|
|
1
|
+
=header "Address"
|
2
|
+
=subheader @address.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'} Address
|
7
|
+
%li
|
8
|
+
%p{ :'data-role' => 'fieldcontain'}=@address.id
|
9
|
+
%li{ :'data-role' => 'list-divider'} Associated to instance
|
10
|
+
%li
|
11
|
+
%p{ :'data-role' => 'fieldcontain'}=@address.instance_id || "Not associated yet"
|
12
|
+
%li{ :'data-role' => 'list-divider'} Actions
|
13
|
+
%li
|
14
|
+
%div{ :'data-role' => 'controlgroup', :'data-type' => "horizontal" }
|
15
|
+
- if @address.associated?
|
16
|
+
=link_to @address.instance_id, instance_url(@address.instance_id)
|
17
|
+
=link_to_action 'Disassociate', disassociate_address_url(@address.id), :post
|
18
|
+
- else
|
19
|
+
- if driver.respond_to?(:associate_address)
|
20
|
+
=link_to_action 'Associate', associate_address_url(@address.id), :get
|
21
|
+
=link_to_action "Destroy", destroy_address_url(@address.id), :delete
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- unless defined?(partial)
|
2
|
+
!!! XML
|
3
|
+
%address{ :href => address_url(@address.id), :id => @address.id }
|
4
|
+
%ip<
|
5
|
+
=@address.id
|
6
|
+
%actions
|
7
|
+
- if driver.respond_to?(:destroy_address)
|
8
|
+
%link{ :rel => "destroy", :method => "delete", :href => destroy_address_url(@address.id)}
|
9
|
+
- if driver.respond_to?(:associate_address) and not @address.instance_id
|
10
|
+
%link{ :rel => "associate", :method => "post", :href => associate_address_url(@address.id)}
|
11
|
+
- if driver.respond_to?(:disassociate_address) and @address.instance_id
|
12
|
+
%link{ :rel => "disassociate", :method => "post", :href => disassociate_address_url(@address.id)}
|
13
|
+
- if @address.instance_id
|
14
|
+
%instance{ :href => instance_url(@address.instance_id), :id => @address.instance_id}
|
data/views/api/show.html.haml
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
=header "Deltacloud API #{settings.version}", :back => 'false'
|
2
|
+
=subheader "#{driver_symbol}@#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
|
3
3
|
|
4
|
-
%
|
5
|
-
-
|
6
|
-
|
7
|
-
= link_to key.to_s.gsub('_', ' ').titlecase,
|
8
|
-
%dl
|
9
|
-
- collections[key].operations.each_key do |op|
|
10
|
-
- next if [:index, :show].include?(op)
|
11
|
-
%dt
|
12
|
-
= op
|
4
|
+
%div{ :'data-role' => :content, :'data-theme' => 'c'}
|
5
|
+
%ul{ :'data-role' => :listview, :'data-inset' => 'true'}
|
6
|
+
- @collections.sort_by { |k| k.to_s }.each do |key|
|
7
|
+
%li= link_to key.to_s.gsub('_', ' ').titlecase, api_url_for(key), :'data-icon' => "arrow-r", :'data-ajax' => false
|
data/views/api/show.xml.haml
CHANGED
data/views/blobs/new.html.haml
CHANGED
@@ -1,26 +1,27 @@
|
|
1
|
-
|
1
|
+
=header "Create new blob"
|
2
2
|
|
3
|
-
%
|
4
|
-
%
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
%div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog'}
|
4
|
+
%form{ :action => bucket_url(@bucket_id), :method => :post, :enctype => 'multipart/form-data', "data-ajax" => "false"}
|
5
|
+
%div{ 'data-role' => :fieldcontain }
|
6
|
+
%label
|
7
|
+
Blob Name:
|
8
|
+
%input{ :name => 'blob_id', :size => 512}/
|
9
|
+
%div{ 'data-role' => :fieldcontain }
|
10
|
+
%label
|
11
|
+
Blob Data:
|
12
|
+
%input{ :type => "file", :name => 'blob_data', :size => 50}/
|
13
|
+
%input{ :type => "hidden", :name => "meta_params", :value => "0"}
|
14
|
+
%a{ :href => "javascript:;", :onclick => "more_fields();"} Add Metadata
|
15
|
+
%div{ :id => "metadata_holder", :style => "display: none;", :'data-role' => :fieldcontain}
|
16
|
+
%label
|
17
|
+
Metadata Key:
|
18
|
+
%input{ :type => "text", :name => "meta_name", :value => ""}/
|
19
|
+
%br
|
20
|
+
%label
|
21
|
+
Metadata Value:
|
22
|
+
%input{ :type => "text", :name => "meta_value", :value => ""}/
|
23
|
+
%br
|
24
|
+
%a{ :href => "javascript:;", :onclick => "less_fields();"} Less Metadata
|
9
25
|
%br
|
10
|
-
%input{ :type => "file", :name => 'blob_data', :size => 50}/
|
11
26
|
%br
|
12
|
-
%
|
13
|
-
%input{ :type => "hidden", :name => "meta_params", :value => "0"}
|
14
|
-
%a{ :href => "javascript:;", :onclick => "more_fields();"} Add Metadata
|
15
|
-
%div{ :id => "metadata_holder", :style => "display: none;"}
|
16
|
-
%label
|
17
|
-
Metadata Key:
|
18
|
-
%input{ :type => "text", :name => "meta_name", :value => ""}/
|
19
|
-
%label
|
20
|
-
Metadata Value:
|
21
|
-
%input{ :type => "text", :name => "meta_value", :value => ""}/
|
22
|
-
%br
|
23
|
-
%a{ :href => "javascript:;", :onclick => "less_fields();"} Less Metadata
|
24
|
-
%br
|
25
|
-
%br
|
26
|
-
%input{ :type => :submit, :name => "commit", :value => "create"}/
|
27
|
+
%input{ :type => :submit, :name => "commit", :value => "create"}/
|
data/views/blobs/show.html.haml
CHANGED
@@ -1,32 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
= @blob.id
|
1
|
+
=header "Blob"
|
2
|
+
=subheader @blob.id
|
4
3
|
|
5
|
-
%
|
6
|
-
%
|
7
|
-
%
|
8
|
-
%
|
9
|
-
|
10
|
-
%
|
11
|
-
%
|
12
|
-
|
13
|
-
%
|
14
|
-
%
|
15
|
-
|
16
|
-
%
|
17
|
-
%
|
18
|
-
|
19
|
-
%
|
20
|
-
%
|
21
|
-
|
22
|
-
%
|
23
|
-
%
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
%
|
30
|
-
|
31
|
-
|
32
|
-
|
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'} Bucket
|
7
|
+
%li
|
8
|
+
%p{ :'data-role' => 'fieldcontain'}=@blob.bucket
|
9
|
+
%li{ :'data-role' => 'list-divider'} Content length
|
10
|
+
%li
|
11
|
+
%p{ :'data-role' => 'fieldcontain'}=@blob.content_length
|
12
|
+
%li{ :'data-role' => 'list-divider'} Content type
|
13
|
+
%li
|
14
|
+
%p{ :'data-role' => 'fieldcontain'}=@blob.content_type
|
15
|
+
%li{ :'data-role' => 'list-divider'} Last modified
|
16
|
+
%li
|
17
|
+
%p{ :'data-role' => 'fieldcontain'}=@blob.last_modified
|
18
|
+
%li{ :'data-role' => 'list-divider'} Content
|
19
|
+
%li
|
20
|
+
%a{ :href => bucket_url(@blob.bucket) + '/' + @blob.id + '/content' }="Download"
|
21
|
+
%li{ :'data-role' => 'list-divider'} User meta-data
|
22
|
+
%li
|
23
|
+
%p{ :'data-role' => 'fieldcontain'}
|
24
|
+
- @blob.user_metadata.each do |k,v|
|
25
|
+
%b #{k} :
|
26
|
+
#{v}
|
27
|
+
%br
|
28
|
+
%li{ :'data-role' => 'list-divider'} Actions
|
29
|
+
%li
|
30
|
+
%div{ :'data-role' => 'controlgroup', :'data-type' => "horizontal" }
|
31
|
+
=link_to_action 'Delete',bucket_url(@blob.bucket) + '/' + @blob.id, :delete
|
@@ -1,23 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%br
|
4
|
-
%p
|
5
|
-
=link_to 'Create new bucket', "/api/buckets/new"
|
1
|
+
=header "Buckets" do
|
2
|
+
%a{ :href => api_url_for('buckets/new'), :'data-icon' => :plus, :'data-role' => :button, :class => 'ui-btn-right'} Create new bucket
|
6
3
|
|
7
|
-
%
|
8
|
-
%
|
9
|
-
%tr
|
10
|
-
%th
|
11
|
-
ID
|
12
|
-
%th
|
13
|
-
Name
|
14
|
-
|
15
|
-
%tbody
|
4
|
+
%div{ :'data-role' => :content, :'data-theme' => 'c'}
|
5
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'a'}
|
16
6
|
- @buckets.each do |bucket|
|
17
|
-
%
|
18
|
-
%
|
19
|
-
|
20
|
-
|
21
|
-
=
|
22
|
-
%td
|
23
|
-
=link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete
|
7
|
+
%li
|
8
|
+
%a{ :href => bucket_url(bucket.id), :'data-ajax' => 'false'}
|
9
|
+
%img{ :class => 'ui-link-thumb', :src => '/images/bucket.png'}
|
10
|
+
%h3=bucket.name
|
11
|
+
%p=bucket.id
|
@@ -1,8 +1,4 @@
|
|
1
|
-
!!!
|
1
|
+
!!!XML
|
2
2
|
%buckets
|
3
|
-
- @elements.each do |
|
4
|
-
|
5
|
-
- bucket.attributes.select{ |attr| attr!=:id }.each do |attribute|
|
6
|
-
- haml_tag("#{attribute}".tr('-', '_'), :<) do
|
7
|
-
- haml_concat bucket.send(attribute)
|
8
|
-
|
3
|
+
- @elements.each do |c|
|
4
|
+
= haml :'buckets/show', :locals => { :@bucket => c, :partial => true }
|
data/views/buckets/new.html.haml
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
|
1
|
+
=header "New bucket"
|
2
2
|
|
3
|
-
%
|
4
|
-
%
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
%
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
%div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog'}
|
4
|
+
%form{ :action => buckets_url, :method => :post }
|
5
|
+
%label
|
6
|
+
Bucket Name:
|
7
|
+
%input{ :name => 'name', :size => 250}/
|
8
|
+
%br
|
9
|
+
-if driver_has_bucket_location_feature?
|
10
|
+
%p
|
11
|
+
%label
|
12
|
+
Location: (optional)
|
13
|
+
%input{ :name => 'location', :size => 20 }/
|
14
|
+
%input{ :type => :submit, :name => "commit", :value => "create"}/
|