You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2019/06/28 17:25:48 UTC

[libcloud] branch trunk updated (6a34d68 -> baf956e)

This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git.


    from 6a34d68  Merge pull request #1299 from micafer/ost_fix_float_ip
     add f2c2456  IMplement driver for maxihost provider
     add 58b7955  Remove duplicate entry
     add 121092c  flake8 fixes
     add 2fa9a87  Flake8 fixes. Add website to MaxihostNodeDriver
     add 5147c8a  Add unit tests for listing images, sizes, locations and nodes
     add 366fcff  NodeLocation has no attribute extra
     add e871d1c  Merge branch 'maxihost-provider' of gitlab.ops.mist.io:mistio/libcloud into maxihost-provider
     add b4720e9  Add test_list_key_pairs
     add 72d32c3  Return ram and pricing as integers
     add 4eab1fb  Add Accept header to use version 1.1
     add e50ea5d  Fix typo
     add ec8df4d  Add documentation
     add 8bc7efa  Add list_nodes and create_node tests
     add 5abdb9b  Add destroy_node test
     add ee93bcf  Fix docs-travis error
     add 8934ee9  Fix indentation error
     add 10e2e6c  Implement destroy_node
     new 674d0c2  Merge branch 'maxihost-provider' of https://github.com/mistio/libcloud into mistio-maxihost-provider
     new 3a9ef1f  Remove default value for required argument.
     new 1170e9c  Prefix argument name with "ex_" since it's an extension argument.
     new 2fe5304  Valid attribute name on the API side is "ssh_keys" (https://developers.maxihost.com/reference#post_devices).
     new dfe584f  Update changelog entry.
     new 1d69566  Fix syntax.
     new baf956e  Fix broken test and lint.

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 CHANGES.rst                                        |   4 +
 docs/_static/images/provider_logos/maxihost.png    | Bin 0 -> 15494 bytes
 docs/compute/drivers/maxihost.rst                  |  31 +++
 libcloud/common/maxihost.py                        |  44 ++++
 libcloud/compute/drivers/maxihost.py               | 221 +++++++++++++++++++++
 libcloud/compute/providers.py                      |   2 +
 libcloud/compute/types.py                          |   1 +
 .../test/compute/fixtures/maxihost/images.json     |  14 ++
 libcloud/test/compute/fixtures/maxihost/keys.json  |  17 ++
 libcloud/test/compute/fixtures/maxihost/node.json  |  46 +++++
 libcloud/test/compute/fixtures/maxihost/nodes.json |  57 ++++++
 libcloud/test/compute/fixtures/maxihost/plans.json |  36 ++++
 .../test/compute/fixtures/maxihost/regions.json    |  39 ++++
 libcloud/test/compute/test_maxihost.py             |  98 +++++++++
 14 files changed, 610 insertions(+)
 create mode 100644 docs/_static/images/provider_logos/maxihost.png
 create mode 100644 docs/compute/drivers/maxihost.rst
 create mode 100644 libcloud/common/maxihost.py
 create mode 100644 libcloud/compute/drivers/maxihost.py
 create mode 100644 libcloud/test/compute/fixtures/maxihost/images.json
 create mode 100644 libcloud/test/compute/fixtures/maxihost/keys.json
 create mode 100644 libcloud/test/compute/fixtures/maxihost/node.json
 create mode 100644 libcloud/test/compute/fixtures/maxihost/nodes.json
 create mode 100644 libcloud/test/compute/fixtures/maxihost/plans.json
 create mode 100644 libcloud/test/compute/fixtures/maxihost/regions.json
 create mode 100644 libcloud/test/compute/test_maxihost.py


[libcloud] 07/07: Fix broken test and lint.

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit baf956e5cfe47b9b375dfd64cfc30c5a21513ce4
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 19:17:17 2019 +0200

    Fix broken test and lint.
---
 libcloud/test/compute/test_maxihost.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libcloud/test/compute/test_maxihost.py b/libcloud/test/compute/test_maxihost.py
index 136541d..2ea527b 100644
--- a/libcloud/test/compute/test_maxihost.py
+++ b/libcloud/test/compute/test_maxihost.py
@@ -3,8 +3,7 @@ import unittest
 from libcloud.utils.py3 import httplib
 
 from libcloud.compute.drivers.maxihost import MaxihostNodeDriver
-from libcloud.compute.base import Node, KeyPair
-from libcloud.compute.types import NodeState
+from libcloud.compute.base import Node
 
 from libcloud.test import MockHttp
 from libcloud.test.compute import TestCaseMixin
@@ -16,7 +15,6 @@ class MaxihostTest(unittest.TestCase, TestCaseMixin):
         MaxihostNodeDriver.connectionCls.conn_class = MaxihostMockHttp
         self.driver = MaxihostNodeDriver('foo')
 
-
     def test_list_sizes(self):
         sizes = self.driver.list_sizes()
         self.assertEqual(len(sizes), 1)
@@ -80,6 +78,13 @@ class MaxihostMockHttp(MockHttp):
         body = self.fixtures.load('nodes.json')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _devices_1319(self, method, url, body, headers):
+        if method == 'DELETE':
+            body = '{}'
+            return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+        else:
+            raise ValueError('Unsupported method: %s' % (method))
+
     def _devices_1319_actions(self, method, url, body, headers):
         body = self.fixtures.load('node.json')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])


[libcloud] 04/07: Valid attribute name on the API side is "ssh_keys" (https://developers.maxihost.com/reference#post_devices).

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 2fe5304b681b81584ece8a0ebfb61e752a6a2fd3
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 19:08:43 2019 +0200

    Valid attribute name on the API side is "ssh_keys"
    (https://developers.maxihost.com/reference#post_devices).
---
 libcloud/compute/drivers/maxihost.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libcloud/compute/drivers/maxihost.py b/libcloud/compute/drivers/maxihost.py
index 1eab3c8..4af24a1 100644
--- a/libcloud/compute/drivers/maxihost.py
+++ b/libcloud/compute/drivers/maxihost.py
@@ -35,8 +35,11 @@ class MaxihostNodeDriver(NodeDriver):
         """
         attr = {'hostname': name, 'plan': size.id,
                 'operating_system': image.id,
-                'facility': location.id.lower(), 'billing_cycle': 'monthly',
-                'ex_ssh_key_ids': ex_ssh_key_ids}
+                'facility': location.id.lower(), 'billing_cycle': 'monthly'}
+
+        if ex_ssh_key_ids:
+            attr['ssh_keys'] = ex_ssh_key_ids
+
         try:
             res = self.connection.request('/devices',
                                           params=attr, method='POST')
@@ -123,7 +126,7 @@ class MaxihostNodeDriver(NodeDriver):
         """
         List locations
 
-        If ex_available is True, show only locations which are available.
+        If ex_available is True, show only locations which are available
         """
         locations = []
         data = self.connection.request('/regions')


[libcloud] 05/07: Update changelog entry.

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit dfe584f151ee686ba368bc7c1900854c81f1445e
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 19:11:45 2019 +0200

    Update changelog entry.
---
 CHANGES.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/CHANGES.rst b/CHANGES.rst
index 67be0a3..44deee1 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -30,6 +30,10 @@ Compute
   ``device_owner`` of a port is ``compute:None``. (GITHUB-1295)
   [Miguel Caballer - @micafer]
 
+- [Maxihost] Add new compute driver for Maxihost provider
+  (https://www.maxihost.com/). (GITHUB-1298)
+  [Spyros Tzavaras - @mpempekos]
+
 Storage
 ~~~~~~~
 


[libcloud] 03/07: Prefix argument name with "ex_" since it's an extension argument.

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 1170e9c3d93276fd20986172acaea863e9e4dd69
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 19:07:28 2019 +0200

    Prefix argument name with "ex_" since it's an extension argument.
---
 libcloud/compute/drivers/maxihost.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libcloud/compute/drivers/maxihost.py b/libcloud/compute/drivers/maxihost.py
index 8f3756b..1eab3c8 100644
--- a/libcloud/compute/drivers/maxihost.py
+++ b/libcloud/compute/drivers/maxihost.py
@@ -119,16 +119,16 @@ class MaxihostNodeDriver(NodeDriver):
                     driver=self, extra=extra)
         return node
 
-    def list_locations(self, available=True):
+    def list_locations(self, ex_available=True):
         """
         List locations
 
-        If available is True, show only locations which are available
+        If ex_available is True, show only locations which are available.
         """
         locations = []
         data = self.connection.request('/regions')
         for location in data.object['regions']:
-            if available:
+            if ex_available:
                 if location.get('available'):
                     locations.append(self._to_location(location))
             else:


[libcloud] 01/07: Merge branch 'maxihost-provider' of https://github.com/mistio/libcloud into mistio-maxihost-provider

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 674d0c226ed55d57f48a3660607ddaf69e2f04d5
Merge: 6a34d68 10e2e6c
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 19:05:24 2019 +0200

    Merge branch 'maxihost-provider' of https://github.com/mistio/libcloud into mistio-maxihost-provider

 docs/_static/images/provider_logos/maxihost.png    | Bin 0 -> 15494 bytes
 docs/compute/drivers/maxihost.rst                  |  30 +++
 libcloud/common/maxihost.py                        |  44 +++++
 libcloud/compute/drivers/maxihost.py               | 218 +++++++++++++++++++++
 libcloud/compute/providers.py                      |   2 +
 libcloud/compute/types.py                          |   1 +
 .../test/compute/fixtures/maxihost/images.json     |  14 ++
 libcloud/test/compute/fixtures/maxihost/keys.json  |  17 ++
 libcloud/test/compute/fixtures/maxihost/node.json  |  46 +++++
 libcloud/test/compute/fixtures/maxihost/nodes.json |  57 ++++++
 libcloud/test/compute/fixtures/maxihost/plans.json |  36 ++++
 .../test/compute/fixtures/maxihost/regions.json    |  39 ++++
 libcloud/test/compute/test_maxihost.py             |  93 +++++++++
 13 files changed, 597 insertions(+)


[libcloud] 06/07: Fix syntax.

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 1d6956683abdda61fbf1e0c326e29b730ce4fa2f
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 19:12:31 2019 +0200

    Fix syntax.
---
 docs/compute/drivers/maxihost.rst | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/docs/compute/drivers/maxihost.rst b/docs/compute/drivers/maxihost.rst
index e427e26..f053540 100644
--- a/docs/compute/drivers/maxihost.rst
+++ b/docs/compute/drivers/maxihost.rst
@@ -12,16 +12,17 @@ driver constructor:
 
 * ``api_key`` - Your API key. Can be obtained from https://control.maxihost.com/api
 
-
 Example
 -------
 
-from libcloud.compute.types import Provider
-from libcloud.compute.providers import get_driver
+.. code-block:: python
+
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
 
-cls = get_driver(Provider.MAXIHOST)
+    cls = get_driver(Provider.MAXIHOST)
 
-driver = cls('api token')
+    driver = cls('api token')
 
 API Docs
 --------


[libcloud] 02/07: Remove default value for required argument.

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit 3a9ef1f2ba89b77f61a7791681edd60661364fc6
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Jun 28 19:06:16 2019 +0200

    Remove default value for required argument.
---
 libcloud/compute/drivers/maxihost.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcloud/compute/drivers/maxihost.py b/libcloud/compute/drivers/maxihost.py
index 28cc3c0..8f3756b 100644
--- a/libcloud/compute/drivers/maxihost.py
+++ b/libcloud/compute/drivers/maxihost.py
@@ -190,14 +190,14 @@ class MaxihostNodeDriver(NodeDriver):
         data = self.connection.request('/account/keys')
         return list(map(self._to_key_pair, data.object['ssh_keys']))
 
-    def create_key_pair(self, name, public_key=''):
+    def create_key_pair(self, name, public_key):
         """
         Create a new SSH key.
 
         :param      name: Key name (required)
         :type       name: ``str``
 
-        :param      public_key: Valid public key string (required)
+        :param      public_key: base64 encoded public key string (required)
         :type       public_key: ``str``
         """
         attr = {'name': name, 'public_key': public_key}