Skip to content

Commit

Permalink
Added cloud specific parameter to base compute wait_until_running met…
Browse files Browse the repository at this point in the history
…hod to make compatible with Azure

Closes #548

Signed-off-by: Tomaz Muraus <tomaz@tomaz.me>
  • Loading branch information
davidwilson2038 authored and Kami committed Aug 7, 2015
1 parent 4ab231c commit 4cc3adf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,13 @@ Compute
(LIBCLOUD-731, GITHUB-559)
[David Wilson]

- Allow user to specify which arguments are passed to ``list_nodes`` method
which is called inside ``wait_until_running`` by passing
``ex_list_nodes_kwargs`` argument to the ``wait_until_running`` method.
(``ex_user_data`` argument).
(LIBCLOUD-723, GITHUB-548)
[David Wilson]

Storage
~~~~~~~

Expand Down
14 changes: 11 additions & 3 deletions libcloud/compute/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1260,8 +1260,9 @@ def delete_key_pair(self, key_pair):
raise NotImplementedError(
'delete_key_pair not implemented for this driver')

def wait_until_running(self, nodes, wait_period=3, timeout=600,
ssh_interface='public_ips', force_ipv4=True):
def wait_until_running(self, nodes, wait_period=3,
timeout=600, ssh_interface='public_ips',
force_ipv4=True, ex_list_nodes_kwargs=None):
"""
Block until the provided nodes are considered running.
Expand All @@ -1287,10 +1288,17 @@ def wait_until_running(self, nodes, wait_period=3, timeout=600,
:param force_ipv4: Ignore IPv6 addresses (default is True).
:type force_ipv4: ``bool``
:param ex_list_nodes_kwargs: Optional driver-specific keyword arguments
which are passed to the ``list_nodes``
method.
:type ex_list_nodes_kwargs: ``dict``
:return: ``[(Node, ip_addresses)]`` list of tuple of Node instance and
list of ip_address on success.
:rtype: ``list`` of ``tuple``
"""
ex_list_nodes_kwargs = ex_list_nodes_kwargs or {}

def is_supported(address):
"""
Return True for supported address.
Expand All @@ -1316,7 +1324,7 @@ def filter_addresses(addresses):
uuids = set([node.uuid for node in nodes])

while time.time() < end:
all_nodes = self.list_nodes()
all_nodes = self.list_nodes(**ex_list_nodes_kwargs)
matching_nodes = list([node for node in all_nodes
if node.uuid in uuids])

Expand Down

0 comments on commit 4cc3adf

Please sign in to comment.