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 2023/09/20 18:16:08 UTC

[libcloud] branch trunk updated (f2d949fff -> bb0dba7d0)

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 f2d949fff Merge pull request #1955 from apache/dependabot/pip/black-23.9.1
     add 5a9b157d2 Updated Linode (Akamai Connected Cloud) support (including cloud-init)
     new 03e60cc0f Merge branch 'linode-cloudinit' of https://github.com/mraygalaxy2/libcloud into mraygalaxy2-linode-cloudinit
     new 01c7e61de Improve upgrade notes entry.
     new 1c4f364b1 Re-generate supported providers tables.
     new bc631dd73 Reformat code with black.
     new bb0dba7d0 Default ex_userdata to None instead of False, add test for ex_userdata argument.

The 5 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                                        |  5 ++
 .../_supported_methods_image_management.rst        |  2 +-
 .../_supported_methods_key_pair_management.rst     |  2 +-
 docs/storage/_supported_providers.rst              | 44 ++++++------
 docs/upgrade_notes.rst                             | 21 ++++++
 libcloud/compute/drivers/linode.py                 | 84 +++++++++++++++++++++-
 .../fixtures/linode_v4/create_key_pair.json        |  6 ++
 .../compute/fixtures/linode_v4/list_key_pairs.json | 13 ++++
 libcloud/test/compute/test_linode_v4.py            | 80 ++++++++++++++++++---
 9 files changed, 219 insertions(+), 38 deletions(-)
 create mode 100644 libcloud/test/compute/fixtures/linode_v4/create_key_pair.json
 create mode 100644 libcloud/test/compute/fixtures/linode_v4/list_key_pairs.json


[libcloud] 05/05: Default ex_userdata to None instead of False, add test for ex_userdata 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 bb0dba7d0fdc24bf4b21209a6e4267dd6c773a6d
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Wed Sep 20 20:07:20 2023 +0200

    Default ex_userdata to None instead of False, add test for ex_userdata
    argument.
---
 libcloud/compute/drivers/linode.py      |  2 +-
 libcloud/test/compute/test_linode_v4.py | 39 ++++++++++++++++++++++++++++++++-
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/libcloud/compute/drivers/linode.py b/libcloud/compute/drivers/linode.py
index 4d21c1bc1..5d395cbf7 100644
--- a/libcloud/compute/drivers/linode.py
+++ b/libcloud/compute/drivers/linode.py
@@ -994,7 +994,7 @@ class LinodeNodeDriverV4(LinodeNodeDriver):
         ex_tags=None,
         ex_backups_enabled=False,
         ex_private_ip=False,
-        ex_userdata=False,
+        ex_userdata=None,
     ):
         """Creates a Linode Instance.
         In order for this request to complete successfully,
diff --git a/libcloud/test/compute/test_linode_v4.py b/libcloud/test/compute/test_linode_v4.py
index c4c5c8dd5..ed5d5d2e5 100644
--- a/libcloud/test/compute/test_linode_v4.py
+++ b/libcloud/test/compute/test_linode_v4.py
@@ -14,6 +14,8 @@
 # limitations under the License.
 
 import sys
+import json
+import base64
 import unittest
 from datetime import datetime
 
@@ -26,6 +28,13 @@ from libcloud.common.linode import LinodeDisk, LinodeIPAddress, LinodeExceptionV
 from libcloud.test.file_fixtures import ComputeFileFixtures
 from libcloud.compute.drivers.linode import LinodeNodeDriver, LinodeNodeDriverV4
 
+EX_USERDATA = """
+#!/bin/sh
+
+echo "test"
+exit 1
+""".strip()
+
 
 class LinodeTestsV4(unittest.TestCase, TestCaseMixin):
     should_list_volumes = True
@@ -99,6 +108,23 @@ class LinodeTestsV4(unittest.TestCase, TestCaseMixin):
         )
         self.assertTrue(isinstance(node, Node))
 
+    def test_create_node_with_ex_userdata(self):
+        size = self.driver.list_sizes()[0]
+        image = self.driver.list_images()[0]
+        location = self.driver.list_locations()[0]
+
+        LinodeMockHttpV4.type = "EX_USERDATA"
+
+        node = self.driver.create_node(
+            location,
+            "node-name",
+            size=size,
+            image=image,
+            root_pass="test123456",
+            ex_userdata=EX_USERDATA,
+        )
+        self.assertTrue(isinstance(node, Node))
+
     def test_list_nodes(self):
         nodes = self.driver.list_nodes()
         self.assertEqual(len(nodes), 2)
@@ -434,7 +460,7 @@ class LinodeTestsV4(unittest.TestCase, TestCaseMixin):
         self.assertEqual(len(images), 34)
 
 
-class LinodeMockHttpV4(MockHttp):
+class LinodeMockHttpV4(MockHttp, unittest.TestCase):
     fixtures = ComputeFileFixtures("linode_v4")
 
     def _v4_profile_sshkeys(self, method, url, body, headers):
@@ -477,6 +503,17 @@ class LinodeMockHttpV4(MockHttp):
             body = self.fixtures.load("create_node.json")
             return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _v4_linode_instances_EX_USERDATA(self, method, url, body, headers):
+        if method == "POST":
+            body = json.loads(body)
+            self.assertTrue("metadata" in body)
+            self.assertTrue("user_data" in body["metadata"])
+            body_userdata_decoded = base64.b64decode(body["metadata"]["user_data"]).decode("utf-8")
+            self.assertEqual(body_userdata_decoded, EX_USERDATA)
+
+            body = self.fixtures.load("create_node.json")
+            return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
     def _v4_linode_instances_NO_IMAGE(self, method, url, body, headers):
         body = self.fixtures.load("create_node_no_image.json")
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])


[libcloud] 04/05: Reformat code with black.

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 bc631dd7362fd4a60156fd116c5a1fcc649a0d7b
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Wed Sep 20 20:07:11 2023 +0200

    Reformat code with black.
---
 libcloud/compute/drivers/linode.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libcloud/compute/drivers/linode.py b/libcloud/compute/drivers/linode.py
index 0b08bca47..4d21c1bc1 100644
--- a/libcloud/compute/drivers/linode.py
+++ b/libcloud/compute/drivers/linode.py
@@ -1062,7 +1062,11 @@ class LinodeNodeDriverV4(LinodeNodeDriver):
         }
 
         if ex_userdata:
-            attr["metadata"] = {"user_data": binascii.b2a_base64(bytes(ex_userdata.encode("utf-8"))).decode("ascii").strip()}
+            attr["metadata"] = {
+                "user_data": binascii.b2a_base64(bytes(ex_userdata.encode("utf-8")))
+                .decode("ascii")
+                .strip()
+            }
 
         if image is not None:
             if root_pass is None:


[libcloud] 03/05: Re-generate supported providers tables.

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 1c4f364b19a1ed319ea5a2e0e3cfe88798dfc184
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Wed Sep 20 19:57:30 2023 +0200

    Re-generate supported providers tables.
---
 docs/storage/_supported_providers.rst | 44 +++++++++++++++++------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/docs/storage/_supported_providers.rst b/docs/storage/_supported_providers.rst
index 17e8e8535..c13c6eadd 100644
--- a/docs/storage/_supported_providers.rst
+++ b/docs/storage/_supported_providers.rst
@@ -1,27 +1,27 @@
 .. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it
 
-========================== =================================================== =================== ======================================================================================================================================================================================================================================================================================================================= =================================================== ============================= [...]
-Provider                   Documentation                                       Provider Constant   Supported Regions                                                                                                                                                                                                                                                                                                       Module                                              Class Name                    [...]
-========================== =================================================== =================== ======================================================================================================================================================================================================================================================================================================================= =================================================== ============================= [...]
-`Aliyun OSS`_                                                                  ALIYUN_OSS          single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.oss`                 :class:`OSSStorageDriver`     [...]
-`PCextreme AuroraObjects`_ :doc:`Click </storage/drivers/auroraobjects>`       AURORAOBJECTS       single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.auroraobjects`       :class:`AuroraObjectsStorageD [...]
-`Microsoft Azure (blobs)`_ :doc:`Click </storage/drivers/azure_blobs>`         AZURE_BLOBS         single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.azure_blobs`         :class:`AzureBlobsStorageDriv [...]
-`Backblaze B2`_            :doc:`Click </storage/drivers/backblaze_b2>`        BACKBLAZE_B2        single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.backblaze_b2`        :class:`BackblazeB2StorageDri [...]
-`CloudFiles`_                                                                  CLOUDFILES          dfw, hkg, iad, lon, ord, syd                                                                                                                                                                                                                                                                                            :mod:`libcloud.storage.drivers.cloudfiles`          :class:`CloudFilesStorageDriv [...]
-`DigitalOcean Spaces`_     :doc:`Click </storage/drivers/digitalocean_spaces>` DIGITALOCEAN_SPACES single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.digitalocean_spaces` :class:`DigitalOceanSpacesSto [...]
-`Google Cloud Storage`_    :doc:`Click </storage/drivers/google_storage>`      GOOGLE_STORAGE      single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.google_storage`      :class:`GoogleStorageDriver`  [...]
-`KTUCloud Storage`_                                                            KTUCLOUD            dfw, hkg, iad, lon, ord, syd                                                                                                                                                                                                                                                                                            :mod:`libcloud.storage.drivers.ktucloud`            :class:`KTUCloudStorageDriver [...]
-`Local Storage`_                                                               LOCAL               single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.local`               :class:`LocalStorageDriver`   [...]
-`MinIO Storage Driver`_    :doc:`Click </storage/drivers/minio>`               MINIO               single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.minio`               :class:`MinIOStorageDriver`   [...]
-`Nimbus.io`_                                                                   NIMBUS              single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.nimbus`              :class:`NimbusStorageDriver`  [...]
-`Ninefold`_                                                                    NINEFOLD            single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.ninefold`            :class:`NinefoldStorageDriver [...]
-`OpenStack Swift`_         :doc:`Click </storage/drivers/openstack_swift>`     OPENSTACK_SWIFT     dfw, hkg, iad, lon, ord, syd                                                                                                                                                                                                                                                                                            :mod:`libcloud.storage.drivers.cloudfiles`          :class:`OpenStackSwiftStorage [...]
-`Ovh Storage Driver`_                                                          OVH                 gra, sbg                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.ovh`                 :class:`OvhStorageDriver`     [...]
-`Amazon S3`_               :doc:`Click </storage/drivers/s3>`                  S3                  af-south-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-north-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, sa-east-2, us-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2 :mod:`libcloud.storage.drivers.s3`                  :class:`S3StorageDriver`      [...]
-`Ceph RGW`_                                                                    S3_RGW              single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.rgw`                 :class:`S3RGWStorageDriver`   [...]
-`RGW Outscale`_                                                                S3_RGW_OUTSCALE     single region driver                                                                                                                                                                                                                                                                                                    :mod:`libcloud.storage.drivers.rgw`                 :class:`S3RGWOutscaleStorageD [...]
-`Scaleway Storage Driver`_ :doc:`Click </storage/drivers/scaleway>`            SCALEWAY            fr-par, nl-ams, pl-waw                                                                                                                                                                                                                                                                                                  :mod:`libcloud.storage.drivers.scaleway`            :class:`ScalewayStorageDriver [...]
-========================== =================================================== =================== ======================================================================================================================================================================================================================================================================================================================= =================================================== ============================= [...]
+========================== =================================================== =================== =================================================================================================================================================================================================================================================================================================================================== =================================================== ================= [...]
+Provider                   Documentation                                       Provider Constant   Supported Regions                                                                                                                                                                                                                                                                                                                   Module                                              Class Name        [...]
+========================== =================================================== =================== =================================================================================================================================================================================================================================================================================================================================== =================================================== ================= [...]
+`Aliyun OSS`_                                                                  ALIYUN_OSS          single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.oss`                 :class:`OSSStorag [...]
+`PCextreme AuroraObjects`_ :doc:`Click </storage/drivers/auroraobjects>`       AURORAOBJECTS       single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.auroraobjects`       :class:`AuroraObj [...]
+`Microsoft Azure (blobs)`_ :doc:`Click </storage/drivers/azure_blobs>`         AZURE_BLOBS         single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.azure_blobs`         :class:`AzureBlob [...]
+`Backblaze B2`_            :doc:`Click </storage/drivers/backblaze_b2>`        BACKBLAZE_B2        single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.backblaze_b2`        :class:`Backblaze [...]
+`CloudFiles`_                                                                  CLOUDFILES          dfw, hkg, iad, lon, ord, syd                                                                                                                                                                                                                                                                                                        :mod:`libcloud.storage.drivers.cloudfiles`          :class:`CloudFile [...]
+`DigitalOcean Spaces`_     :doc:`Click </storage/drivers/digitalocean_spaces>` DIGITALOCEAN_SPACES single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.digitalocean_spaces` :class:`DigitalOc [...]
+`Google Cloud Storage`_    :doc:`Click </storage/drivers/google_storage>`      GOOGLE_STORAGE      single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.google_storage`      :class:`GoogleSto [...]
+`KTUCloud Storage`_                                                            KTUCLOUD            dfw, hkg, iad, lon, ord, syd                                                                                                                                                                                                                                                                                                        :mod:`libcloud.storage.drivers.ktucloud`            :class:`KTUCloudS [...]
+`Local Storage`_                                                               LOCAL               single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.local`               :class:`LocalStor [...]
+`MinIO Storage Driver`_    :doc:`Click </storage/drivers/minio>`               MINIO               single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.minio`               :class:`MinIOStor [...]
+`Nimbus.io`_                                                                   NIMBUS              single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.nimbus`              :class:`NimbusSto [...]
+`Ninefold`_                                                                    NINEFOLD            single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.ninefold`            :class:`NinefoldS [...]
+`OpenStack Swift`_         :doc:`Click </storage/drivers/openstack_swift>`     OPENSTACK_SWIFT     dfw, hkg, iad, lon, ord, syd                                                                                                                                                                                                                                                                                                        :mod:`libcloud.storage.drivers.cloudfiles`          :class:`OpenStack [...]
+`Ovh Storage Driver`_                                                          OVH                 gra, sbg                                                                                                                                                                                                                                                                                                                            :mod:`libcloud.storage.drivers.ovh`                 :class:`OvhStorag [...]
+`Amazon S3`_               :doc:`Click </storage/drivers/s3>`                  S3                  af-south-1, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-southeast-1, ap-southeast-2, ca-central-1, cn-north-1, cn-northwest-1, eu-central-1, eu-north-1, eu-south-1, eu-west-1, eu-west-2, eu-west-3, me-south-1, sa-east-1, sa-east-2, us-east-1, us-east-2, us-gov-east-1, us-gov-west-1, us-west-1, us-west-2 :mod:`libcloud.storage.drivers.s3`                  :class:`S3Storage [...]
+`Ceph RGW`_                                                                    S3_RGW              single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.rgw`                 :class:`S3RGWStor [...]
+`RGW Outscale`_                                                                S3_RGW_OUTSCALE     single region driver                                                                                                                                                                                                                                                                                                                :mod:`libcloud.storage.drivers.rgw`                 :class:`S3RGWOuts [...]
+`Scaleway Storage Driver`_ :doc:`Click </storage/drivers/scaleway>`            SCALEWAY            fr-par, nl-ams, pl-waw                                                                                                                                                                                                                                                                                                              :mod:`libcloud.storage.drivers.scaleway`            :class:`ScalewayS [...]
+========================== =================================================== =================== =================================================================================================================================================================================================================================================================================================================================== =================================================== ================= [...]
 
 .. _`Aliyun OSS`: http://www.aliyun.com/product/oss
 .. _`PCextreme AuroraObjects`: https://www.pcextreme.com/aurora/objects


[libcloud] 02/05: Improve upgrade notes 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 01c7e61de89144205a2dcc1db31239bb527b725c
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Wed Sep 20 19:57:20 2023 +0200

    Improve upgrade notes entry.
---
 docs/upgrade_notes.rst | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/docs/upgrade_notes.rst b/docs/upgrade_notes.rst
index d97cdaca2..27c9c3e0e 100644
--- a/docs/upgrade_notes.rst
+++ b/docs/upgrade_notes.rst
@@ -7,9 +7,24 @@ preserve the old behavior when this is possible.
 
 Libcloud 3.8.0
 --------------
-- [LINODE API v4] Order of arguments to create_node() was changed. The order of the
-  arguments for name and size were not consistent with the rest of the codebase.
-  This is possibly a breaking change for anyone using a previous version. 
+
+* [LINODE API v4] Order of arguments to create_node() was changed. The order of the
+  arguments for name and size were not consistent with the rest of the codebase
+  and with the standard Libcloud API.
+
+  This is possibly a breaking change for anyone using a previous version.
+
+  New method signature:
+
+  .. sourcecode:: python
+
+    def create_node(self, location, name, size, image, ...)
+
+  Old method signature:
+
+  .. sourcecode:: python
+
+    def create_node(self, location, size=None, image=None, name=None, ...)
 
 Libcloud 3.7.0
 --------------


[libcloud] 01/05: Merge branch 'linode-cloudinit' of https://github.com/mraygalaxy2/libcloud into mraygalaxy2-linode-cloudinit

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 03e60cc0f67d73f95acf62eed0bac809c6988fb1
Merge: f2d949fff 5a9b157d2
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Wed Sep 20 19:53:44 2023 +0200

    Merge branch 'linode-cloudinit' of https://github.com/mraygalaxy2/libcloud into mraygalaxy2-linode-cloudinit

 CHANGES.rst                                        |  5 ++
 .../_supported_methods_image_management.rst        |  2 +-
 .../_supported_methods_key_pair_management.rst     |  2 +-
 docs/upgrade_notes.rst                             |  6 ++
 libcloud/compute/drivers/linode.py                 | 80 +++++++++++++++++++++-
 .../fixtures/linode_v4/create_key_pair.json        |  6 ++
 .../compute/fixtures/linode_v4/list_key_pairs.json | 13 ++++
 libcloud/test/compute/test_linode_v4.py            | 43 +++++++++---
 8 files changed, 141 insertions(+), 16 deletions(-)