fog 1.27.0 → 1.28.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 +71 -0
- data/Rakefile +2 -2
- data/bin/fog +2 -2
- data/fog.gemspec +4 -3
- data/lib/fog/bin/clodo.rb +1 -1
- data/lib/fog/bin/openstack.rb +5 -0
- data/lib/fog/digitalocean/examples/getting_started.md +46 -4
- data/lib/fog/digitalocean/models/compute/server.rb +1 -3
- data/lib/fog/digitalocean/models/compute/servers.rb +30 -0
- data/lib/fog/fogdocker/compute.rb +3 -2
- data/lib/fog/fogdocker/requests/compute/container_action.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_all.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_commit.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_create.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_delete.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/container_get.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_all.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_create.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_delete.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_get.rb +1 -1
- data/lib/fog/fogdocker/requests/compute/image_search.rb +1 -1
- data/lib/fog/google/compute.rb +2 -1
- data/lib/fog/google/core.rb +42 -12
- data/lib/fog/google/dns.rb +2 -1
- data/lib/fog/google/monitoring.rb +1 -1
- data/lib/fog/google/sql.rb +1 -1
- data/lib/fog/hp/requests/storage/get_object.rb +5 -3
- data/lib/fog/joyent/compute.rb +2 -0
- data/lib/fog/openstack.rb +1 -0
- data/lib/fog/openstack/baremetal.rb +370 -0
- data/lib/fog/openstack/core.rb +1 -0
- data/lib/fog/openstack/docs/orchestration.md +318 -0
- data/lib/fog/openstack/docs/storage.md +1 -7
- data/lib/fog/openstack/models/baremetal/chassis.rb +60 -0
- data/lib/fog/openstack/models/baremetal/chassis_collection.rb +38 -0
- data/lib/fog/openstack/models/baremetal/driver.rb +30 -0
- data/lib/fog/openstack/models/baremetal/drivers.rb +21 -0
- data/lib/fog/openstack/models/baremetal/node.rb +85 -0
- data/lib/fog/openstack/models/baremetal/nodes.rb +38 -0
- data/lib/fog/openstack/models/baremetal/port.rb +61 -0
- data/lib/fog/openstack/models/baremetal/ports.rb +38 -0
- data/lib/fog/openstack/models/orchestration/event.rb +20 -0
- data/lib/fog/openstack/models/orchestration/events.rb +28 -0
- data/lib/fog/openstack/models/orchestration/resource.rb +32 -0
- data/lib/fog/openstack/models/orchestration/resource_schemas.rb +17 -0
- data/lib/fog/openstack/models/orchestration/resources.rb +35 -0
- data/lib/fog/openstack/models/orchestration/stack.rb +91 -24
- data/lib/fog/openstack/models/orchestration/stacks.rb +38 -4
- data/lib/fog/openstack/models/orchestration/template.rb +15 -0
- data/lib/fog/openstack/models/orchestration/templates.rb +44 -0
- data/lib/fog/openstack/orchestration.rb +48 -2
- data/lib/fog/openstack/requests/baremetal/create_chassis.rb +44 -0
- data/lib/fog/openstack/requests/baremetal/create_node.rb +54 -0
- data/lib/fog/openstack/requests/baremetal/create_port.rb +46 -0
- data/lib/fog/openstack/requests/baremetal/delete_chassis.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/delete_node.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/delete_port.rb +25 -0
- data/lib/fog/openstack/requests/baremetal/get_chassis.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_driver.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_driver_properties.rb +40 -0
- data/lib/fog/openstack/requests/baremetal/get_node.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/get_port.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/list_chassis.rb +48 -0
- data/lib/fog/openstack/requests/baremetal/list_chassis_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/list_drivers.rb +24 -0
- data/lib/fog/openstack/requests/baremetal/list_nodes.rb +40 -0
- data/lib/fog/openstack/requests/baremetal/list_nodes_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/list_ports.rb +48 -0
- data/lib/fog/openstack/requests/baremetal/list_ports_detailed.rb +31 -0
- data/lib/fog/openstack/requests/baremetal/patch_chassis.rb +42 -0
- data/lib/fog/openstack/requests/baremetal/patch_node.rb +41 -0
- data/lib/fog/openstack/requests/baremetal/patch_port.rb +41 -0
- data/lib/fog/openstack/requests/compute/create_server.rb +1 -0
- data/lib/fog/openstack/requests/orchestration/abandon_stack.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/build_info.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/create_stack.rb +31 -12
- data/lib/fog/openstack/requests/orchestration/delete_stack.rb +28 -5
- data/lib/fog/openstack/requests/orchestration/get_stack_template.rb +20 -0
- data/lib/fog/openstack/requests/orchestration/list_resource_events.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/list_resource_types.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/list_resources.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/list_stack_data.rb +27 -0
- data/lib/fog/openstack/requests/orchestration/list_stack_events.rb +23 -0
- data/lib/fog/openstack/requests/orchestration/preview_stack.rb +16 -0
- data/lib/fog/openstack/requests/orchestration/show_event_details.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_data.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_metadata.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_schema.rb +15 -0
- data/lib/fog/openstack/requests/orchestration/show_resource_template.rb +20 -0
- data/lib/fog/openstack/requests/orchestration/show_stack_details.rb +26 -0
- data/lib/fog/openstack/requests/orchestration/update_stack.rb +34 -7
- data/lib/fog/openstack/requests/orchestration/validate_template.rb +16 -0
- data/lib/fog/openstack/volume.rb +0 -1
- data/lib/fog/ovirt/compute.rb +6 -0
- data/lib/fog/ovirt/models/compute/server.rb +10 -0
- data/lib/fog/ovirt/models/compute/template.rb +1 -0
- data/lib/fog/ovirt/models/compute/volumes.rb +1 -2
- data/lib/fog/ovirt/requests/compute/attach_volume.rb +22 -0
- data/lib/fog/ovirt/requests/compute/detach_volume.rb +22 -0
- data/lib/fog/ovirt/requests/compute/list_volumes.rb +19 -0
- data/lib/fog/ovirt/requests/compute/mock_files/disks.xml +58 -0
- data/lib/fog/vcloud_director/models/compute/task.rb +2 -2
- data/lib/fog/version.rb +1 -1
- data/lib/fog/vsphere/compute.rb +3 -0
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +20 -11
- data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +41 -0
- data/lib/fog/vsphere/requests/compute/get_network.rb +35 -6
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +1 -1
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +19 -13
- data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +92 -0
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +16 -11
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +6 -5
- data/lib/fog/xenserver/requests/compute/create_sr.rb +3 -4
- data/lib/tasks/changelog_task.rb +1 -0
- data/tests/helper.rb +3 -3
- data/tests/helpers/mock_helper.rb +0 -4
- data/tests/openstack/requests/baremetal/chassis_tests.rb +48 -0
- data/tests/openstack/requests/baremetal/driver_tests.rb +40 -0
- data/tests/openstack/requests/baremetal/node_tests.rb +65 -0
- data/tests/openstack/requests/baremetal/port_tests.rb +56 -0
- data/tests/openstack/requests/compute/server_tests.rb +2 -0
- data/tests/openstack/requests/orchestration/stack_tests.rb +2 -2
- data/tests/vsphere/requests/compute/get_network_tests.rb +48 -0
- metadata +88 -23
- data/lib/fog/aws.rb +0 -23
- data/lib/fog/bin/riakcs.rb +0 -25
- data/lib/fog/openstack/requests/orchestration/list_stacks.rb +0 -47
- data/lib/fog/riakcs.rb +0 -2
- data/lib/fog/riakcs/core.rb +0 -121
- data/lib/fog/riakcs/provisioning.rb +0 -98
- data/lib/fog/riakcs/requests/provisioning/create_user.rb +0 -77
- data/lib/fog/riakcs/requests/provisioning/disable_user.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/enable_user.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/get_user.rb +0 -41
- data/lib/fog/riakcs/requests/provisioning/list_users.rb +0 -43
- data/lib/fog/riakcs/requests/provisioning/regrant_secret.rb +0 -23
- data/lib/fog/riakcs/requests/provisioning/update_user.rb +0 -23
- data/lib/fog/riakcs/requests/usage/get_usage.rb +0 -68
- data/lib/fog/riakcs/usage.rb +0 -62
- data/tests/riakcs/requests/provisioning/provisioning_tests.rb +0 -174
- data/tests/riakcs/requests/usage/usage_tests.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aa5a136d7d98de58ebd9860c1891362d1ef444f
|
4
|
+
data.tar.gz: e98e9f10aa44217d7c77f6dd0b4b8c77d4a25dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d98bf176c48f72fc7201af9d50153ef42ad4b8409aef525b341e67e7367ef3e6222f7893220372e98e2b69b207ea21f19b18ea2c21f1d083cd25c2e0f72f20c1
|
7
|
+
data.tar.gz: 9b455f7ba0790da24d906a36247dc4f3c28d64cd2a8094b4433200bc0ffc7bc96ee45ff1c98871b210b412448475c52c1e2ddfaf6915bd2628be79914fc13d9c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,74 @@
|
|
1
|
+
## 1.28.0 02/19/2015
|
2
|
+
*Hash* d023ee520bcf52072f50f03e22efde344caef936
|
3
|
+
|
4
|
+
Statistic | Value
|
5
|
+
------------- | --------:
|
6
|
+
Collaborators | 2
|
7
|
+
Downloads | 8526269
|
8
|
+
Forks | 1402
|
9
|
+
Open Issues | 86
|
10
|
+
Watchers | 3382
|
11
|
+
|
12
|
+
**MVP!** Peter Souter
|
13
|
+
|
14
|
+
#### [HP|storage]
|
15
|
+
* Add support for headers to get_object. thanks Bruz Marzolf
|
16
|
+
|
17
|
+
#### [Openstack|Servers|Create]
|
18
|
+
* Allow :volume_size in block_device_mapping_v2. thanks Brandon Dunne
|
19
|
+
|
20
|
+
#### [google]
|
21
|
+
* Add support for JSON key format. thanks Ferran Rodenas
|
22
|
+
|
23
|
+
#### [joyent|compute]
|
24
|
+
* support for gracefully handling 400 error responses from api Fixes #3434. thanks Kevin Chan
|
25
|
+
|
26
|
+
#### [misc]
|
27
|
+
* Port Rackspace Orchestration implementation to OpenStack. thanks Bill Wei
|
28
|
+
* Pass options when get resources from a stack. thanks Bill Wei
|
29
|
+
* Add ubuntu-os-cloud to list of global projects. thanks Chris Gianelloni
|
30
|
+
* get resource pool without name. thanks Chris Thompson
|
31
|
+
* Add nic_type option. thanks Darren Foo
|
32
|
+
* Adding multiple server support for Docker. thanks David Davis
|
33
|
+
* Fixes "Error - undefined method 'delete' for nil:NilClass" when attempting to stop a container. thanks Dmitri Dolguikh
|
34
|
+
* Remove duplicate openstack_region key. thanks Kyle Tolle
|
35
|
+
* Add OpenStack Ironic support. thanks Ladislav Smola
|
36
|
+
* Ming Jin: added list/get compute_resource functions. thanks Ming Jin
|
37
|
+
* Ming Jin: expose effective attribute. thanks Ming Jin
|
38
|
+
* Ming Jin: add isSingleHost attribute to compute resource. thanks Ming Jin
|
39
|
+
* Ming Jin: fix nil usage issue of host. thanks Ming Jin
|
40
|
+
* Ming Jin: added appropriate mocked response. thanks Ming Jin
|
41
|
+
* Fix RDoc build. thanks Paulo Henrique Lopes Ribeiro
|
42
|
+
* Fix small typo. thanks Paulo Henrique Lopes Ribeiro
|
43
|
+
* Remove RiakCS. thanks Paulo Henrique Lopes Ribeiro
|
44
|
+
* Remove tests. thanks Paulo Henrique Lopes Ribeiro
|
45
|
+
* Remove unused credentials. thanks Paulo Henrique Lopes Ribeiro
|
46
|
+
* Remove Bin. thanks Paulo Henrique Lopes Ribeiro
|
47
|
+
* Add Fog::RiakCS as dependency. thanks Paulo Henrique Lopes Ribeiro
|
48
|
+
* Add floating disks manipulation in rbovirt provider. thanks Pavol Dilung
|
49
|
+
* Fix method names errors in exception. thanks Pavol Dilung
|
50
|
+
* Add missing braces. thanks Pavol Dilung
|
51
|
+
* Updates location to get API keys from. thanks Peter Souter
|
52
|
+
* Adds section about SSH key management. thanks Peter Souter
|
53
|
+
* Adds notes about how to bootstrap a server. thanks Peter Souter
|
54
|
+
* Fix typo. thanks Peter Souter
|
55
|
+
* Adds RDoc for #bootstrap, #get(id) and #all(). thanks Peter Souter
|
56
|
+
* Removes not about not being documented. thanks Peter Souter
|
57
|
+
* adding option to set ovirt to use filtered API. thanks Tom Caspy
|
58
|
+
* adding version attribute for ovirt template. thanks Tom Caspy
|
59
|
+
* Remove duplicate lines from code example. thanks Tomas Varaneckas
|
60
|
+
* Use correct variable in code example. thanks Tomas Varaneckas
|
61
|
+
* remove redundant requires. thanks geemus
|
62
|
+
* cloudinit to customspec support. thanks karmab
|
63
|
+
* Use Fog::Formatador. thanks starbelly
|
64
|
+
|
65
|
+
#### [vsphere]
|
66
|
+
* new default dest_folder in vm_clone. thanks Chris Thompson
|
67
|
+
* find network by name and dvswitch. thanks Chris Thompson
|
68
|
+
* Supplied a mock implementation for cloudinit_to_customspec. thanks Kevin Menard
|
69
|
+
* searching for VM improved to search whole cluster instead of current folder. thanks Matthew Black
|
70
|
+
|
71
|
+
|
1
72
|
## 1.27.0 01/12/2015
|
2
73
|
*Hash* 8a8f9a366be09de646536f06e2bcc84eb9229087
|
3
74
|
|
data/Rakefile
CHANGED
@@ -102,7 +102,7 @@ task :nuke do
|
|
102
102
|
begin
|
103
103
|
compute = Fog::Compute.new(:provider => provider)
|
104
104
|
for server in compute.servers
|
105
|
-
Formatador.display_line("[#{provider}] destroying server #{server.identity}")
|
105
|
+
Fog::Formatador.display_line("[#{provider}] destroying server #{server.identity}")
|
106
106
|
server.destroy rescue nil
|
107
107
|
end
|
108
108
|
rescue
|
@@ -113,7 +113,7 @@ task :nuke do
|
|
113
113
|
for record in zone.records
|
114
114
|
record.destroy rescue nil
|
115
115
|
end
|
116
|
-
Formatador.display_line("[#{provider}] destroying zone #{zone.identity}")
|
116
|
+
Fog::Formatador.display_line("[#{provider}] destroying zone #{zone.identity}")
|
117
117
|
zone.destroy rescue nil
|
118
118
|
end
|
119
119
|
rescue
|
data/bin/fog
CHANGED
@@ -63,8 +63,8 @@ else
|
|
63
63
|
@irb.signal_handle
|
64
64
|
end
|
65
65
|
|
66
|
-
Formatador.display_line('Welcome to fog interactive!')
|
67
|
-
Formatador.display_line(":#{Fog.credential} provides #{providers}")
|
66
|
+
Fog::Formatador.display_line('Welcome to fog interactive!')
|
67
|
+
Fog::Formatador.display_line(":#{Fog.credential} provides #{providers}")
|
68
68
|
providers = Fog.providers
|
69
69
|
|
70
70
|
# FIXME: hacks until we can `include Fog` in bin
|
data/fog.gemspec
CHANGED
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
|
|
11
11
|
## If your rubyforge_project name is different, then edit it and comment out
|
12
12
|
## the sub! line in the Rakefile
|
13
13
|
s.name = 'fog'
|
14
|
-
s.version = '1.
|
15
|
-
s.date = '2015-
|
14
|
+
s.version = '1.28.0'
|
15
|
+
s.date = '2015-02-19'
|
16
16
|
s.rubyforge_project = 'fog'
|
17
17
|
|
18
18
|
## Make sure your summary is short. The description may be as long
|
@@ -67,6 +67,7 @@ Gem::Specification.new do |s|
|
|
67
67
|
s.add_dependency("fog-storm_on_demand")
|
68
68
|
s.add_dependency("fog-atmos")
|
69
69
|
s.add_dependency("fog-serverlove")
|
70
|
+
s.add_dependency("fog-riakcs")
|
70
71
|
|
71
72
|
# Disabled until Rackspace isn't broken, see fog-rackspace#10
|
72
73
|
#s.add_dependency("fog-rackspace")
|
@@ -78,7 +79,7 @@ Gem::Specification.new do |s|
|
|
78
79
|
s.add_development_dependency('rbvmomi')
|
79
80
|
s.add_development_dependency('yard')
|
80
81
|
s.add_development_dependency('thor')
|
81
|
-
s.add_development_dependency('rbovirt', '0.0.
|
82
|
+
s.add_development_dependency('rbovirt', '0.0.32')
|
82
83
|
s.add_development_dependency('shindo', '~> 0.3.4')
|
83
84
|
s.add_development_dependency('fission')
|
84
85
|
s.add_development_dependency('opennebula')
|
data/lib/fog/bin/clodo.rb
CHANGED
@@ -13,7 +13,7 @@ class Clodo < Fog::Bin
|
|
13
13
|
@@connections ||= Hash.new do |hash, key|
|
14
14
|
hash[key] = case key
|
15
15
|
when :compute
|
16
|
-
Formatador.display_line("[yellow][WARN] Clodo[:compute] is deprecated, use Compute[:clodo] instead[/]")
|
16
|
+
Fog::Formatador.display_line("[yellow][WARN] Clodo[:compute] is deprecated, use Compute[:clodo] instead[/]")
|
17
17
|
Fog::Compute.new(:provider => 'Clodo')
|
18
18
|
else
|
19
19
|
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
data/lib/fog/bin/openstack.rb
CHANGED
@@ -18,6 +18,8 @@ class OpenStack < Fog::Bin
|
|
18
18
|
Fog::Metering::OpenStack
|
19
19
|
when :orchestration
|
20
20
|
Fog::Orchestration::OpenStack
|
21
|
+
when :baremetal
|
22
|
+
Fog::Baremetal::OpenStack
|
21
23
|
else
|
22
24
|
raise ArgumentError, "Unrecognized service: #{key}"
|
23
25
|
end
|
@@ -50,6 +52,9 @@ class OpenStack < Fog::Bin
|
|
50
52
|
when :orchestration
|
51
53
|
Fog::Logger.warning("OpenStack[:orchestration] is not recommended, use Orchestration[:openstack] for portability")
|
52
54
|
Fog::Orchestration.new(:provider => 'OpenStack')
|
55
|
+
when :baremetal
|
56
|
+
Fog::Logger.warning("OpenStack[:baremetal] is not recommended, use Baremetal[:openstack] for portability")
|
57
|
+
Fog::Baremetal.new(:provider => 'OpenStack')
|
53
58
|
else
|
54
59
|
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
55
60
|
end
|
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
You'll need a DigitalOcean account and API key to use this provider.
|
4
4
|
|
5
|
-
Get one from
|
6
|
-
|
7
|
-
To generate the API key, login to the DigitalOcean web panel and go to
|
8
|
-
'My Settings -> API Access -> Generate a new API key'.
|
5
|
+
Get one from https://cloud.digitalocean.com/api_access (fog currently uses the v1 API)
|
9
6
|
|
10
7
|
Write down the Client Key and API Key, you'll need both to use the service.
|
11
8
|
|
@@ -29,6 +26,51 @@ docean = Fog::Compute.new({
|
|
29
26
|
})
|
30
27
|
```
|
31
28
|
|
29
|
+
## SSH Key Management
|
30
|
+
|
31
|
+
Access to DigitalOcean servers can be managed with SSH keys. These can be assigned to servers at creation time so you can access them without having to use a password.
|
32
|
+
|
33
|
+
Creating a key:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
docean.ssh_keys.create(
|
37
|
+
:name => 'Default SSH Key',
|
38
|
+
:ssh_pub_key => File.read('~/.ssh/id_rsa.pub'))
|
39
|
+
)
|
40
|
+
```
|
41
|
+
|
42
|
+
Listing all keys:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
docean.ssh_keys.each do | key |
|
46
|
+
key.name
|
47
|
+
key.ssh_pub_key
|
48
|
+
end
|
49
|
+
```
|
50
|
+
|
51
|
+
Destroying a key:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
docean.ssh_keys.destroy(:id => '27100')
|
55
|
+
```
|
56
|
+
|
57
|
+
## Boostrapping a server
|
58
|
+
|
59
|
+
Fog can be used to bootstrap a server, which will create an SSH key to be assigned to a server at boot.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
server = connection.servers.bootstrap({
|
63
|
+
:name => 'test',
|
64
|
+
:image_id => 1505447,
|
65
|
+
:size_id => 33,
|
66
|
+
:region_id => 4,
|
67
|
+
:flavor_id => 66,
|
68
|
+
:public_key_path => File.expand_path('~/.ssh/id_rsa.pub'),
|
69
|
+
:private_key_path => File.expand_path('~/.ssh/id_rsa'),
|
70
|
+
})
|
71
|
+
server.wait_for { ready? }
|
72
|
+
```
|
73
|
+
|
32
74
|
## Listing servers
|
33
75
|
|
34
76
|
Listing servers and attributes:
|
@@ -12,8 +12,6 @@ module Fog
|
|
12
12
|
attribute :image_id
|
13
13
|
attribute :region_id
|
14
14
|
attribute :flavor_id, :aliases => 'size_id'
|
15
|
-
# Not documented in their API, but
|
16
|
-
# available nevertheless
|
17
15
|
attribute :public_ip_address, :aliases => 'ip_address'
|
18
16
|
attribute :private_ip_address
|
19
17
|
attribute :private_networking
|
@@ -94,7 +92,7 @@ module Fog
|
|
94
92
|
commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
|
95
93
|
end
|
96
94
|
|
97
|
-
# wait for
|
95
|
+
# wait for DigitalOcean to be ready
|
98
96
|
wait_for { sshable?(credentials) }
|
99
97
|
|
100
98
|
Fog::SSH.new(ssh_ip_address, username, credentials).run(commands)
|
@@ -7,11 +7,33 @@ module Fog
|
|
7
7
|
class Servers < Fog::Collection
|
8
8
|
model Fog::Compute::DigitalOcean::Server
|
9
9
|
|
10
|
+
# Returns list of servers
|
11
|
+
# @return [Fog::Compute::DigitalOcean::Servers] Retrieves a list of servers.
|
12
|
+
# @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404
|
13
|
+
# @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400
|
14
|
+
# @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500
|
15
|
+
# @raise [Fog::Compute::DigitalOcean::ServiceError]
|
16
|
+
# @see https://developers.digitalocean.com/v1/droplets/
|
10
17
|
def all(filters = {})
|
11
18
|
data = service.list_servers.body['droplets']
|
12
19
|
load(data)
|
13
20
|
end
|
14
21
|
|
22
|
+
# Creates a new server and populates ssh keys
|
23
|
+
#
|
24
|
+
# @return [Fog::Compute::DigitalOcean::Server]
|
25
|
+
# @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404
|
26
|
+
# @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400
|
27
|
+
# @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500
|
28
|
+
# @raise [Fog::Compute::DigitalOcean::ServiceError]
|
29
|
+
# @note This creates an SSH public key object and assigns it to the server on creation
|
30
|
+
# @example
|
31
|
+
# service.servers.bootstrap :name => 'bootstrap-server',
|
32
|
+
# :flavor_ref => service.flavors.first.id,
|
33
|
+
# :image_ref => service.images.find {|img| img.name =~ /Ubuntu/}.id,
|
34
|
+
# :public_key_path => '~/.ssh/fog_rsa.pub',
|
35
|
+
# :private_key_path => '~/.ssh/fog_rsa'
|
36
|
+
#
|
15
37
|
def bootstrap(new_attributes = {})
|
16
38
|
server = new(new_attributes)
|
17
39
|
|
@@ -40,6 +62,14 @@ module Fog
|
|
40
62
|
server
|
41
63
|
end
|
42
64
|
|
65
|
+
# Retrieves server
|
66
|
+
# @param [String] id for server to be returned
|
67
|
+
# @return [Fog::Compute::DigitalOcean:Server]
|
68
|
+
# @raise [Fog::Compute::DigitalOcean::NotFound] - HTTP 404
|
69
|
+
# @raise [Fog::Compute::DigitalOcean::BadRequest] - HTTP 400
|
70
|
+
# @raise [Fog::Compute::DigitalOcean::InternalServerError] - HTTP 500
|
71
|
+
# @raise [Fog::Compute::DigitalOcean::ServiceError]
|
72
|
+
# @see https://developers.digitalocean.com/v1/droplets/
|
43
73
|
def get(id)
|
44
74
|
server = service.get_server_details(id).body['droplet']
|
45
75
|
new(server) if server
|
@@ -40,8 +40,9 @@ module Fog
|
|
40
40
|
email = options[:docker_email]
|
41
41
|
url = options[:docker_url]
|
42
42
|
|
43
|
-
|
44
|
-
Docker.
|
43
|
+
connection_options = {:username => username, :password => password, :email => email}
|
44
|
+
@connection = Docker::Connection.new(url, connection_options)
|
45
|
+
Docker.authenticate!(connection_options, @connection) if username || email || password
|
45
46
|
rescue Docker::Error::AuthenticationError => e
|
46
47
|
raise Fog::Errors::Fogdocker::AuthenticationError.new(e.message)
|
47
48
|
end
|
@@ -5,7 +5,7 @@ module Fog
|
|
5
5
|
def container_action(options = {})
|
6
6
|
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
|
7
7
|
raise ArgumentError, "action is a required parameter" unless options.key? :action
|
8
|
-
result = Docker::Container.get(options[:id]).send(options[:action], options[:options])
|
8
|
+
result = Docker::Container.get(options[:id], {}, @connection).send(options[:action], options[:options] || {})
|
9
9
|
|
10
10
|
if result.is_a?(Hash)
|
11
11
|
downcase_hash_keys(result)
|
@@ -9,7 +9,7 @@ module Fog
|
|
9
9
|
# before – Show only containers created before Id, include non-running ones.
|
10
10
|
# size – true or false, Show the containers sizes
|
11
11
|
def container_all(filters = {})
|
12
|
-
Docker::Container.all(filters.merge(:all => true)).map do |container|
|
12
|
+
Docker::Container.all(filters.merge(:all => true), @connection).map do |container|
|
13
13
|
downcase_hash_keys(container.json)
|
14
14
|
end
|
15
15
|
end
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
class Real
|
5
5
|
def container_commit(options)
|
6
6
|
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
|
7
|
-
container = Docker::Container.get(options[:id])
|
7
|
+
container = Docker::Container.get(options[:id], {}, @connection)
|
8
8
|
downcase_hash_keys container.commit(camelize_hash_keys(options)).json
|
9
9
|
end
|
10
10
|
end
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
class Real
|
5
5
|
def container_delete(options = {})
|
6
6
|
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
|
7
|
-
container = Docker::Container.get(options[:id])
|
7
|
+
container = Docker::Container.get(options[:id], {}, @connection)
|
8
8
|
container.delete()
|
9
9
|
true
|
10
10
|
end
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class Fogdocker
|
4
4
|
class Real
|
5
5
|
def container_get(id)
|
6
|
-
raw_container = Docker::Container.get(id).json
|
6
|
+
raw_container = Docker::Container.get(id, {}, @connection).json
|
7
7
|
processed_container = downcase_hash_keys(raw_container)
|
8
8
|
processed_container['hostconfig_port_bindings'] = raw_container['HostConfig']['PortBindings']
|
9
9
|
processed_container['hostconfig_links'] = raw_container['HostConfig']['Links']
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
class Real
|
5
5
|
def image_delete(options = {})
|
6
6
|
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
|
7
|
-
image = Docker::Image.get(options[:id])
|
7
|
+
image = Docker::Image.get(options[:id], {}, @connection)
|
8
8
|
image.remove()
|
9
9
|
end
|
10
10
|
end
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class Fogdocker
|
4
4
|
class Real
|
5
5
|
def image_search(query = {})
|
6
|
-
Docker::Util.parse_json(
|
6
|
+
Docker::Util.parse_json(@connection.get('/images/search', query)).map do |image|
|
7
7
|
downcase_hash_keys(image)
|
8
8
|
end
|
9
9
|
end
|
data/lib/fog/google/compute.rb
CHANGED
@@ -4,7 +4,8 @@ module Fog
|
|
4
4
|
module Compute
|
5
5
|
class Google < Fog::Service
|
6
6
|
requires :google_project
|
7
|
-
recognizes :app_name, :app_version, :google_client_email, :google_key_location, :google_key_string,
|
7
|
+
recognizes :app_name, :app_version, :google_client_email, :google_key_location, :google_key_string,
|
8
|
+
:google_client, :google_json_key_location, :google_json_key_string
|
8
9
|
|
9
10
|
GOOGLE_COMPUTE_API_VERSION = 'v1'
|
10
11
|
GOOGLE_COMPUTE_BASE_URL = 'https://www.googleapis.com/compute/'
|
data/lib/fog/google/core.rb
CHANGED
@@ -45,6 +45,8 @@ module Fog
|
|
45
45
|
# @option options [String] :google_client_email A @developer.gserviceaccount.com email address to use
|
46
46
|
# @option options [String] :google_key_location The location of a pkcs12 key file
|
47
47
|
# @option options [String] :google_key_string The content of the pkcs12 key file
|
48
|
+
# @option options [String] :google_json_key_location The location of a JSON key file
|
49
|
+
# @option options [String] :google_json_key_string The content of the JSON key file
|
48
50
|
# @option options [String] :google_api_scope_url The access scope URLs
|
49
51
|
# @option options [String] :app_name The app name to set in the user agent
|
50
52
|
# @option options [String] :app_version The app version to set in the user agent
|
@@ -64,19 +66,14 @@ module Fog
|
|
64
66
|
client = options[:google_client]
|
65
67
|
return client unless client.nil?
|
66
68
|
|
69
|
+
# Create a signing key
|
70
|
+
signing_key = create_signing_key(options)
|
71
|
+
|
67
72
|
# Validate required arguments
|
68
73
|
unless options[:google_client_email]
|
69
74
|
raise ArgumentError.new('Missing required arguments: google_client_email')
|
70
75
|
end
|
71
76
|
|
72
|
-
if options[:google_key_location]
|
73
|
-
google_key = File.expand_path(options[:google_key_location])
|
74
|
-
elsif options[:google_key_string]
|
75
|
-
google_key = options[:google_key_string]
|
76
|
-
else
|
77
|
-
raise ArgumentError.new('Missing required arguments: google_key_location or google_key_string')
|
78
|
-
end
|
79
|
-
|
80
77
|
unless options[:google_api_scope_url]
|
81
78
|
raise ArgumentError.new('Missing required arguments: google_api_scope_url')
|
82
79
|
end
|
@@ -84,23 +81,56 @@ module Fog
|
|
84
81
|
# Create a new Google API Client
|
85
82
|
self.new_pk12_google_client(
|
86
83
|
options[:google_client_email],
|
87
|
-
|
84
|
+
signing_key,
|
88
85
|
options[:google_api_scope_url],
|
89
86
|
options[:app_name],
|
90
87
|
options[:app_version]
|
91
88
|
)
|
92
89
|
end
|
93
90
|
|
91
|
+
##
|
92
|
+
# Creates a Google signing key
|
93
|
+
#
|
94
|
+
def create_signing_key(options)
|
95
|
+
if options[:google_json_key_location] || options[:google_json_key_string]
|
96
|
+
if options[:google_json_key_location]
|
97
|
+
json_key_location = File.expand_path(options[:google_json_key_location])
|
98
|
+
json_key = File.open(json_key_location, 'r') { |file| file.read }
|
99
|
+
else
|
100
|
+
json_key = options[:google_json_key_string]
|
101
|
+
end
|
102
|
+
|
103
|
+
json_key_hash = Fog::JSON.decode(json_key)
|
104
|
+
unless json_key_hash.has_key?('client_email') || json_key_hash.has_key?('private_key')
|
105
|
+
raise ArgumentError.new('Invalid Google JSON key')
|
106
|
+
end
|
107
|
+
|
108
|
+
options[:google_client_email] = json_key_hash['client_email']
|
109
|
+
::Google::APIClient::KeyUtils.load_from_pem(json_key_hash['private_key'], 'notasecret')
|
110
|
+
elsif options[:google_key_location] || options[:google_key_string]
|
111
|
+
if options[:google_key_location]
|
112
|
+
google_key = File.expand_path(options[:google_key_location])
|
113
|
+
else
|
114
|
+
google_key = options[:google_key_string]
|
115
|
+
end
|
116
|
+
|
117
|
+
::Google::APIClient::KeyUtils.load_from_pkcs12(google_key, 'notasecret')
|
118
|
+
else
|
119
|
+
raise ArgumentError.new('Missing required arguments: google_key_location, google_key_string, ' \
|
120
|
+
'google_json_key_location or google_json_key_string')
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
94
124
|
##
|
95
125
|
# Create a Google API Client with a user email and a pkcs12 key
|
96
126
|
#
|
97
127
|
# @param [String] google_client_email A @developer.gserviceaccount.com email address to use
|
98
|
-
# @param [
|
128
|
+
# @param [OpenSSL::PKey] signing_key The private key for signing
|
99
129
|
# @param [String] google_api_scope_url Access scope URLs
|
100
130
|
# @param [String] app_name The app name to set in the user agent
|
101
131
|
# @param [String] app_version The app version to set in the user agent
|
102
132
|
# @return [Google::APIClient] Google API Client
|
103
|
-
def new_pk12_google_client(google_client_email,
|
133
|
+
def new_pk12_google_client(google_client_email, signing_key, google_api_scope_url, app_name = nil, app_version = nil)
|
104
134
|
application_name = app_name.nil? ? 'fog' : "#{app_name}/#{app_version || '0.0.0'} fog"
|
105
135
|
api_client_options = {
|
106
136
|
:application_name => application_name,
|
@@ -115,7 +145,7 @@ module Fog
|
|
115
145
|
:client_x509_cert_url => "https://www.googleapis.com/robot/v1/metadata/x509/#{google_client_email}",
|
116
146
|
:issuer => google_client_email,
|
117
147
|
:scope => google_api_scope_url,
|
118
|
-
:signing_key =>
|
148
|
+
:signing_key => signing_key,
|
119
149
|
:token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
|
120
150
|
}
|
121
151
|
)
|