- def search_for(self, term, list_method, key=lambda item: item.id):
+ def _init_ssh_key(self, filename):
+ with open(filename) as ssh_file:
+ key = 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.
+
+ Arguments:
+ * term: The value that identifies a matching item.
+ * list_method: A string that names the method to call on this
+ instance's libcloud driver for a list of objects.
+ * key: A function that accepts a cloud object and returns a
+ value search for a `term` match on each item. Returns the
+ object's 'id' attribute by default.
+ """