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 2020/02/16 20:42:41 UTC

[libcloud] branch trunk updated (8518aa0 -> 9e51fc0)

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 8518aa0  Add file with a couple of apache-libcloud PyPi package related BigQuery queries.
     new ea955ef  Release tag 2.8 reworked the kwargs based implementation of the ec2 driver, introducing this error where the literal string 'ex_userdata' was passed during create_node intead of the actual ex_userdata kwarg.
     new 5593d6c  Add tests for ex_userdata argument.
     new 9e51fc0  Add changelog entry.

The 3 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                       |  7 +++++++
 libcloud/compute/drivers/ec2.py   |  2 +-
 libcloud/test/compute/test_ec2.py | 28 +++++++++++++++++++++++++++-
 3 files changed, 35 insertions(+), 2 deletions(-)


[libcloud] 01/03: Release tag 2.8 reworked the kwargs based implementation of the ec2 driver, introducing this error where the literal string 'ex_userdata' was passed during create_node intead of the actual ex_userdata kwarg.

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 ea955ef5ba6b3a42143a77331aac41c62b9104e7
Author: Daniel Chaffelson <ch...@gmail.com>
AuthorDate: Sun Feb 16 10:38:31 2020 +0000

    Release tag 2.8 reworked the kwargs based implementation of the ec2 driver, introducing this error where the literal string 'ex_userdata' was passed during create_node intead of the actual ex_userdata kwarg.
---
 libcloud/compute/drivers/ec2.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index dd31e48..51df620 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -1970,7 +1970,7 @@ class BaseEC2NodeDriver(NodeDriver):
             params['KeyName'] = ex_keyname
 
         if ex_userdata:
-            params['UserData'] = base64.b64encode(b('ex_userdata'))\
+            params['UserData'] = base64.b64encode(b(ex_userdata))\
                 .decode('utf-8')
 
         if ex_clienttoken:


[libcloud] 02/03: Add tests 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 5593d6cd0c06d1bb0416d157a89a956ba249092d
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sun Feb 16 21:38:30 2020 +0100

    Add tests for ex_userdata argument.
---
 libcloud/test/compute/test_ec2.py | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index c74a50a..7bcfe5b 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -19,10 +19,13 @@ from collections import OrderedDict
 
 import os
 import sys
+import base64
 from datetime import datetime
 from libcloud.utils.iso8601 import UTC
 
 from libcloud.utils.py3 import httplib
+from libcloud.utils.py3 import parse_qs
+from libcloud.utils.py3 import b
 
 from libcloud.compute.drivers.ec2 import EC2NodeDriver
 from libcloud.compute.drivers.ec2 import EC2PlacementGroup
@@ -1373,7 +1376,7 @@ class EC2SAEastTests(EC2Tests):
     region = 'sa-east-1'
 
 
-class EC2MockHttp(MockHttp):
+class EC2MockHttp(MockHttp, unittest.TestCase):
     fixtures = ComputeFileFixtures('ec2')
 
     def _DescribeInstances(self, method, url, body, headers):
@@ -1440,6 +1443,17 @@ class EC2MockHttp(MockHttp):
         body = self.fixtures.load('run_instances.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _ex_user_data_RunInstances(self, method, url, body, headers):
+        # test_create_node_with_ex_userdata
+        params = parse_qs(url)
+
+        self.assertTrue('UserData' in params)
+        user_data = base64.b64decode(b(params['UserData'][0])).decode('utf-8')
+        self.assertEqual(user_data, 'foo\nbar\foo')
+
+        body = self.fixtures.load('run_instances.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
     def _create_ex_assign_public_ip_RunInstances(self, method, url, body, headers):
         self.assertUrlContainsQueryParams(url, {
             'NetworkInterface.1.AssociatePublicIpAddress': "true",
@@ -2022,6 +2036,18 @@ class OutscaleTests(EC2Tests):
                           image=image, size=size,
                           ex_iamprofile='foo')
 
+    def test_create_node_with_ex_userdata(self):
+        EC2MockHttp.type = 'ex_user_data'
+
+        image = NodeImage(id='ami-be3adfd7',
+                          name=self.image_name,
+                          driver=self.driver)
+        size = NodeSize('m1.small', 'Small Instance', None, None, None, None,
+                        driver=self.driver)
+
+        result = self.driver.create_node(name='foo', image=image, size=size,
+                                         ex_userdata='foo\nbar\foo')
+
 
 class FCUMockHttp(EC2MockHttp):
     fixtures = ComputeFileFixtures('fcu')


[libcloud] 03/03: Add 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 9e51fc06e79a32f43d513d815b12e8a8f834d269
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sun Feb 16 21:40:58 2020 +0100

    Add changelog entry.
---
 CHANGES.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CHANGES.rst b/CHANGES.rst
index 8a01acf..90d02b0 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -22,6 +22,13 @@ Compute
   (GITHUB-1421)
   [Tomaz Muraus]
 
+- [EC2] Fix ``ex_userdata`` keyword argument in the ``create_node()`` method
+  being ignored / not working correctly.
+
+  NOTE: This regression has been inadvertently introduced in v2.8.0.
+  (GITHUB-1426)
+  [Dan Chaffelson - @Chaffelson]
+
 Storage
 ~~~~~~~