def _init_ping_host(self, ping_host):
self.ping_host = ping_host
- def search_for(self, term, list_method, key=attrgetter('id')):
+ def _init_ssh_key(self, filename):
+ with open(filename) as ssh_file:
+ key = cloud_base.NodeAuthSSHKey(ssh_file.read())
+ return 'auth', key
+
+ def search_for(self, term, list_method, key=attrgetter('id'), **kwargs):
"""Return one matching item from a list of cloud objects.
Raises ValueError if the number of matching objects is not exactly 1.
"""
cache_key = (list_method, term)
if cache_key not in self.SEARCH_CACHE:
- results = [item for item in getattr(self.real, list_method)()
+ items = getattr(self.real, list_method)(**kwargs)
+ results = [item for item in items
if key(item) == term]
count = len(results)
if count != 1: