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/lib/fog.rb
CHANGED
data/lib/fog/bin.rb
CHANGED
data/lib/fog/bin/openstack.rb
CHANGED
@@ -4,39 +4,43 @@ module Fog
|
|
4
4
|
class Mock
|
5
5
|
def self.mock_data
|
6
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
:
|
37
|
-
|
38
|
-
|
39
|
-
|
7
|
+
:volumes => {},
|
8
|
+
:servers => {},
|
9
|
+
:vlans => {},
|
10
|
+
:ips => {},
|
11
|
+
:profile => {
|
12
|
+
:login_sms => false,
|
13
|
+
:town => "",
|
14
|
+
:postcode => "",
|
15
|
+
:reseller => "",
|
16
|
+
:has_autotopup => false,
|
17
|
+
:currency => "CHF",
|
18
|
+
:state => "REGULAR",
|
19
|
+
:uuid => "6c2203a1-a2e6-433f-aeab-b976b8cd3d18",
|
20
|
+
:company => "",
|
21
|
+
:api_https_only => false,
|
22
|
+
:my_notes => "",
|
23
|
+
:key_auth => false,
|
24
|
+
:email => "MyFirstName.MyLasttName@MyCompany.com",
|
25
|
+
:bank_reference => "mmlastname278",
|
26
|
+
:first_name => "MyFirstName",
|
27
|
+
:meta =>"",
|
28
|
+
:phone => "",
|
29
|
+
:language => "EN",
|
30
|
+
:vat => "",
|
31
|
+
:last_name => "MyLasttName",
|
32
|
+
:title => "",
|
33
|
+
:mailing_list => true,
|
34
|
+
:autotopup_amount => 0.0,
|
35
|
+
:country => "",
|
36
|
+
:address => ""
|
37
|
+
},
|
38
|
+
:subscriptions => {},
|
39
|
+
:current_usage => {},
|
40
|
+
:balance => {
|
41
|
+
:balance => 100,
|
42
|
+
:currency => 'CHF'
|
43
|
+
}
|
40
44
|
}
|
41
45
|
end
|
42
46
|
end
|
data/lib/fog/glesys/compute.rb
CHANGED
@@ -14,11 +14,14 @@ module Fog
|
|
14
14
|
model :template
|
15
15
|
collection :ips
|
16
16
|
model :ip
|
17
|
+
collection :ssh_keys
|
18
|
+
model :ssh_key
|
17
19
|
|
18
20
|
request_path 'fog/glesys/requests/compute'
|
19
21
|
|
20
22
|
# Server
|
21
23
|
request :create
|
24
|
+
request :edit
|
22
25
|
request :destroy
|
23
26
|
request :list_servers
|
24
27
|
request :server_details
|
@@ -39,6 +42,11 @@ module Fog
|
|
39
42
|
request :ip_add
|
40
43
|
request :ip_remove
|
41
44
|
|
45
|
+
# SSH keys
|
46
|
+
request :ssh_key_list
|
47
|
+
request :ssh_key_add
|
48
|
+
request :ssh_key_remove
|
49
|
+
|
42
50
|
class Mock
|
43
51
|
def initialize(options={})
|
44
52
|
@api_url = options[:glesys_api_url] || API_URL
|
@@ -120,7 +128,7 @@ module Fog
|
|
120
128
|
end
|
121
129
|
|
122
130
|
def urlencode(hash)
|
123
|
-
hash.to_a.map! { |k, v| "#{k}=#{v.to_s}" }.join("&")
|
131
|
+
hash.to_a.map! { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join("&")
|
124
132
|
end
|
125
133
|
end
|
126
134
|
end
|
@@ -53,28 +53,39 @@ module Fog
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def save
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
:
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
56
|
+
if self.identity
|
57
|
+
options = {
|
58
|
+
:serverid => self.identity,
|
59
|
+
:disksize => disksize,
|
60
|
+
:memorysize => memorysize,
|
61
|
+
:cpucores => cpucores,
|
62
|
+
:hostname => hostname,
|
63
|
+
:bandwidth => bandwidth
|
64
|
+
}
|
65
|
+
data = service.edit(options)
|
66
|
+
else
|
67
|
+
requires :hostname, :rootpassword
|
68
|
+
|
69
|
+
options = {
|
70
|
+
:datacenter => datacenter || "Falkenberg",
|
71
|
+
:platform => platform || "OpenVz",
|
72
|
+
:hostname => hostname,
|
73
|
+
:templatename => templatename || "Debian 7.0 64-bit",
|
74
|
+
:disksize => disksize || "10",
|
75
|
+
:memorysize => memorysize || "512",
|
76
|
+
:cpucores => cpucores || "1",
|
77
|
+
:rootpassword => rootpassword,
|
78
|
+
:transfer => transfer || "500",
|
79
|
+
:bandwidth => bandwidth || "10",
|
80
|
+
}
|
81
|
+
|
82
|
+
# optional options when creating a server:
|
83
|
+
[:ip, :ipv6, :description].each do |k|
|
84
|
+
options[k] = attributes[k] if attributes[k]
|
85
|
+
end
|
86
|
+
|
87
|
+
data = service.create(options)
|
75
88
|
end
|
76
|
-
|
77
|
-
data = service.create(options)
|
78
89
|
merge_attributes(data.body['response']['server'])
|
79
90
|
data.status == 200 ? true : false
|
80
91
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Glesys
|
4
|
+
class SshKey < Fog::Model
|
5
|
+
identity :id
|
6
|
+
|
7
|
+
attribute :description
|
8
|
+
attribute :data
|
9
|
+
|
10
|
+
def save
|
11
|
+
requires :description, :data
|
12
|
+
|
13
|
+
merge_attributes(service.ssh_key_add(:description => description,
|
14
|
+
:sshkey => data
|
15
|
+
).body["response"]["sshkey"])
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def destroy
|
20
|
+
requires :id
|
21
|
+
|
22
|
+
service.ssh_key_remove(:sshkeyids => id)
|
23
|
+
true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "fog/glesys/models/compute/ssh_key"
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module Compute
|
5
|
+
class Glesys
|
6
|
+
class SshKeys < Fog::Collection
|
7
|
+
model Fog::Compute::Glesys::SshKey
|
8
|
+
|
9
|
+
def all
|
10
|
+
data = service.ssh_key_list.body["response"]["sshkeys"]
|
11
|
+
load(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get(id)
|
15
|
+
hash = service.ssh_key_list.body["response"]["sshkeys"].find{|a| a["id"] == id}
|
16
|
+
hash.nil? ? nil : new(hash)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/fog/google/compute.rb
CHANGED
@@ -129,6 +129,20 @@ module Fog
|
|
129
129
|
Fog::Compute::Google::Operations.new(:service => service).get(data.body['name'], data.body['zone'])
|
130
130
|
end
|
131
131
|
|
132
|
+
def start
|
133
|
+
requires :identity, :zone
|
134
|
+
|
135
|
+
data = service.start_server(identity, zone_name)
|
136
|
+
Fog::Compute::Google::Operations.new(:service => service).get(data.body['name'], data.body['zone'])
|
137
|
+
end
|
138
|
+
|
139
|
+
def stop
|
140
|
+
requires :identity, :zone
|
141
|
+
|
142
|
+
data = service.stop_server(identity, zone_name)
|
143
|
+
Fog::Compute::Google::Operations.new(:service => service).get(data.body['name'], data.body['zone'])
|
144
|
+
end
|
145
|
+
|
132
146
|
def serial_port_output
|
133
147
|
requires :identity, :zone
|
134
148
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def start_server(identity, zone_name)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def start_server(identity, zone_name)
|
12
|
+
api_method = @compute.instances.start
|
13
|
+
parameters = {
|
14
|
+
'project' => @project,
|
15
|
+
'zone' => zone_name,
|
16
|
+
'instance' => identity,
|
17
|
+
}
|
18
|
+
|
19
|
+
request(api_method, parameters)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Google
|
4
|
+
class Mock
|
5
|
+
def stop_server(identity, zone_name)
|
6
|
+
Fog::Mock.not_implemented
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class Real
|
11
|
+
def stop_server(identity, zone_name)
|
12
|
+
api_method = @compute.instances.stop
|
13
|
+
parameters = {
|
14
|
+
'project' => @project,
|
15
|
+
'zone' => zone_name,
|
16
|
+
'instance' => identity,
|
17
|
+
}
|
18
|
+
|
19
|
+
request(api_method, parameters)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/fog/linode/compute.rb
CHANGED
@@ -33,8 +33,15 @@ module Fog
|
|
33
33
|
request :linode_disk_create
|
34
34
|
request :linode_disk_list
|
35
35
|
request :linode_disk_delete
|
36
|
+
request :linode_disk_resize
|
37
|
+
request :linode_disk_update
|
38
|
+
request :linode_disk_imagize
|
39
|
+
request :linode_disk_duplicate
|
36
40
|
request :linode_disk_createfromdistribution
|
37
41
|
request :linode_disk_createfromstackscript
|
42
|
+
request :linode_disk_createfromimage
|
43
|
+
request :image_list
|
44
|
+
request :image_delete
|
38
45
|
request :linode_ip_list
|
39
46
|
request :linode_ip_addprivate
|
40
47
|
request :linode_config_list
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Linode
|
4
|
+
class Real
|
5
|
+
def image_delete(image_id)
|
6
|
+
request(
|
7
|
+
:expects => 200,
|
8
|
+
:method => 'GET',
|
9
|
+
:query => {
|
10
|
+
:api_action => 'image.delete',
|
11
|
+
:imageId => image_id
|
12
|
+
}
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Mock
|
18
|
+
def image_delete(image_id, status='available')
|
19
|
+
size = rand(1..999999)
|
20
|
+
response = Excon::Response.new
|
21
|
+
response.status = 200
|
22
|
+
response.body = {
|
23
|
+
"ERRORARRAY" => [],
|
24
|
+
"ACTION" => "image.delete",
|
25
|
+
"DATA" => { "LAST_USED_DT" => "2014-07-21 12:31:54.0",
|
26
|
+
"DESCRIPTION" => "Fog Mock Linode Image #{image_id}",
|
27
|
+
"LABEL" => "test_#{image_id}_image",
|
28
|
+
"STATUS" => status,
|
29
|
+
"SIZE" => size,
|
30
|
+
"ISPUBLIC" => rand(0..1),
|
31
|
+
"CREATE_DT" => "2014-06-23 13:45:12.0",
|
32
|
+
"USED" => rand(1..size),
|
33
|
+
"FS_TYPE" => "ext4",
|
34
|
+
"USERID" => Fog::Mock.random_numbers(4),
|
35
|
+
"IMAGEID" => image_id }
|
36
|
+
}
|
37
|
+
response
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|