Kami opened a new pull request #1389: Reduce reliance on **kwargs in 
"create_node()" methods
URL: https://github.com/apache/libcloud/pull/1389
 
 
   This pull request tries to mitigate / resolve an issue with legacy code / 
kwargs abuse brought up in #1383.
   
   ## Description, Background
   
   Currently a lot of ``create_node()`` method signatures use ``**kwargs`` 
instead of regular positional + keyword arguments.
   
   That's bad for many reasons (makes code introspection hard / impossible, bad 
API, hard to follow and understand the code, etc.).
   
   One of the reasons for that is that ``deploy_node()`` method passes all the 
keyword argument it takes to ``create_node()`` method, even though majority of 
the arguments it takes are ``deploy_node()`` specific (ssh_username, max_tries, 
ssh_interface, etc.) and shouldn't be passed / propagated to ``create_node()``.
   
   Only keyword argument which potentially needs to be propagated is ``auth`` 
argument. That argument is used by provider drivers which support password 
based SSH authentication (e.g. Linode).
   
   ## Proposed Solution
   
   This solution updates ``deploy_node()`` code to only pass non deploy_node 
specific keyword arguments to the ``create_node()`` method.
   
   If for some reason driver method throws (e.g. that driver still expects some 
deploy_node arguments which really shouldn't happen, but there might be some 
legacy code which does that out there), we simply fall back to the old approach 
and pass all the arguments to ``create_node()`` method.
   
   This will allow drivers to still support ``deploy_node()`` functionality 
without needing to use ``**kwargs`` in ``create_node()`` method signature. They 
will be able to normally declare positional and keyword arguments they support 
in that method.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to