Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra info to images for EC2 driver #31

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion libcloud/compute/base.py
Expand Up @@ -266,7 +266,7 @@ def __init__(self, id, name, driver, extra=None):

def __repr__(self):
return (('<NodeImage: id=%s, name=%s, driver=%s ...>')
% (self.id, self.name, self.driver.name))
% (self.id, self.name, self.driver.name, self.extra))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will throw an exception since there are only three placeholders in the string.



class NodeLocation(object):
Expand Down
25 changes: 24 additions & 1 deletion libcloud/compute/drivers/ec2.py
Expand Up @@ -381,7 +381,30 @@ def _to_image(self, element):
namespace=NAMESPACE),
name=findtext(element=element, xpath='imageLocation',
namespace=NAMESPACE),
driver=self.connection.driver)
driver=self.connection.driver,
extra = {
'state': findattr(element=element, xpath="imageState",
namespace=NAMESPACE),
'ownerid': findattr(element=element, xpath="imageOwnerId",
namespace=NAMESPACE),
'owneralias': findattr(element=element, xpath="imageOwnerAlias",
namespace=NAMESPACE),
'ispublic': findattr(element=element, xpath="isPublic",
namespace=NAMESPACE),
'architecture': findattr(element=element, xpath="architecture",
namespace=NAMESPACE),
'imagetype': findattr(element=element, xpath="imageType",
namespace=NAMESPACE),
'platform': findattr(element=element, xpath="platform",
namespace=NAMESPACE),
'rootdevicetype': findattr(element=element, xpath="rootDeviceType",
namespace=NAMESPACE),
'virtualizationtype': findattr(element=element, xpath="virtualizationType",
namespace=NAMESPACE),
'hypervisor': findattr(element=element, xpath="hypervisor",
namespace=NAMESPACE)
}
)
return n

def list_nodes(self):
Expand Down