Skip to content

Commit

Permalink
Don't abuse kwargs, explicitly declare ex_custom_data argument.
Browse files Browse the repository at this point in the history
Also add a docstring for that argument.
  • Loading branch information
Kami committed Aug 2, 2015
1 parent 20ebeff commit d79cffd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libcloud/compute/drivers/azure.py
Expand Up @@ -516,7 +516,8 @@ def list_volumes(self, node=None):
def create_node(self, name, size, image, ex_cloud_service_name,
ex_storage_service_name=None, ex_new_deployment=False,
ex_deployment_slot="Production", ex_deployment_name=None,
ex_admin_user_id="azureuser", auth=None, **kwargs):
ex_admin_user_id="azureuser", ex_custom_data=None,
auth=None, **kwargs):
"""
Create Azure Virtual Machine
Expand Down Expand Up @@ -570,6 +571,10 @@ def create_node(self, name, size, image, ex_cloud_service_name,
to using the Cloud Service name.
:type ex_deployment_name: ``str``
:type ex_custom_data: ``str``
:keyword ex_custom_data: Optional script or other data which is
injected into the VM when it's begining
provisioned.
:keyword ex_admin_user_id: Optional. Defaults to 'azureuser'.
:type ex_admin_user_id: ``str``
Expand All @@ -579,10 +584,6 @@ def create_node(self, name, size, image, ex_cloud_service_name,
auth = self._get_and_check_auth(auth)
password = auth.password

# Check for custom data
custom_data = None
if 'custom_data' in kwargs:
custom_data = kwargs['custom_data']
if not isinstance(size, NodeSize):
raise ValueError('Size must be an instance of NodeSize')

Expand Down Expand Up @@ -668,7 +669,7 @@ def create_node(self, name, size, image, ex_cloud_service_name,
ex_admin_user_id,
password,
False,
custom_data
ex_custom_data
)

network_config.input_endpoints.items.append(endpoint)
Expand Down

0 comments on commit d79cffd

Please sign in to comment.