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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 450665b606e103251fe5b57065161cb47a810cd0
|
4
|
+
data.tar.gz: e3a0cbc70aed6d1a5063a82fcf75eb0dbe0b8f57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a3502e0de24115509ecf04e5b898db461e2147f4dcdbd366917a43ab1a074dc8430ba25ca5f52b63c21c2984af7bc9d96e66175d08a9f2874902b356ece19c8
|
7
|
+
data.tar.gz: 3e9d7533fb040cdafc27e583ab4fe58ebd4aee60cc7580aebc180d39afe334755c4610d5da0cd2c6b70803352318a1ab813cf6c98482872d0d2ee30cb91cfda4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,114 @@
|
|
1
|
+
## 1.29.0 04/02/2015
|
2
|
+
*Hash* 90e96f36e6f70a12f0c6794a149231c337293887
|
3
|
+
|
4
|
+
Statistic | Value
|
5
|
+
------------- | --------:
|
6
|
+
Collaborators | 2
|
7
|
+
Downloads | 9116129
|
8
|
+
Forks | 1417
|
9
|
+
Open Issues | 83
|
10
|
+
Watchers | 3433
|
11
|
+
|
12
|
+
**MVP!** Chris Luo
|
13
|
+
|
14
|
+
#### [GleSYS]
|
15
|
+
* Add ability to persist changes on existing server. thanks Christoffer Artmann
|
16
|
+
* add support for SSH key management. thanks Tobias Nygren
|
17
|
+
|
18
|
+
#### [glesys]
|
19
|
+
* fix URL encoding of API parameter values. thanks Tobias Nygren
|
20
|
+
|
21
|
+
#### [google]
|
22
|
+
* Add credentials tests. thanks Ferran Rodenas
|
23
|
+
|
24
|
+
#### [google|compute]
|
25
|
+
* Adding start_server and stop_server. thanks Daniel Broudy
|
26
|
+
|
27
|
+
#### [misc]
|
28
|
+
* Initial integration of powerdns. thanks Chris Luo
|
29
|
+
* Fix binspec def. thanks Chris Luo
|
30
|
+
* Debug modularization and integration. thanks Chris Luo
|
31
|
+
* Initial integration of powerdns. thanks Chris Luo
|
32
|
+
* Fix binspec def. thanks Chris Luo
|
33
|
+
* Debug modularization and integration. thanks Chris Luo
|
34
|
+
* gemspec powerdns update. thanks Chris Luo
|
35
|
+
* fix powerdns_spec.rb. thanks Chris Luo
|
36
|
+
* revert modular providers messup. thanks Chris Luo
|
37
|
+
* missing powerdns require in bin. thanks Chris Luo
|
38
|
+
* fix formatting in gemspec. thanks Chris Luo
|
39
|
+
* Remove server.cost.amount from Formats:Details as it breaks the tests when server has a cost that is a non decimail number. thanks Christoffer Artmann
|
40
|
+
* Use OpenVZ and Debian 7.0 64-bit as default options when creating a server as GleSYS has deprecated their Xen platform. thanks Christoffer Artmann
|
41
|
+
* Changed tests to use Vmware and Debian 7 instead of Xen and Debian 6. thanks Christoffer Artmann
|
42
|
+
* Update test to expect CPU Usage as a Nullable Float. thanks Christoffer Artmann
|
43
|
+
* zone.id instead of zone.domain. thanks Hippie Hacker
|
44
|
+
* Move contributing guidelines from fog.io to CONTRIBUTING.md; closes #3509. thanks Isaac Hollander McCreery
|
45
|
+
* CONTRIBUTING: discuss ongoing changes, link to Roadmap in Wiki and relevant issues. thanks Isaac Hollander McCreery
|
46
|
+
* allow self-signed certs. thanks Jared Everett
|
47
|
+
* Adds `ovirt_filtered_api` to list of recognized options for Ovirt service. thanks Jesse Hallett
|
48
|
+
* Treat __sr as a string representing an opaque reference to a storage repository. See https://github.com/fog/fog/pull/3469. thanks Jonas Kongslund
|
49
|
+
* Allow setting gateway option in CustomizationIPSettings. thanks Justin Pratt
|
50
|
+
* Remove superfluous if modifier. thanks Justin Pratt
|
51
|
+
* added requests files for linode image and linode disk api calls. thanks Marques Johansson
|
52
|
+
* use Fog::Mock.random_numbers where appropriate. thanks Marques Johansson
|
53
|
+
* fix mock for linode_disk_createfromimage. thanks Marques Johansson
|
54
|
+
* added tests for the new linode requests. thanks Marques Johansson
|
55
|
+
* use correct api_action in linode_disk_update. thanks Marques Johansson
|
56
|
+
* use correct identifier for linode_disk_createfromimage. thanks Marques Johansson
|
57
|
+
* revise linode expected results. thanks Marques Johansson
|
58
|
+
* add linode.disk.createfromimage(..label..) param. thanks Marques Johansson
|
59
|
+
* add missing ImageID, DiskID from linode.disk.imagize, linode.disk.resize responses. thanks Marques Johansson
|
60
|
+
* Use fog-core 1.27.4 and above. thanks Matt Bostock
|
61
|
+
* Rackspace Neutron Security Groups & Rules. thanks Matt Darby
|
62
|
+
* Better help address for Rackspace. thanks Matt Darby
|
63
|
+
* Added support to requests V3 tokens and provision compute using V3 keystone auth. thanks Miguel Z
|
64
|
+
* Added extra parameters for domain suffixes and gateway, added comments. thanks Oscar Elfving
|
65
|
+
* vm_clone used regular virtual switches no matter what kind of portgroup was named, changed it to look up and handle distributed virtual switches correctly. thanks Oscar Elfving
|
66
|
+
* Fixed Ruby 1.8 breaking comma. thanks Oscar Elfving
|
67
|
+
* Makes the docker api version call use assigned connection. thanks Partha Aji
|
68
|
+
* Test `Provider[]` errors when unknown. thanks Paul Thornthwaite
|
69
|
+
* Tests top level classes interface. thanks Paul Thornthwaite
|
70
|
+
* Do not skip tests when configuration is missing. thanks Paul Thornthwaite
|
71
|
+
* Remove test references to xenserver. thanks Paul Thornthwaite
|
72
|
+
* Apply style rules to fog.gemspec. thanks Paul Thornthwaite
|
73
|
+
* DRY up specs with `spec_helper`. thanks Paul Thornthwaite
|
74
|
+
* Add Simplecov for coverage. thanks Paul Thornthwaite
|
75
|
+
* Fix Xenserver VDI creation. thanks Paulo Henrique Lopes Ribeiro
|
76
|
+
* Remove Atmos Bin. thanks Paulo Henrique Lopes Ribeiro
|
77
|
+
* Add alias attribute to ovirt/compute/volume.rb. thanks Pavol Dilung
|
78
|
+
* Implement affinity groups. thanks Pavol Dilung
|
79
|
+
* Remove dangeling references to pry debugger. thanks Pavol Dilung
|
80
|
+
* Implement affinity group mockups. thanks Pavol Dilung
|
81
|
+
* Fine-tune affinity group mockups. thanks Pavol Dilung
|
82
|
+
* Implement wipe_after_delete attribute for Fog::Compute::Ovirt::Volume class. thanks Pavol Dilung
|
83
|
+
* Adds Planning service to OpenStack provider. thanks Petr Blaho
|
84
|
+
* Adds Role model and list_roles request. thanks Petr Blaho
|
85
|
+
* Adds Plan model, list_plans and get_plan requests. thanks Petr Blaho
|
86
|
+
* Adds template retrieving into Plan. thanks Petr Blaho
|
87
|
+
* Adds create_plan and delete_plan requests. thanks Petr Blaho
|
88
|
+
* Adds adding and removing Roles from Plan. thanks Petr Blaho
|
89
|
+
* Adds patch_plan request and patch method to Plan. thanks Petr Blaho
|
90
|
+
* Adds RESTlike methods to Plan of Planning service. thanks Petr Blaho
|
91
|
+
* Adds brief docs for OpenStack Planning service. thanks Petr Blaho
|
92
|
+
* Adds few examples for OpenStack Planning service. thanks Petr Blaho
|
93
|
+
* Add endpoint for hypervisor stats. thanks Sean Handley
|
94
|
+
* Fix path and include request in catalog. thanks Sean Handley
|
95
|
+
* fixes inconsistent spacing. thanks Tony Ta
|
96
|
+
* removes unnecessary commas. thanks Tony Ta
|
97
|
+
* more consistent spacing around blocks. thanks Tony Ta
|
98
|
+
* fix inconsistent hash spacing. thanks Tony Ta
|
99
|
+
* Extract local storage provider. thanks Ville Lautanala
|
100
|
+
* Revert "allow self-signed certs for Joyent". thanks Wesley Beary
|
101
|
+
* fix minor typo in get_object_https_url. thanks stephen charles baldwin
|
102
|
+
|
103
|
+
#### [openstack|identity]
|
104
|
+
* check_token and validate_token - make tenant_id optional. thanks Darren Hague
|
105
|
+
* add tests for check_token and validate_token parameters. thanks Darren Hague
|
106
|
+
|
107
|
+
#### [ovirt]
|
108
|
+
* Fix update_interface method. thanks Pavol Dilung
|
109
|
+
* Implement high availability flag an priority attributes. thanks Pavol Dilung
|
110
|
+
|
111
|
+
|
1
112
|
## 1.28.0 02/19/2015
|
2
113
|
*Hash* d023ee520bcf52072f50f03e22efde344caef936
|
3
114
|
|
data/CONTRIBUTING.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
# Getting Involved
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
First off, high five for coming to visit this page. You are my new hero.
|
2
6
|
|
3
7
|
New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
|
4
8
|
|
@@ -20,3 +24,253 @@ New contributors are always welcome, when it doubt please ask questions. We stri
|
|
20
24
|
* Organize or volunteer at events.
|
21
25
|
* [Donate](https://www.gittip.com/geemus/)
|
22
26
|
* Discuss other ideas for contribution with [geemus](mailto:geemus+fog@gmail.com).
|
27
|
+
|
28
|
+
### Changes
|
29
|
+
|
30
|
+
Before we go into more detail, please be aware that Fog is going through some growing pains right now. A lot of things are moving right now, and things may not be documented as well as we would like.
|
31
|
+
|
32
|
+
It might be wise to check out the [Roadmap](https://github.com/fog/fog/wiki/Roadmap) in the Wiki for more information.
|
33
|
+
|
34
|
+
For right now, there are three major things in motion:
|
35
|
+
|
36
|
+
#### Meta-gem movement
|
37
|
+
|
38
|
+
Fog is moving from a monolithic gem structure to a meta-gem structure, where code for specific providers will be housed in `fog-provider` gems. Extracting provider code is an ongoing process, and is also causing some performance issues.
|
39
|
+
|
40
|
+
Relevant issues include:
|
41
|
+
|
42
|
+
- General: [#1253](https://github.com/fog/fog/issues/1253), [#2602](https://github.com/fog/fog/issues/2602), [#2681](https://github.com/fog/fog/issues/2681), [#2877](https://github.com/fog/fog/issues/2877)
|
43
|
+
- Performance: [#3430](https://github.com/fog/fog/issues/3430)
|
44
|
+
|
45
|
+
#### Testing
|
46
|
+
|
47
|
+
In the past, fog has used the [Shindo](https://github.com/geemus/shindo) test framework, but is moving toward using `minitest` instead. Furthermore, the mocking structure fog has used to test in the past is undergoing some scrutiny and changes.
|
48
|
+
|
49
|
+
Relevant issues include:
|
50
|
+
|
51
|
+
- General: [#1266](https://github.com/fog/fog/issues/1266)
|
52
|
+
- Shindo -> minitest: [#2630](https://github.com/fog/fog/issues/2630)
|
53
|
+
- Mocking: [#1252](https://github.com/fog/fog/issues/1252), [#1266](https://github.com/fog/fog/issues/1266) starting about halfway down, [#1418](https://github.com/fog/fog/issues/1418), [#2629](https://github.com/fog/fog/issues/2629)
|
54
|
+
|
55
|
+
## Overview
|
56
|
+
|
57
|
+
* Organize your patches by keeping all related changes together in a topic branch.
|
58
|
+
* Rebase your branch against master before submitting a pull request (and squish any 'oops' or work in progress commits).
|
59
|
+
* We support several rubies! Make sure your changes will work for all the Rubies in .travis.yml (currently MRI 1.8, 1.9, and Ruby 2.0).
|
60
|
+
* Submit changes as pull requests describing what the changes should cover and referencing issues (if any).
|
61
|
+
* Use 'tags' in your commits to indicate the scope, so things like `[aws|compute] fixed something`.
|
62
|
+
* Write and run tests. Tests should follow through usage workflows and ought to pass both with mocking on and off.
|
63
|
+
|
64
|
+
## Deep dive
|
65
|
+
|
66
|
+
Now then, some of the what makes it tick and why. For simplicity let's pretend you want to implement a new service, from scratch. I will walk through the requisite pieces and important things to keep in mind as you go.
|
67
|
+
|
68
|
+
But, before I dive too deep, I'll leave you with an out. Other great ways to contribute are fixing bugs, writing documentation or helping port other projects to use fog. That way everybody wins!
|
69
|
+
|
70
|
+
## The Service
|
71
|
+
|
72
|
+
First and foremost you'll need to create a service, which should start from something like:
|
73
|
+
|
74
|
+
module Fog
|
75
|
+
class TheService < Fog::Service
|
76
|
+
|
77
|
+
requires :necessary_credential
|
78
|
+
|
79
|
+
model_path 'path/to/models'
|
80
|
+
collection 'name_of_collection'
|
81
|
+
model 'name_of_model'
|
82
|
+
|
83
|
+
request_path 'path/to/requests'
|
84
|
+
request 'name_of_request'
|
85
|
+
|
86
|
+
class Mock
|
87
|
+
include Collections
|
88
|
+
end
|
89
|
+
|
90
|
+
class Real
|
91
|
+
include Collections
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
### Highlights:
|
98
|
+
* we segregate between real and mock so it is easier to add stuff to one or the other later.
|
99
|
+
* this is where any shared stuff will go, like making/signing requests
|
100
|
+
|
101
|
+
## Requests
|
102
|
+
|
103
|
+
The next thing to bite off are the requests. fog is all about making cloud services easier to use and move between, but requests are not where this happens. Requests should map closely to the actual api requests (you should be able to directly reference the api docs and vice versa). In particular, try to keep the output of any data parsing as close to the actual format as possible. This makes implementation and maintenance much easier and provides a solid foundation for models to build nice things on top of. I generally end up working on stuff to get/list details first and then filling in create/destroy pairs and other requests.
|
104
|
+
You start with something like this:
|
105
|
+
|
106
|
+
<pre>
|
107
|
+
module Fog
|
108
|
+
class TheService
|
109
|
+
|
110
|
+
class Real
|
111
|
+
|
112
|
+
def request(*args)
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
class Mock
|
118
|
+
|
119
|
+
def request(*args)
|
120
|
+
Fog::Mock.not_implemented
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
</pre>
|
128
|
+
|
129
|
+
### Highlights:
|
130
|
+
* You should define the method twice, once for the real implementation and once for mocked (they should take the same arguments).
|
131
|
+
* The mock versions should just start out by raising a not implemented error, you can come back and fill this in later.
|
132
|
+
* The real version should make a request, probably by a method defined on the real class in the service you defined earlier.
|
133
|
+
* Each request should either return an Excon::Response (with a parsed body where appropriate) or raise an error.
|
134
|
+
|
135
|
+
## Tests
|
136
|
+
|
137
|
+
Now would be a good time to write some tests to make sure what you have written works (and will continue to). I've tried a couple variations on testing in the past, but have settled on consolidated lifetime testing. These vary enough that its hard to give a single simple example, but you can see many examples in [tests/aws/requests/compute](https://github.com/fog/fog/tree/master/tests/aws/requests/compute).
|
138
|
+
|
139
|
+
### Highlights:
|
140
|
+
* Reuse the same objects and take them through their whole life cycle (this is much faster, and most of the time if one portion fails the others would anyway).
|
141
|
+
* Test the format of the output to ensure parsers match expectations (check the provider's api docs) and that mocks return matching data.
|
142
|
+
* Test common failure cases and their behavior, you'll need to know how the service acts in these cases to make better mocks.
|
143
|
+
|
144
|
+
## Models
|
145
|
+
|
146
|
+
You could also skip to the mocks here if you wanted, but I usually find the more time I spend working with the service the easier it is to build mocks. The models are the real pay dirt, you have slogged through low level requests that map to the provider api and now you want a nice interface. This is where models and collections come in. Collections provide access to lists of data on the provider and for creating new objects. Models represent the individual objects.
|
147
|
+
|
148
|
+
If you know which object you'd like to represent you should start with the collection. When naming, please refer to the names that have been chosen for other services. I haven't standardized all nouns yet, but a few are already shared (Flavor, Image, Server)
|
149
|
+
An example servers collection:
|
150
|
+
|
151
|
+
require 'fog/collection'
|
152
|
+
require 'fog/theservice/models/server'
|
153
|
+
module Fog
|
154
|
+
class TheService
|
155
|
+
|
156
|
+
class Servers < Fog::Collection
|
157
|
+
|
158
|
+
model Fog::TheService::Server
|
159
|
+
|
160
|
+
def all
|
161
|
+
# get list of servers
|
162
|
+
load(data) # data is an array of attribute hashes
|
163
|
+
end
|
164
|
+
|
165
|
+
def get(identity)
|
166
|
+
# get server matching id
|
167
|
+
new(data) # data is an attribute hash
|
168
|
+
rescue Excon::Errors::NotFound
|
169
|
+
nil
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
### Highlights
|
178
|
+
* First make an accessor in the Collections model so it will be included in Real and Mock.
|
179
|
+
* `#model` will take a reference to the class that will be instantiated to represent individual objects.
|
180
|
+
* `#all` should get a list of servers from the provider and pass an array of attribute hashes, one per server, to load.
|
181
|
+
* `#get` should take an identity reference and instantiate a new model object with an attribute hash returned from the remote server, or return nil of no such object exists.
|
182
|
+
|
183
|
+
Models handle remapping attributes into friendlier names and providing the rest of the interface.
|
184
|
+
An example model:
|
185
|
+
|
186
|
+
require 'fog/model'
|
187
|
+
module Fog
|
188
|
+
module TheService
|
189
|
+
|
190
|
+
class Server << Fog::Model
|
191
|
+
|
192
|
+
identity :id
|
193
|
+
|
194
|
+
attribute :state, 'StatusValue'
|
195
|
+
|
196
|
+
def destroy
|
197
|
+
requires :identity
|
198
|
+
connection.destroy_server(identity)
|
199
|
+
true
|
200
|
+
end
|
201
|
+
|
202
|
+
def ready?
|
203
|
+
state == 'running'
|
204
|
+
end
|
205
|
+
|
206
|
+
def save
|
207
|
+
requires ...
|
208
|
+
connection.create_server(options)
|
209
|
+
true
|
210
|
+
end
|
211
|
+
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
### Highlights
|
218
|
+
* `#identity` captures the id/name that the objects are identified by and takes the same arguments as attribute.
|
219
|
+
* `#attribute` takes the name to make a variable available as and one or more aliases that parsers/requests will return this value as.
|
220
|
+
* `#destroy` will require the identity of the model and should destroy it and return true.
|
221
|
+
* `#ready?` should return whether the object has finished being initialized (where appropriate).
|
222
|
+
* `#save` should take any required objects and instantiate the object on the provider's service.
|
223
|
+
* These models just rely on underlying collections and requests, so it should not be necessary at this level to distinguish between Real and Mock methods.
|
224
|
+
|
225
|
+
## Mocks
|
226
|
+
|
227
|
+
Mocks provide a powerful tool for users of fog to experiment with their implementations much more quickly and without incurring costs. I usually save these for last, as implementing the requests and models provide some necessary context to finally put the mocks together. Your services mock class should have a data method that will return mocked data like so:
|
228
|
+
|
229
|
+
module Fog
|
230
|
+
module TheService
|
231
|
+
|
232
|
+
class Mock
|
233
|
+
def self.data
|
234
|
+
@data ||= Hash.new do |hash, key|
|
235
|
+
hash[key] = {}
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
The keys in this hash should represent a unique identifier of the user accessing the data and the value assigned should contain any default data that a new user might have. Any implemented mock requests should then return data retrieved from here or raise an error.
|
244
|
+
For instance:
|
245
|
+
|
246
|
+
module Fog
|
247
|
+
module TheService
|
248
|
+
|
249
|
+
class Mock
|
250
|
+
|
251
|
+
def destroy_server(server_identity)
|
252
|
+
if data = self.data[:servers].delete(server_identity)
|
253
|
+
response = Excon::Response.new
|
254
|
+
response.status = 202
|
255
|
+
response.body = data
|
256
|
+
response
|
257
|
+
else
|
258
|
+
raise Fog::TheService::NotFound
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
### Highlights
|
268
|
+
* Mock requests should return the same type of data as an already parsed real response or should return the same error as a real problem.
|
269
|
+
* By mocking at this low level, higher level functions are automatically mocked out for you.
|
270
|
+
* The extra rigorous tests related to output formatting and error messages should help keep you honest, and each should pass in both mocked and unmocked modes.
|
271
|
+
|
272
|
+
## Summary
|
273
|
+
|
274
|
+
That provides a lot more detail than you will probably need right away, but hopefully you can refer back to different sections as you need them. If you have any questions send me a github message or email me (address is on my profile). You should always start development by creating your own fork. When you feel confident about your fork, send me a pull request. Be forewarned that I may edit some things before it gets to master, but I'll do my best to take care of this in a timely manner.
|
275
|
+
|
276
|
+
Thanks again for your interest and let me know if there is anything else I can do to help.
|
data/Rakefile
CHANGED
@@ -37,7 +37,7 @@ def gem_file
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def replace_header(head, header_name)
|
40
|
-
head.sub!(/(\.#{header_name}\s*=
|
40
|
+
head.sub!(/(\.#{header_name}\s*= \").*\"/) { "#{$1}#{send(header_name)}\""}
|
41
41
|
end
|
42
42
|
|
43
43
|
#############################################################################
|
data/fog.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
lib = File.expand_path(
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
4
|
+
require "fog/version"
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
@@ -10,10 +10,10 @@ Gem::Specification.new do |s|
|
|
10
10
|
## Leave these as is they will be modified for you by the rake gemspec task.
|
11
11
|
## If your rubyforge_project name is different, then edit it and comment out
|
12
12
|
## the sub! line in the Rakefile
|
13
|
-
s.name =
|
14
|
-
s.version =
|
15
|
-
s.date =
|
16
|
-
s.rubyforge_project =
|
13
|
+
s.name = "fog"
|
14
|
+
s.version = "1.29.0"
|
15
|
+
s.date = "2015-04-02"
|
16
|
+
s.rubyforge_project = "fog"
|
17
17
|
|
18
18
|
## Make sure your summary is short. The description may be as long
|
19
19
|
## as you like.
|
@@ -24,9 +24,9 @@ Gem::Specification.new do |s|
|
|
24
24
|
## better to set the email to an email list or something. If you don't have
|
25
25
|
## a custom homepage, consider using your GitHub URL or the like.
|
26
26
|
s.authors = ["geemus (Wesley Beary)"]
|
27
|
-
s.email =
|
28
|
-
s.homepage =
|
29
|
-
s.license =
|
27
|
+
s.email = "geemus@gmail.com"
|
28
|
+
s.homepage = "http://github.com/fog/fog"
|
29
|
+
s.license = "MIT"
|
30
30
|
|
31
31
|
## This sections is only necessary if you have C extensions.
|
32
32
|
# s.require_paths << 'ext'
|
@@ -44,52 +44,49 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.rdoc_options = ["--charset=UTF-8"]
|
45
45
|
s.extra_rdoc_files = %w[README.md]
|
46
46
|
|
47
|
-
|
48
|
-
## that are needed for an end user to actually USE your code.
|
49
|
-
s.add_dependency("fog-core", "~> 1.27", ">= 1.27.3")
|
47
|
+
s.add_dependency("fog-core", "~> 1.27", ">= 1.27.4")
|
50
48
|
s.add_dependency("fog-json")
|
51
49
|
s.add_dependency("fog-xml", "~> 0.1.1")
|
52
50
|
|
53
|
-
s.add_dependency(
|
54
|
-
s.add_dependency(
|
51
|
+
s.add_dependency("ipaddress", "~> 0.5")
|
52
|
+
s.add_dependency("nokogiri", "~> 1.5", ">= 1.5.11")
|
55
53
|
|
56
|
-
# Modular providers
|
54
|
+
# Modular providers (please keep sorted)
|
55
|
+
s.add_dependency("fog-atmos")
|
57
56
|
s.add_dependency("fog-aws", "~> 0.0")
|
58
57
|
s.add_dependency("fog-brightbox", "~> 0.4")
|
59
|
-
s.add_dependency("fog-softlayer")
|
60
|
-
s.add_dependency("fog-sakuracloud", ">= 0.0.4")
|
61
|
-
s.add_dependency("fog-radosgw", ">=0.0.2")
|
62
|
-
s.add_dependency("fog-profitbricks")
|
63
|
-
s.add_dependency("fog-voxel")
|
64
|
-
s.add_dependency("fog-vmfusion")
|
65
|
-
s.add_dependency("fog-terremark")
|
66
58
|
s.add_dependency("fog-ecloud")
|
67
|
-
s.add_dependency("fog-
|
68
|
-
s.add_dependency("fog-
|
69
|
-
s.add_dependency("fog-
|
59
|
+
s.add_dependency("fog-local")
|
60
|
+
s.add_dependency("fog-powerdns", ">= 0.1.1")
|
61
|
+
s.add_dependency("fog-profitbricks")
|
62
|
+
s.add_dependency("fog-radosgw", ">= 0.0.2")
|
70
63
|
s.add_dependency("fog-riakcs")
|
64
|
+
s.add_dependency("fog-sakuracloud", ">= 0.0.4")
|
65
|
+
s.add_dependency("fog-serverlove")
|
66
|
+
s.add_dependency("fog-softlayer")
|
67
|
+
s.add_dependency("fog-storm_on_demand")
|
68
|
+
s.add_dependency("fog-terremark")
|
69
|
+
s.add_dependency("fog-vmfusion")
|
70
|
+
s.add_dependency("fog-voxel")
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
s.add_development_dependency(
|
78
|
-
s.add_development_dependency(
|
79
|
-
s.add_development_dependency(
|
80
|
-
s.add_development_dependency(
|
81
|
-
s.add_development_dependency(
|
82
|
-
s.add_development_dependency(
|
83
|
-
s.add_development_dependency(
|
84
|
-
s.add_development_dependency(
|
85
|
-
s.add_development_dependency(
|
86
|
-
s.add_development_dependency(
|
87
|
-
s.add_development_dependency('google-api-client', '~> 0.6', '>= 0.6.2')
|
88
|
-
s.add_development_dependency('docker-api', '>= 1.13.6')
|
89
|
-
s.add_development_dependency('rubocop') if RUBY_VERSION > "1.9"
|
72
|
+
s.add_development_dependency("docker-api", ">= 1.13.6")
|
73
|
+
s.add_development_dependency("fission")
|
74
|
+
s.add_development_dependency("google-api-client", "~> 0.6", ">= 0.6.2")
|
75
|
+
s.add_development_dependency("minitest")
|
76
|
+
s.add_development_dependency("minitest-stub-const")
|
77
|
+
s.add_development_dependency("opennebula")
|
78
|
+
s.add_development_dependency("pry")
|
79
|
+
s.add_development_dependency("rake")
|
80
|
+
s.add_development_dependency("rbovirt", "0.0.32")
|
81
|
+
s.add_development_dependency("rbvmomi")
|
82
|
+
s.add_development_dependency("rubocop") if RUBY_VERSION > "1.9"
|
83
|
+
s.add_development_dependency("shindo", "~> 0.3.4")
|
84
|
+
s.add_development_dependency("simplecov")
|
85
|
+
s.add_development_dependency("thor")
|
86
|
+
s.add_development_dependency("yard")
|
90
87
|
|
91
88
|
if ENV["FOG_USE_LIBVIRT"]
|
92
|
-
s.add_development_dependency(
|
89
|
+
s.add_development_dependency("ruby-libvirt","~> 0.5.0")
|
93
90
|
end
|
94
91
|
|
95
92
|
s.files = `git ls-files`.split("\n")
|