Add license for images Signed-off-by: Eric Johnson <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/d490379c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/d490379c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/d490379c Branch: refs/heads/trunk Commit: d490379c71d7c9ad082ee33dc764f5eceb228b1d Parents: bf35421 Author: Eric Johnson <[email protected]> Authored: Wed Oct 18 13:59:23 2017 +0000 Committer: Eric Johnson <[email protected]> Committed: Thu Oct 19 15:37:53 2017 +0000 ---------------------------------------------------------------------- libcloud/compute/drivers/gce.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/d490379c/libcloud/compute/drivers/gce.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index e5f29e7..f49aaf0 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -3241,7 +3241,7 @@ class GCENodeDriver(NodeDriver): def ex_create_image(self, name, volume, description=None, family=None, guest_os_features=None, use_existing=True, - wait_for_completion=True): + wait_for_completion=True, ex_licenses=None): """ Create an image from the provided volume. @@ -3266,6 +3266,10 @@ class GCENodeDriver(NodeDriver): valid for bootable images only. :type guest_os_features: ``list`` of ``str`` or ``None`` + :keyword ex_licenses: List of strings representing licenses + to be associated with the image. + :type ex_licenses: ``list`` of ``str`` + :keyword use_existing: If True and an image with the given name already exists, return an object for that image instead of attempting to create @@ -3295,6 +3299,11 @@ class GCENodeDriver(NodeDriver): image_data['rawDisk'] = {'source': volume, 'containerType': 'TAR'} else: raise ValueError('Source must be instance of StorageVolume or URI') + if ex_licenses: + if isinstance(ex_licenses, str): + ex_licenses = [ex_licenses] + image_data['licenses'] = ex_licenses + if guest_os_features: image_data['guestOsFeatures'] = [] if isinstance(guest_os_features, str):
