fog 1.28.0 → 1.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +111 -0
- data/CONTRIBUTING.md +255 -1
- data/Rakefile +1 -1
- data/fog.gemspec +41 -44
- data/lib/fog.rb +1 -0
- data/lib/fog/bin.rb +1 -0
- data/lib/fog/bin/openstack.rb +2 -0
- data/lib/fog/cloudsigma/mock_data.rb +37 -33
- data/lib/fog/dnsmadeeasy/models/dns/record.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/api_version.rb +1 -1
- data/lib/fog/glesys/compute.rb +9 -1
- data/lib/fog/glesys/models/compute/server.rb +32 -21
- data/lib/fog/glesys/models/compute/ssh_key.rb +28 -0
- data/lib/fog/glesys/models/compute/ssh_keys.rb +21 -0
- data/lib/fog/glesys/requests/compute/edit.rb +11 -0
- data/lib/fog/glesys/requests/compute/ssh_key_add.rb +11 -0
- data/lib/fog/glesys/requests/compute/ssh_key_list.rb +11 -0
- data/lib/fog/glesys/requests/compute/ssh_key_remove.rb +11 -0
- data/lib/fog/google/compute.rb +2 -0
- data/lib/fog/google/models/compute/server.rb +14 -0
- data/lib/fog/google/requests/compute/start_server.rb +24 -0
- data/lib/fog/google/requests/compute/stop_server.rb +24 -0
- data/lib/fog/linode/compute.rb +7 -0
- data/lib/fog/linode/requests/compute/image_delete.rb +42 -0
- data/lib/fog/linode/requests/compute/image_list.rb +64 -0
- data/lib/fog/linode/requests/compute/linode_disk_createfromimage.rb +37 -0
- data/lib/fog/linode/requests/compute/linode_disk_duplicate.rb +33 -0
- data/lib/fog/linode/requests/compute/linode_disk_imagize.rb +37 -0
- data/lib/fog/linode/requests/compute/linode_disk_resize.rb +36 -0
- data/lib/fog/linode/requests/compute/linode_disk_update.rb +34 -0
- data/lib/fog/openstack.rb +1 -0
- data/lib/fog/openstack/compute.rb +12 -1
- data/lib/fog/openstack/core.rb +159 -5
- data/lib/fog/openstack/docs/planning.md +270 -0
- data/lib/fog/openstack/examples/planning/basics.rb +53 -0
- data/lib/fog/openstack/models/planning/plan.rb +81 -0
- data/lib/fog/openstack/models/planning/plans.rb +31 -0
- data/lib/fog/openstack/models/planning/role.rb +29 -0
- data/lib/fog/openstack/models/planning/roles.rb +16 -0
- data/lib/fog/openstack/planning.rb +235 -0
- data/lib/fog/openstack/requests/compute/get_hypervisor_statistics.rb +39 -0
- data/lib/fog/openstack/requests/identity/check_token.rb +4 -2
- data/lib/fog/openstack/requests/identity/validate_token.rb +4 -2
- data/lib/fog/openstack/requests/planning/add_role_to_plan.rb +40 -0
- data/lib/fog/openstack/requests/planning/create_plan.rb +33 -0
- data/lib/fog/openstack/requests/planning/delete_plan.rb +23 -0
- data/lib/fog/openstack/requests/planning/get_plan.rb +58 -0
- data/lib/fog/openstack/requests/planning/get_plan_templates.rb +28 -0
- data/lib/fog/openstack/requests/planning/list_plans.rb +60 -0
- data/lib/fog/openstack/requests/planning/list_roles.rb +38 -0
- data/lib/fog/openstack/requests/planning/patch_plan.rb +51 -0
- data/lib/fog/openstack/requests/planning/remove_role_from_plan.rb +32 -0
- data/lib/fog/ovirt/compute.rb +10 -0
- data/lib/fog/ovirt/models/compute/affinity_group.rb +25 -0
- data/lib/fog/ovirt/models/compute/affinity_groups.rb +20 -0
- data/lib/fog/ovirt/models/compute/server.rb +12 -0
- data/lib/fog/ovirt/models/compute/volume.rb +2 -0
- data/lib/fog/ovirt/requests/compute/add_to_affinity_group.rb +21 -0
- data/lib/fog/ovirt/requests/compute/create_affinity_group.rb +18 -0
- data/lib/fog/ovirt/requests/compute/destroy_affinity_group.rb +19 -0
- data/lib/fog/ovirt/requests/compute/get_affinity_group.rb +18 -0
- data/lib/fog/ovirt/requests/compute/list_affinity_group_vms.rb +22 -0
- data/lib/fog/ovirt/requests/compute/list_affinity_groups.rb +20 -0
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup.xml +8 -0
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup_vms.xml +9 -0
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroups.xml +17 -0
- data/lib/fog/ovirt/requests/compute/remove_from_affinity_group.rb +21 -0
- data/lib/fog/ovirt/requests/compute/update_interface.rb +18 -5
- data/lib/fog/rackspace/docs/block_storage.md +1 -1
- data/lib/fog/rackspace/docs/cdn_v2.md +1 -1
- data/lib/fog/rackspace/docs/compute_v2.md +1 -1
- data/lib/fog/rackspace/docs/getting_started.md +1 -1
- data/lib/fog/rackspace/docs/networking_v2.md +1 -1
- data/lib/fog/rackspace/docs/storage.md +1 -1
- data/lib/fog/rackspace/examples/README.md +1 -1
- data/lib/fog/rackspace/mock_data.rb +48 -48
- data/lib/fog/rackspace/models/networking_v2/security_group.rb +32 -0
- data/lib/fog/rackspace/models/networking_v2/security_group_rule.rb +38 -0
- data/lib/fog/rackspace/models/networking_v2/security_group_rules.rb +23 -0
- data/lib/fog/rackspace/models/networking_v2/security_groups.rb +23 -0
- data/lib/fog/rackspace/networking_v2.rb +24 -7
- data/lib/fog/rackspace/requests/networking_v2/create_security_group.rb +12 -0
- data/lib/fog/rackspace/requests/networking_v2/create_security_group_rule.rb +12 -0
- data/lib/fog/rackspace/requests/networking_v2/delete_security_group.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/delete_security_group_rule.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/list_security_group_rules.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/list_security_groups.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/show_security_group.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/show_security_group_rule.rb +5 -0
- data/lib/fog/rackspace/requests/networking_v2/update_security_group.rb +12 -0
- data/lib/fog/rackspace/requests/storage/get_object_https_url.rb +1 -1
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +13 -4
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +19 -6
- data/lib/fog/xenserver/requests/compute/create_vdi.rb +16 -6
- data/lib/tasks/changelog_task.rb +2 -1
- data/spec/fog/account_spec.rb +1 -2
- data/spec/fog/billing_spec.rb +1 -2
- data/spec/fog/bin/atmos_spec.rb +25 -2
- data/spec/fog/bin/aws_spec.rb +1 -2
- data/spec/fog/bin/baremetalcloud_spec.rb +25 -2
- data/spec/fog/bin/bluebox_spec.rb +47 -2
- data/spec/fog/bin/brightbox_spec.rb +1 -2
- data/spec/fog/bin/clodo_spec.rb +1 -2
- data/spec/fog/bin/cloudsigma_spec.rb +1 -2
- data/spec/fog/bin/cloudstack_spec.rb +1 -2
- data/spec/fog/bin/digitalocean_spec.rb +1 -2
- data/spec/fog/bin/dnsimple_spec.rb +1 -2
- data/spec/fog/bin/dnsmadeeasy_spec.rb +1 -2
- data/spec/fog/bin/dreamhost_spec.rb +1 -2
- data/spec/fog/bin/dynect_spec.rb +1 -2
- data/spec/fog/bin/powerdns_spec.rb +9 -0
- data/spec/fog/bin_spec.rb +4 -2
- data/spec/fog/cdn_spec.rb +1 -2
- data/spec/fog/compute_spec.rb +1 -2
- data/spec/fog/dns_spec.rb +1 -2
- data/spec/fog/identity_spec.rb +1 -2
- data/spec/fog/image_spec.rb +1 -2
- data/spec/fog/metering_spec.rb +1 -2
- data/spec/fog/monitoring_spec.rb +1 -2
- data/spec/fog/network_spec.rb +1 -2
- data/spec/fog/orchestration_spec.rb +1 -2
- data/spec/fog/storage_spec.rb +1 -2
- data/spec/fog/support_spec.rb +1 -2
- data/spec/fog/volume_spec.rb +1 -2
- data/spec/fog/vpn_spec.rb +1 -2
- data/spec/fog/xml/connection_spec.rb +1 -2
- data/spec/helpers/bin.rb +4 -0
- data/spec/spec_helper.rb +15 -0
- data/tests/compute/helper.rb +3 -0
- data/tests/glesys/requests/compute/helper.rb +66 -2
- data/tests/glesys/requests/compute/server_tests.rb +22 -6
- data/tests/glesys/requests/compute/ssh_key_tests.rb +47 -0
- data/tests/google/credentials_tests.rb +73 -0
- data/tests/helper.rb +5 -1
- data/tests/linode/requests/compute/linode_tests.rb +76 -3
- data/tests/openstack/authenticate_tests.rb +10 -0
- data/tests/openstack/models/planning/.gitkeep +0 -0
- data/tests/openstack/models/planning/plan_tests.rb +51 -0
- data/tests/openstack/models/planning/plans_tests.rb +18 -0
- data/tests/openstack/models/planning/role_tests.rb +14 -0
- data/tests/openstack/requests/planning/.gitkeep +0 -0
- data/tests/openstack/requests/planning/plan_tests.rb +65 -0
- data/tests/openstack/requests/planning/role_tests.rb +16 -0
- metadata +193 -75
- data/lib/fog/bin/atmos.rb +0 -29
- data/lib/fog/bin/local.rb +0 -29
- data/lib/fog/local.rb +0 -1
- data/lib/fog/local/core.rb +0 -9
- data/lib/fog/local/models/storage/directories.rb +0 -33
- data/lib/fog/local/models/storage/directory.rb +0 -53
- data/lib/fog/local/models/storage/file.rb +0 -132
- data/lib/fog/local/models/storage/files.rb +0 -84
- data/lib/fog/local/storage.rb +0 -96
- data/tests/local/models/directories_tests.rb +0 -17
- data/tests/local/models/directory_tests.rb +0 -16
- data/tests/local/models/file_tests.rb +0 -43
- data/tests/local/storage_tests.rb +0 -40
data/spec/fog/bin/dynect_spec.rb
CHANGED
data/spec/fog/bin_spec.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require "
|
2
|
-
require "fog"
|
1
|
+
require "spec_helper"
|
3
2
|
require "fog/bin"
|
4
3
|
|
5
4
|
describe Fog do
|
@@ -35,6 +34,7 @@ describe Fog do
|
|
35
34
|
assert_equal "OpenStack", Fog.providers[:openstack]
|
36
35
|
assert_equal "Openvz", Fog.providers[:openvz]
|
37
36
|
assert_equal "Ovirt", Fog.providers[:ovirt]
|
37
|
+
assert_equal "PowerDNS", Fog.providers[:powerdns]
|
38
38
|
assert_equal "ProfitBricks", Fog.providers[:profitbricks]
|
39
39
|
assert_equal "Rackspace", Fog.providers[:rackspace]
|
40
40
|
assert_equal "Rage4", Fog.providers[:rage4]
|
@@ -85,6 +85,7 @@ describe Fog do
|
|
85
85
|
assert_includes Fog.registered_providers, "OpenStack"
|
86
86
|
assert_includes Fog.registered_providers, "Openvz"
|
87
87
|
assert_includes Fog.registered_providers, "Ovirt"
|
88
|
+
assert_includes Fog.registered_providers, "PowerDNS"
|
88
89
|
assert_includes Fog.registered_providers, "ProfitBricks"
|
89
90
|
assert_includes Fog.registered_providers, "Rackspace"
|
90
91
|
assert_includes Fog.registered_providers, "Rage4"
|
@@ -135,6 +136,7 @@ describe Fog do
|
|
135
136
|
assert_includes Fog.available_providers, "OpenStack" if OpenStack.available?
|
136
137
|
assert_includes Fog.available_providers, "Openvz" if Openvz.available?
|
137
138
|
assert_includes Fog.available_providers, "Ovirt" if Ovirt.available?
|
139
|
+
assert_includes Fog.available_providers, "PowerDNS" if PowerDNS.available?
|
138
140
|
assert_includes Fog.available_providers, "ProfitBricks" if ProfitBricks.available?
|
139
141
|
assert_includes Fog.available_providers, "Rackspace" if Rackspace.available?
|
140
142
|
assert_includes Fog.available_providers, "Rage4" if Rage4.available?
|
data/spec/fog/cdn_spec.rb
CHANGED
data/spec/fog/compute_spec.rb
CHANGED
data/spec/fog/dns_spec.rb
CHANGED
data/spec/fog/identity_spec.rb
CHANGED
data/spec/fog/image_spec.rb
CHANGED
data/spec/fog/metering_spec.rb
CHANGED
data/spec/fog/monitoring_spec.rb
CHANGED
data/spec/fog/network_spec.rb
CHANGED
data/spec/fog/storage_spec.rb
CHANGED
data/spec/fog/support_spec.rb
CHANGED
data/spec/fog/volume_spec.rb
CHANGED
data/spec/fog/vpn_spec.rb
CHANGED
data/spec/helpers/bin.rb
CHANGED
@@ -23,6 +23,10 @@ module Fog
|
|
23
23
|
assert_respond_to subject, :[]
|
24
24
|
end
|
25
25
|
|
26
|
+
it "#[] when unknown service is passed raises ArgumentError" do
|
27
|
+
assert_raises(ArgumentError) { subject[:bad_service] }
|
28
|
+
end
|
29
|
+
|
26
30
|
it "responds to services" do
|
27
31
|
assert_respond_to subject, :services
|
28
32
|
end
|
data/spec/spec_helper.rb
ADDED
data/tests/compute/helper.rb
CHANGED
@@ -28,7 +28,6 @@ class Glesys
|
|
28
28
|
'server' => {
|
29
29
|
'managedhosting' => String,
|
30
30
|
'cost' => {
|
31
|
-
'amount' => Float,
|
32
31
|
'timeperiod' => String,
|
33
32
|
'currency' => String
|
34
33
|
},
|
@@ -86,6 +85,18 @@ class Glesys
|
|
86
85
|
}
|
87
86
|
)
|
88
87
|
|
88
|
+
EDIT = DETAILS.merge(
|
89
|
+
'debug' => {
|
90
|
+
'input' => {
|
91
|
+
'serverid' => Fog::Nullable::String,
|
92
|
+
'disksize' => String,
|
93
|
+
'memorysize' => String,
|
94
|
+
'cpucores' => String,
|
95
|
+
'bandwidth' => String
|
96
|
+
}
|
97
|
+
}
|
98
|
+
)
|
99
|
+
|
89
100
|
STATUS = {
|
90
101
|
'debug' => {
|
91
102
|
'input' => {
|
@@ -115,7 +126,7 @@ class Glesys
|
|
115
126
|
'unit' => Fog::Nullable::String
|
116
127
|
},
|
117
128
|
'cpu' => {
|
118
|
-
'usage' => Fog::Nullable::
|
129
|
+
'usage' => Fog::Nullable::Float,
|
119
130
|
'max' => Fog::Nullable::Integer,
|
120
131
|
'unit' => Fog::Nullable::String
|
121
132
|
},
|
@@ -229,6 +240,59 @@ class Glesys
|
|
229
240
|
}
|
230
241
|
}
|
231
242
|
end
|
243
|
+
module SshKeys
|
244
|
+
ADD = {
|
245
|
+
'debug' => {
|
246
|
+
'input' => {
|
247
|
+
'sshkey' => String,
|
248
|
+
'description' => String
|
249
|
+
}
|
250
|
+
},
|
251
|
+
'sshkey' => {
|
252
|
+
'id' => Integer,
|
253
|
+
'account' => String,
|
254
|
+
'description' => String,
|
255
|
+
'data' => String
|
256
|
+
},
|
257
|
+
'status' => {
|
258
|
+
'timestamp' => String,
|
259
|
+
'code' => Integer,
|
260
|
+
'text' => String,
|
261
|
+
'transactionid' => Fog::Nullable::String
|
262
|
+
}
|
263
|
+
}
|
264
|
+
REMOVE = {
|
265
|
+
'debug' => {
|
266
|
+
'input' => {
|
267
|
+
'sshkeyids' => String,
|
268
|
+
}
|
269
|
+
},
|
270
|
+
'status' => {
|
271
|
+
'timestamp' => String,
|
272
|
+
'code' => Integer,
|
273
|
+
'text' => String,
|
274
|
+
'transactionid' => Fog::Nullable::String
|
275
|
+
}
|
276
|
+
}
|
277
|
+
LIST = {
|
278
|
+
'debug' => {
|
279
|
+
'input' => []
|
280
|
+
},
|
281
|
+
'sshkeys' => [
|
282
|
+
{
|
283
|
+
'id' => Integer,
|
284
|
+
'account' => String,
|
285
|
+
'description' => String,
|
286
|
+
'data' => String,
|
287
|
+
}
|
288
|
+
],
|
289
|
+
'status' => {
|
290
|
+
'timestamp' => String,
|
291
|
+
'code' => Integer,
|
292
|
+
'text' => String
|
293
|
+
}
|
294
|
+
}
|
295
|
+
end
|
232
296
|
module Templates
|
233
297
|
LIST = {
|
234
298
|
'debug' => {
|
@@ -4,11 +4,11 @@ Shindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do
|
|
4
4
|
@hostname = "fog-#{Time.now.to_i}"
|
5
5
|
|
6
6
|
@create = ":hostname => #@hostname, :rootpassword => 'pw#{Time.now.to_i}', "+
|
7
|
-
":datacenter => 'Falkenberg', :platform => '
|
7
|
+
":datacenter => 'Falkenberg', :platform => 'VMware', :templatename => 'Debian 7.0 64-bit', "+
|
8
8
|
":disksize => '10', :memorysize => '512', :cpucores => '1', :transfer => '500', :bandwidth => '10'"
|
9
9
|
|
10
10
|
@create_vz = ":hostname => #@hostname, :rootpassword => 'pw#{Time.now.to_i}', "+
|
11
|
-
":datacenter => 'Stockholm', :platform => 'OpenVZ', :templatename => 'Debian
|
11
|
+
":datacenter => 'Stockholm', :platform => 'OpenVZ', :templatename => 'Debian 7.0 64-bit', "+
|
12
12
|
":disksize => '10', :memorysize => '256', :cpucores => '2', :transfer => '500', :bandwidth => '10'"
|
13
13
|
|
14
14
|
tests('success') do
|
@@ -22,10 +22,11 @@ Shindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do
|
|
22
22
|
pending if Fog.mocking?
|
23
23
|
vm = Fog::Compute[:glesys].create(
|
24
24
|
:hostname => @hostname,
|
25
|
+
:description => "Fog test server",
|
25
26
|
:rootpassword => "pw#{Time.now.to_i}",
|
26
27
|
:datacenter => "Falkenberg",
|
27
|
-
:platform => "
|
28
|
-
:templatename => "Debian-
|
28
|
+
:platform => "VMware",
|
29
|
+
:templatename => "Debian 7.0 64-bit",
|
29
30
|
:disksize => "10",
|
30
31
|
:memorysize => "512",
|
31
32
|
:cpucores => "1",
|
@@ -86,18 +87,33 @@ Shindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do
|
|
86
87
|
:rootpassword => "pw#{Time.now.to_i}",
|
87
88
|
:datacenter => "Stockholm",
|
88
89
|
:platform => "OpenVZ",
|
89
|
-
:templatename => "Debian
|
90
|
+
:templatename => "Debian 7.0 64-bit",
|
90
91
|
:disksize => "10",
|
91
92
|
:memorysize => "256",
|
92
93
|
:cpucores => "2",
|
93
94
|
:transfer => "500",
|
94
95
|
:bandwidth => "10"
|
95
96
|
)
|
96
|
-
|
97
97
|
@serverid = vm.body['response']['server']['serverid']
|
98
98
|
vm.body['response']
|
99
99
|
end
|
100
100
|
|
101
|
+
unless Fog.mocking?
|
102
|
+
Fog::Compute[:glesys].servers.get(@serverid).wait_for { ready? }
|
103
|
+
end
|
104
|
+
|
105
|
+
tests("#edit #{@serverid}").formats(Glesys::Compute::Formats::Servers::EDIT) do
|
106
|
+
pending if Fog.mocking?
|
107
|
+
vm = Fog::Compute[:glesys].edit(
|
108
|
+
:serverid => @serverid,
|
109
|
+
:disksize => "10",
|
110
|
+
:memorysize => "512",
|
111
|
+
:cpucores => "1",
|
112
|
+
:bandwidth => "10"
|
113
|
+
)
|
114
|
+
vm.body['response']
|
115
|
+
end
|
116
|
+
|
101
117
|
tests("#server_details(#{@serverid})").formats(Glesys::Compute::Formats::Servers::DETAILS) do
|
102
118
|
pending if Fog.mocking?
|
103
119
|
Fog::Compute[:glesys].server_details(@serverid).body['response']
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Shindo.tests("Fog::Compute[:glesys] | ssh_key requests", ["glesys", "compute"]) do
|
2
|
+
@testdescription = "My test key to be removed"
|
3
|
+
@testdata = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDv+r/dCIDv+YazWsyc1WCixR+iOeaswTx1U45h6vh4/ fog-unittest@GleSYS"
|
4
|
+
@testdata_malformed = "ssh-rot13 AAAAthis_is_not_an_ssh_key fog-unittest@GleSYS"
|
5
|
+
|
6
|
+
tests("success") do
|
7
|
+
tests("#ssh_key_add").formats(Glesys::Compute::Formats::SshKeys::ADD) do
|
8
|
+
pending if Fog.mocking?
|
9
|
+
@resp = Fog::Compute[:glesys].ssh_key_add(:description => @testdescription, :sshkey => @testdata)
|
10
|
+
@resp.body["response"]
|
11
|
+
end
|
12
|
+
|
13
|
+
unless Fog.mocking?
|
14
|
+
Fog::Compute[:glesys].ssh_keys.destroy(@resp.body["response"]["sshkey"]["id"])
|
15
|
+
@key = Fog::Compute[:glesys].ssh_keys.create(:description => @testdescription, :data => @testdata)
|
16
|
+
end
|
17
|
+
|
18
|
+
tests("#ssh_key_list").formats(Glesys::Compute::Formats::SshKeys::LIST) do
|
19
|
+
pending if Fog.mocking?
|
20
|
+
@resp = Fog::Compute[:glesys].ssh_key_list
|
21
|
+
@resp.body["response"]
|
22
|
+
end
|
23
|
+
|
24
|
+
unless Fog.mocking?
|
25
|
+
Fog::Compute[:glesys].ssh_keys.destroy(@key.id)
|
26
|
+
@key = Fog::Compute[:glesys].ssh_keys.create(:description => @testdescription, :data => @testdata)
|
27
|
+
end
|
28
|
+
|
29
|
+
tests("#ssh_key_remove").formats(Glesys::Compute::Formats::SshKeys::REMOVE) do
|
30
|
+
pending if Fog.mocking?
|
31
|
+
@resp = Fog::Compute[:glesys].ssh_key_remove(:sshkeyids => @key.id)
|
32
|
+
@resp.body["response"]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
tests("failure") do
|
37
|
+
tests("#ssh_key_add with malformed key data").raises(Excon::Errors::HTTPStatusError) do
|
38
|
+
pending if Fog.mocking?
|
39
|
+
Fog::Compute[:glesys].ssh_key_add(:description => @testdescription, :data => @testdata_malformed)
|
40
|
+
end
|
41
|
+
|
42
|
+
tests("#ssh_key_remove with nonexistent/invalid key id").raises(Excon::Errors::HTTPStatusError) do
|
43
|
+
pending if Fog.mocking?
|
44
|
+
Fog::Compute[:glesys].ssh_key_remove(:id => -1)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'google/api_client'
|
2
|
+
|
3
|
+
Shindo.tests('Google | credentials', ['google']) do
|
4
|
+
|
5
|
+
tests('success') do
|
6
|
+
pending if Fog.mocking?
|
7
|
+
|
8
|
+
google_key_location = Fog.credentials[:google_key_location]
|
9
|
+
if google_key_location.nil?
|
10
|
+
tests('Needs a :google_key_location credentials key').pending
|
11
|
+
end
|
12
|
+
google_key_string = File.open(File.expand_path(google_key_location), 'rb') { |io| io.read }
|
13
|
+
|
14
|
+
tests("#using_p12_key_file").succeeds do
|
15
|
+
Fog::Compute::Google.new(:google_key_location => google_key_location,
|
16
|
+
:google_key_string => nil,
|
17
|
+
:google_json_key_location => nil,
|
18
|
+
:google_json_key_string => nil)
|
19
|
+
end
|
20
|
+
|
21
|
+
tests("#using_p12_key_string").succeeds do
|
22
|
+
Fog::Compute::Google.new(:google_key_location => nil,
|
23
|
+
:google_key_string => google_key_string,
|
24
|
+
:google_json_key_location => nil,
|
25
|
+
:google_json_key_string => nil)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
tests('success') do
|
30
|
+
pending if Fog.mocking?
|
31
|
+
|
32
|
+
google_json_key_location = Fog.credentials[:google_json_key_location]
|
33
|
+
if google_json_key_location.nil?
|
34
|
+
tests('Needs a :google_json_key_location credentials key').pending
|
35
|
+
end
|
36
|
+
google_json_key_string = File.open(File.expand_path(google_json_key_location), 'rb') { |io| io.read }
|
37
|
+
|
38
|
+
tests("#using_json_key_file").succeeds do
|
39
|
+
Fog::Compute::Google.new(:google_key_location => nil,
|
40
|
+
:google_key_string => nil,
|
41
|
+
:google_json_key_location => google_json_key_location,
|
42
|
+
:google_json_key_string => nil)
|
43
|
+
end
|
44
|
+
|
45
|
+
tests("#using_json_key_string").succeeds do
|
46
|
+
Fog::Compute::Google.new(:google_key_location => nil,
|
47
|
+
:google_key_string => nil,
|
48
|
+
:google_json_key_location => nil,
|
49
|
+
:google_json_key_string => google_json_key_string)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
tests('failure') do
|
54
|
+
tests("#missing_google_project").raises(ArgumentError, 'raises ArgumentError when google_project is missing') do
|
55
|
+
Fog::Compute::Google.new(:google_project => nil)
|
56
|
+
end
|
57
|
+
|
58
|
+
tests("#missing_google_client_email").raises(ArgumentError, 'raises ArgumentError when google_client_email is missing') do
|
59
|
+
pending if Fog.mocking? # Mock doesn't check google_client_email
|
60
|
+
Fog::Compute::Google.new(:google_client_email => nil,
|
61
|
+
:google_json_key_location => nil) # JSON key overrides google_client_email
|
62
|
+
end
|
63
|
+
|
64
|
+
tests("#missing_keys").raises(ArgumentError, 'raises ArgumentError when google keys are missing') do
|
65
|
+
pending if Fog.mocking? # Mock doesn't check missing keys
|
66
|
+
Fog::Compute::Google.new(:google_key_location => nil,
|
67
|
+
:google_key_string => nil,
|
68
|
+
:google_json_key_location => nil,
|
69
|
+
:google_json_key_string => nil)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|