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


The following commit(s) were added to refs/heads/trunk by this push:
     new 4107267  Only pass "auth" argument to "create_node()" if that argument 
is passed to "deploy_node()" method.
4107267 is described below

commit 410726739c86c2537c8128f50b3c89d6c0f88f65
Author: Tomaz Muraus <[email protected]>
AuthorDate: Fri Dec 20 23:25:36 2019 +0100

    Only pass "auth" argument to "create_node()" if that argument is passed
    to "deploy_node()" method.
    
    This way drivers which don't take "auth" argument but support deployment
    functionality don't need to take that argument in the "create_node()"
    method signature.
---
 libcloud/compute/base.py        | 7 ++++++-
 libcloud/compute/drivers/gce.py | 4 +---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 6fae10c..06e1a2d 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -1064,7 +1064,12 @@ class NodeDriver(BaseDriver):
         # rely on password being stored on the "auth" argument and that's why
         # we also propagate that argument to "create_node()" method.
         try:
-            node = self.create_node(auth=auth, **create_node_kwargs)
+            # NOTE: We only pass auth to the method if auth argument is
+            # provided
+            if auth:
+                node = self.create_node(auth=auth, **create_node_kwargs)
+            else:
+                node = self.create_node(**create_node_kwargs)
         except TypeError as e:
             msg_1_re = (r'create_node\(\) missing \d+ required '
                         'positional arguments.*')
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 3a98995..5077653 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -3998,9 +3998,7 @@ class GCENodeDriver(NodeDriver):
             ex_on_host_maintenance=None, ex_automatic_restart=None,
             ex_preemptible=None, ex_image_family=None, ex_labels=None,
             ex_accelerator_type=None, ex_accelerator_count=None,
-            ex_disk_size=None, auth=None):
-        # NOTE: "auth" argument is unused, but it's needed for "deploy_node()"
-        # functionality to work
+            ex_disk_size=None):
         """
         Create a new node and return a node object for the node.
 

Reply via email to