[jira] [Commented] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)
[ https://issues.apache.org/jira/browse/LIBCLOUD-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16408465#comment-16408465 ] ASF GitHub Bot commented on LIBCLOUD-986: - GitHub user jhawkinson opened a pull request: https://github.com/apache/libcloud/pull/1193 LIBCLOUD-986: Add prefix option to azure blob list and iterate containers ## LIBCLOUD-986: Add prefix filter for list and iterate containers to Azure Blob Storage Driver ### Description While testing out the libcloud storage abstraction I've come across a curious omission in driver support. It seems that for many drivers there is additional support for the list_container_objects() and iterate_container_objects() to support a prefix (or ex_prefix). This functionality is not present in the Azure driver for some reason. I've gone and checked the list_blobs API and it also supports this functionality as seen here: https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs I've added the support to the AzureBlobsStorageDriver with these changes. ### Status - done, ready for review ### Checklist - [x] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks) - [ ] Documentation - [x] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html) - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/jhawkinson/libcloud LIBCLOUD-986 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/1193.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1193 commit 735c9e645a067da48192f4846502fd50e1feef0b Author: jhawkDate: 2018-03-21T19:08:02Z LIBCLOUD-986: Add prefix option to azure blob list and iterate container methods > List / Iterate container with prefix for Azure Blob service (This support > exists in the other drivers already) > -- > > Key: LIBCLOUD-986 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-986 > Project: Libcloud > Issue Type: Improvement > Components: Storage >Reporter: Joshua Hawkinson >Priority: Major > > While testing out the libcloud storage abstraction I've come across a curious > omission in driver support. It seems that for many drivers there is > additional support for the {{list_container_objects()}} and > {{iterate_container_objects()}} to support a prefix (or {{ex_prefix)}}. > This functionality is not present in the Azure driver for some reason. I've > gone and checked the list_blobs API and it also supports this functionality > as seen here: > [https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs] > > I've attempted a quick and dirty patch that seems to work as well. > {code} > azure_blobs.py Line 384 > -def iterate_container_objects(self, container): > +def iterate_container_objects(self, container, ex_prefix=None): > """ > @inherits: :class:`StorageDriver.iterate_container_objects` > """ > params = {'restype': 'container', > 'comp': 'list', > + 'prefix': ex_prefix, > 'maxresults': RESPONSES_PER_REQUEST, > 'include': 'metadata'} > Line 419 (Add new function) > def list_container_objects(self, container, ex_prefix=None): > """ > Return a list of objects for the given container. > > :param container: Container instance. > :type container: :class:`Container` > > :param ex_prefix: Only return objects starting with ex_prefix > :type ex_prefix: ``str`` > > :return: A list of Object instances. > :rtype: ``list`` of :class:`Object` > """ > return list(self.iterate_container_objects(container, >ex_prefix=ex_prefix)) > > {code} > > I've just worked around this at a higher level for now. There isn't any > urgency on my end, but it would be nice if the abstraction was more > consistent so I could remove the workaround code. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[GitHub] libcloud pull request #1193: LIBCLOUD-986: Add prefix option to azure blob l...
GitHub user jhawkinson opened a pull request: https://github.com/apache/libcloud/pull/1193 LIBCLOUD-986: Add prefix option to azure blob list and iterate containers ## LIBCLOUD-986: Add prefix filter for list and iterate containers to Azure Blob Storage Driver ### Description While testing out the libcloud storage abstraction I've come across a curious omission in driver support. It seems that for many drivers there is additional support for the list_container_objects() and iterate_container_objects() to support a prefix (or ex_prefix). This functionality is not present in the Azure driver for some reason. I've gone and checked the list_blobs API and it also supports this functionality as seen here: https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs I've added the support to the AzureBlobsStorageDriver with these changes. ### Status - done, ready for review ### Checklist - [x] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks) - [ ] Documentation - [x] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html) - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/jhawkinson/libcloud LIBCLOUD-986 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/1193.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1193 commit 735c9e645a067da48192f4846502fd50e1feef0b Author: jhawkDate: 2018-03-21T19:08:02Z LIBCLOUD-986: Add prefix option to azure blob list and iterate container methods ---
[jira] [Comment Edited] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)
[ https://issues.apache.org/jira/browse/LIBCLOUD-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16408315#comment-16408315 ] Joshua Hawkinson edited comment on LIBCLOUD-986 at 3/21/18 5:51 PM: Okay, done... Here are the diffs for your review: {code:java} diff --git a/libcloud/storage/drivers/azure_blobs.py b/libcloud/storage/drivers/azure_blobs.py index 82ee03a..2475793 100644 --- a/libcloud/storage/drivers/azure_blobs.py +++ b/libcloud/storage/drivers/azure_blobs.py @@ -381,11 +381,12 @@ class AzureBlobsStorageDriver(StorageDriver): if not params['marker']: break - def iterate_container_objects(self, container): + def iterate_container_objects(self, container, ex_prefix=None): """ @inherits: :class:`StorageDriver.iterate_container_objects` """ - params = {'restype': 'container', + params = {'prefix': ex_prefix, + 'restype': 'container', 'comp': 'list', 'maxresults': RESPONSES_PER_REQUEST, 'include': 'metadata'} @@ -416,6 +417,22 @@ class AzureBlobsStorageDriver(StorageDriver): if not params['marker']: break +def list_container_objects(self, container, ex_prefix=None): + """ + Return a list of objects for the given container. + + :param container: Container instance. + :type container: :class:`Container` + + :param ex_prefix: Only return objects starting with ex_prefix + :type ex_prefix: ``str`` + + :return: A list of Object instances. + :rtype: ``list`` of :class:`Object` + """ + return list(self.iterate_container_objects(container, + ex_prefix=ex_prefix)) + def get_container(self, container_name): """ @inherits: :class:`StorageDriver.get_container` diff --git a/libcloud/test/storage/test_azure_blobs.py b/libcloud/test/storage/test_azure_blobs.py index 95ab3f1..69bdebb 100644 --- a/libcloud/test/storage/test_azure_blobs.py +++ b/libcloud/test/storage/test_azure_blobs.py @@ -447,6 +447,28 @@ class AzureBlobsTests(unittest.TestCase): self.assertTrue('content_encoding' in obj.extra) self.assertTrue('content_language' in obj.extra) +def test_list_container_objects_with_prefix(self): +self.mock_response_klass.type = None +AzureBlobsStorageDriver.RESPONSES_PER_REQUEST = 2 + +container = Container(name='test_container', extra={}, + driver=self.driver) +objects = self.driver.list_container_objects(container=container, +ex_prefix='test_prefix') +self.assertEqual(len(objects), 4) + +obj = objects[1] +self.assertEqual(obj.name, 'object2.txt') +self.assertEqual(obj.hash, '0x8CFB90F1BA8CD8F') +self.assertEqual(obj.size, 1048576) +self.assertEqual(obj.container.name, 'test_container') +self.assertTrue('meta1' in obj.meta_data) +self.assertTrue('meta2' in obj.meta_data) +self.assertTrue('last_modified' in obj.extra) +self.assertTrue('content_type' in obj.extra) +self.assertTrue('content_encoding' in obj.extra) +self.assertTrue('content_language' in obj.extra) + {code} And the before and after test results: {code:java} [root@localhost libcloud]# python3 -m pytest -k azure_blobs === test session starts platform linux -- Python 3.4.3, pytest-3.4.2, py-1.5.2, pluggy-0.6.0 rootdir: /usr/libcloud, inifile: pytest.ini collected 9116 items libcloud/test/storage/test_azure_blobs.py F [100%] = FAILURES = _ AzureBlobsTests.test_list_container_objects_with_prefix __ self = def test_list_container_objects_with_prefix(self): self.mock_response_klass.type = None AzureBlobsStorageDriver.RESPONSES_PER_REQUEST = 2 container = Container(name='test_container', extra={}, driver=self.driver) objects = self.driver.list_container_objects(container=container, > ex_prefix='test_prefix') E TypeError: list_container_objects() got an unexpected keyword argument 'ex_prefix' libcloud/test/storage/test_azure_blobs.py:457: TypeError == 9079 tests deselected === === 1 failed, 36 passed, 9079 deselected in 3.39 seconds === [root@localhost libcloud]# python3 -m pytest -k azure_blobs
[jira] [Commented] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)
[ https://issues.apache.org/jira/browse/LIBCLOUD-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16408317#comment-16408317 ] Quentin Pradet commented on LIBCLOUD-986: - Great! Can you please open a pull request on GitHub? https://github.com/apache/libcloud/ > List / Iterate container with prefix for Azure Blob service (This support > exists in the other drivers already) > -- > > Key: LIBCLOUD-986 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-986 > Project: Libcloud > Issue Type: Improvement > Components: Storage >Reporter: Joshua Hawkinson >Priority: Major > > While testing out the libcloud storage abstraction I've come across a curious > omission in driver support. It seems that for many drivers there is > additional support for the {{list_container_objects()}} and > {{iterate_container_objects()}} to support a prefix (or {{ex_prefix)}}. > This functionality is not present in the Azure driver for some reason. I've > gone and checked the list_blobs API and it also supports this functionality > as seen here: > [https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs] > > I've attempted a quick and dirty patch that seems to work as well. > {code} > azure_blobs.py Line 384 > -def iterate_container_objects(self, container): > +def iterate_container_objects(self, container, ex_prefix=None): > """ > @inherits: :class:`StorageDriver.iterate_container_objects` > """ > params = {'restype': 'container', > 'comp': 'list', > + 'prefix': ex_prefix, > 'maxresults': RESPONSES_PER_REQUEST, > 'include': 'metadata'} > Line 419 (Add new function) > def list_container_objects(self, container, ex_prefix=None): > """ > Return a list of objects for the given container. > > :param container: Container instance. > :type container: :class:`Container` > > :param ex_prefix: Only return objects starting with ex_prefix > :type ex_prefix: ``str`` > > :return: A list of Object instances. > :rtype: ``list`` of :class:`Object` > """ > return list(self.iterate_container_objects(container, >ex_prefix=ex_prefix)) > > {code} > > I've just worked around this at a higher level for now. There isn't any > urgency on my end, but it would be nice if the abstraction was more > consistent so I could remove the workaround code. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)
[ https://issues.apache.org/jira/browse/LIBCLOUD-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16408315#comment-16408315 ] Joshua Hawkinson commented on LIBCLOUD-986: --- Okay, done... Here are the diffs for your review: {code:java} diff --git a/libcloud/storage/drivers/azure_blobs.py b/libcloud/storage/drivers/azure_blobs.py index 82ee03a..2475793 100644 --- a/libcloud/storage/drivers/azure_blobs.py +++ b/libcloud/storage/drivers/azure_blobs.py @@ -381,11 +381,12 @@ class AzureBlobsStorageDriver(StorageDriver): if not params['marker']: break - def iterate_container_objects(self, container): + def iterate_container_objects(self, container, ex_prefix=None): """ @inherits: :class:`StorageDriver.iterate_container_objects` """ - params = {'restype': 'container', + params = {'prefix': ex_prefix, + 'restype': 'container', 'comp': 'list', 'maxresults': RESPONSES_PER_REQUEST, 'include': 'metadata'} @@ -416,6 +417,22 @@ class AzureBlobsStorageDriver(StorageDriver): if not params['marker']: break +def list_container_objects(self, container, ex_prefix=None): + """ + Return a list of objects for the given container. + + :param container: Container instance. + :type container: :class:`Container` + + :param ex_prefix: Only return objects starting with ex_prefix + :type ex_prefix: ``str`` + + :return: A list of Object instances. + :rtype: ``list`` of :class:`Object` + """ + return list(self.iterate_container_objects(container, + ex_prefix=ex_prefix)) + def get_container(self, container_name): """ @inherits: :class:`StorageDriver.get_container` diff --git a/libcloud/test/storage/test_azure_blobs.py b/libcloud/test/storage/test_azure_blobs.py index 95ab3f1..69bdebb 100644 --- a/libcloud/test/storage/test_azure_blobs.py +++ b/libcloud/test/storage/test_azure_blobs.py @@ -447,6 +447,28 @@ class AzureBlobsTests(unittest.TestCase): self.assertTrue('content_encoding' in obj.extra) self.assertTrue('content_language' in obj.extra) +def test_list_container_objects_with_prefix(self): +self.mock_response_klass.type = None +AzureBlobsStorageDriver.RESPONSES_PER_REQUEST = 2 + +container = Container(name='test_container', extra={}, + driver=self.driver) +objects = self.driver.list_container_objects(container=container, +ex_prefix='test_prefix') +self.assertEqual(len(objects), 4) + +obj = objects[1] +self.assertEqual(obj.name, 'object2.txt') +self.assertEqual(obj.hash, '0x8CFB90F1BA8CD8F') +self.assertEqual(obj.size, 1048576) +self.assertEqual(obj.container.name, 'test_container') +self.assertTrue('meta1' in obj.meta_data) +self.assertTrue('meta2' in obj.meta_data) +self.assertTrue('last_modified' in obj.extra) +self.assertTrue('content_type' in obj.extra) +self.assertTrue('content_encoding' in obj.extra) +self.assertTrue('content_language' in obj.extra) + {code} And the before and after test results: {code:java} [root@localhost libcloud]# python3 -m pytest -k azure_blobs === test session starts platform linux -- Python 3.4.3, pytest-3.4.2, py-1.5.2, pluggy-0.6.0 rootdir: /usr/libcloud, inifile: pytest.ini collected 9116 items libcloud/test/storage/test_azure_blobs.py F [100%] = FAILURES = _ AzureBlobsTests.test_list_container_objects_with_prefix __ self = def test_list_container_objects_with_prefix(self): self.mock_response_klass.type = None AzureBlobsStorageDriver.RESPONSES_PER_REQUEST = 2 container = Container(name='test_container', extra={}, driver=self.driver) objects = self.driver.list_container_objects(container=container, > ex_prefix='test_prefix') E TypeError: list_container_objects() got an unexpected keyword argument 'ex_prefix' libcloud/test/storage/test_azure_blobs.py:457: TypeError == 9079 tests deselected === === 1 failed, 36 passed, 9079 deselected in 3.39 seconds === [root@localhost libcloud]# python3 -m pytest -k azure_blobs
[jira] [Resolved] (LIBCLOUD-961) GCE public projects list out of date
[ https://issues.apache.org/jira/browse/LIBCLOUD-961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Marlow resolved LIBCLOUD-961. -- Resolution: Fixed Fixed by https://github.com/apache/libcloud/pull/1143. > GCE public projects list out of date > > > Key: LIBCLOUD-961 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-961 > Project: Libcloud > Issue Type: Bug >Reporter: Sean Marlow >Priority: Minor > > https://github.com/apache/libcloud/blob/trunk/libcloud/compute/drivers/gce.py#L1734 > Not available anymore according to GCE projects list: gce-nvme, > google-containers > Missing cos-cloud, suse-sap-cloud, suse-byos-cloud and windows-sql-cloud. > List found at https://cloud.google.com/compute/docs/images#os-compute-support -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LIBCLOUD-989) Small bug in common/openstack.py
[ https://issues.apache.org/jira/browse/LIBCLOUD-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16408291#comment-16408291 ] Quentin Pradet commented on LIBCLOUD-989: - The first thing to do would be to run the tests locally: * git clone https://github.com/apache/libcloud.git * cd libcloud * pip install -r requirements-test.txt * cp libcloud/test/secrets.py-dist libcloud/test/secrets.py * pytest When you'll be working on the OpenStack tests, running `pytest -k openstack` will be faster. The next step is to understand how the test fixtures work. Here's an example for another driver: https://github.com/apache/libcloud/pull/1157#issuecomment-355883772 Next we'll need to write a test that fails without your changes, and succeeds with your changes. Try to come up with a way to do this by looking at the existing steps maybe? If you're stuck, make sure to ask questions! Thanks > Small bug in common/openstack.py > > > Key: LIBCLOUD-989 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-989 > Project: Libcloud > Issue Type: Bug > Components: Core > Environment: Python 2.7 > libcloud 2.3.0 >Reporter: Vincent Planchenault >Priority: Minor > > Hello, > I encountered a small bug in common/openstack.py, when an Openstack > compatible french Cloud Provider wanted to tell me I've used its API at a too > high rate. > In this case, the API returned a status 503, with a message composed of > fields 'message' and 'request', without 'code' field > The code in line 393 in common/openstack.py raises in this case a TypeError > exception, because there is no 'code' field in the values. > I changed this line from: > if len(values) > 0 and values[0]['code'] == 404 and key_pair_name: > to: > if len(values) > 0 and 'code' in values[0] and values[0]['code'] == 404 > and key_pair_name: > Now, it raises a libcloud.exception_from_message I can handle properly. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LIBCLOUD-961) GCE public projects list out of date
[ https://issues.apache.org/jira/browse/LIBCLOUD-961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16408284#comment-16408284 ] ASF subversion and git services commented on LIBCLOUD-961: -- Commit 924f12c232e586c677a2380250a8e5c31605b8d3 in libcloud's branch refs/heads/trunk from [~smarlow] [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=924f12c ] [LIBCLOUD-961] Update GCE public image list. Add missing projects and update the image families for each project based on `gcloud compute images list` info. > GCE public projects list out of date > > > Key: LIBCLOUD-961 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-961 > Project: Libcloud > Issue Type: Bug >Reporter: Sean Marlow >Priority: Minor > > https://github.com/apache/libcloud/blob/trunk/libcloud/compute/drivers/gce.py#L1734 > Not available anymore according to GCE projects list: gce-nvme, > google-containers > Missing cos-cloud, suse-sap-cloud, suse-byos-cloud and windows-sql-cloud. > List found at https://cloud.google.com/compute/docs/images#os-compute-support -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LIBCLOUD-961) GCE public projects list out of date
[ https://issues.apache.org/jira/browse/LIBCLOUD-961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16408285#comment-16408285 ] ASF GitHub Bot commented on LIBCLOUD-961: - Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1143 > GCE public projects list out of date > > > Key: LIBCLOUD-961 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-961 > Project: Libcloud > Issue Type: Bug >Reporter: Sean Marlow >Priority: Minor > > https://github.com/apache/libcloud/blob/trunk/libcloud/compute/drivers/gce.py#L1734 > Not available anymore according to GCE projects list: gce-nvme, > google-containers > Missing cos-cloud, suse-sap-cloud, suse-byos-cloud and windows-sql-cloud. > List found at https://cloud.google.com/compute/docs/images#os-compute-support -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[2/2] libcloud git commit: Add changes for #1143
Add changes for #1143 Closes #1143 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f8634a8c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f8634a8c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f8634a8c Branch: refs/heads/trunk Commit: f8634a8cda418ca0f87a386c8ef6f440a29039d7 Parents: 924f12c Author: Quentin PradetAuthored: Wed Mar 21 21:18:21 2018 +0400 Committer: Quentin Pradet Committed: Wed Mar 21 21:19:20 2018 +0400 -- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8634a8c/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index f7db885..5193ba4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -36,6 +36,9 @@ Compute (LIBCLOUD-973, GITHUB-1162) [Rahul Paigavan] +- [GCE] Update public image projects list (LIBCLOUD-961, GITHUB-1143) + [Sean Marlow] + - [OpenStack] Implement Glance Image API v2 (GITHUB-1151) [Rick van de Loo]
[GitHub] libcloud pull request #1143: [LIBCLOUD-961] Update GCE public image projects...
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1143 ---
[1/2] libcloud git commit: [LIBCLOUD-961] Update GCE public image list.
Repository: libcloud Updated Branches: refs/heads/trunk a297b3cc8 -> f8634a8cd [LIBCLOUD-961] Update GCE public image list. Add missing projects and update the image families for each project based on `gcloud compute images list` info. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/924f12c2 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/924f12c2 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/924f12c2 Branch: refs/heads/trunk Commit: 924f12c232e586c677a2380250a8e5c31605b8d3 Parents: a297b3c Author: Sean MarlowAuthored: Mon Nov 13 11:54:21 2017 -0700 Committer: Quentin Pradet Committed: Wed Mar 21 21:17:29 2018 +0400 -- libcloud/compute/drivers/gce.py | 42 +- .../gce/global_images_family_notfound.json | 4 +- ...oreos-cloud_global_images_family_coreos.json | 17 - ...-cloud_global_images_family_coreos_beta.json | 17 + ...loud_global_images_family_coreos_stable.json | 26 + .../gce/projects_cos-cloud_global_images.json | 90 +++ .../gce/projects_gce-nvme_global_images.json| 55 -- ...rojects_google-containers_global_images.json | 179 -- .../projects_suse-byos-cloud_global_images.json | 150 + .../projects_suse-sap-cloud_global_images.json | 48 ++ ...rojects_windows-sql-cloud_global_images.json | 600 +++ libcloud/test/compute/test_gce.py | 68 ++- 12 files changed, 1009 insertions(+), 287 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/924f12c2/libcloud/compute/drivers/gce.py -- diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py index 0594587..311997f 100644 --- a/libcloud/compute/drivers/gce.py +++ b/libcloud/compute/drivers/gce.py @@ -1759,16 +1759,38 @@ class GCENodeDriver(NodeDriver): } IMAGE_PROJECTS = { -"centos-cloud": ["centos"], -"coreos-cloud": ["coreos"], -"debian-cloud": ["debian", "backports"], -"gce-nvme": ["nvme-backports"], -"google-containers": ["container-vm"], -"opensuse-cloud": ["opensuse"], -"rhel-cloud": ["rhel"], -"suse-cloud": ["sles", "suse"], -"ubuntu-os-cloud": ["ubuntu"], -"windows-cloud": ["windows"], +"centos-cloud": ["centos-6", "centos-7"], +"cos-cloud": ["cos-beta", "cos-dev", "cos-stable"], +"coreos-cloud": ["coreos-alpha", "coreos-beta", "coreos-stable"], +"debian-cloud": ["debian-8", "debian-9"], +"opensuse-cloud": ["opensuse-leap"], +"rhel-cloud": ["rhel-6", "rhel-7"], +"suse-cloud": ["sles-11", "sles-12"], +"suse-byos-cloud": [ +"sles-11-byos", "sles-12-byos", +"sles-12-sp2-sap-byos", "sles-12-sp3-sap-byos", +"suse-manager-proxy-byos", "suse-manager-server-byos" +], +"suse-sap-cloud": ["sles-12-sp2-sap", "sles-12-sp3-sap"], +"ubuntu-os-cloud": [ +"ubuntu-1404-lts", "ubuntu-1604-lts", "ubuntu-1710" +], +"windows-cloud": [ +"windows-1709-core-for-containers", "windows-1709-core", +"windows-2008-r2", "windows-2012-r2-core", "windows-2012-r2", +"windows-2016-core", "windows-2016" +], +"windows-sql-cloud": [ +"sql-ent-2012-win-2012-r2", "sql-std-2012-win-2012-r2", +"sql-web-2012-win-2012-r2", "sql-ent-2014-win-2012-r2", +"sql-ent-2014-win-2016", "sql-std-2014-win-2012-r2", +"sql-web-2014-win-2012-r2", "sql-ent-2016-win-2012-r2", +"sql-ent-2016-win-2016", "sql-std-2016-win-2012-r2", +"sql-std-2016-win-2016", "sql-web-2016-win-2012-r2", +"sql-web-2016-win-2016", "sql-ent-2017-win-2016", +"sql-exp-2017-win-2012-r2", "sql-exp-2017-win-2016", +"sql-std-2017-win-2016", "sql-web-2017-win-2016" +], } BACKEND_SERVICE_PROTOCOLS = ['HTTP', 'HTTPS', 'HTTP2', 'TCP', 'SSL'] http://git-wip-us.apache.org/repos/asf/libcloud/blob/924f12c2/libcloud/test/compute/fixtures/gce/global_images_family_notfound.json -- diff --git a/libcloud/test/compute/fixtures/gce/global_images_family_notfound.json b/libcloud/test/compute/fixtures/gce/global_images_family_notfound.json index 5d59882..0309a63 100644 --- a/libcloud/test/compute/fixtures/gce/global_images_family_notfound.json +++ b/libcloud/test/compute/fixtures/gce/global_images_family_notfound.json @@ -4,10 +4,10 @@ "errors": [ { "domain": "global", -"message": "The resource 'projects/project-name/global/images/family/coreos' was not found", +
[GitHub] libcloud pull request #1190: fix unexpected body type openstack image sharin...
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1190 ---
[1/2] libcloud git commit: fix unexpected body type openstack image sharing
Repository: libcloud Updated Branches: refs/heads/trunk f07c6dd45 -> a297b3cc8 fix unexpected body type openstack image sharing Looks like I introduced a bug here [in this PR](https://github.com/apache/libcloud/pull/1176) before: ``` In [3]: conn.ex_create_image_member('a4f9cd7a-188a-444c-90a6-d24b8c688a63', '1d14ce09c41e4b53a3be31ff980d47e3') ... [u'Unexpected body type. Expected list/dict.\n\n\n', u'400 Bad Request', u'Bad Request'] ``` after: ``` In [3]: conn.ex_create_image_member('a4f9cd7a-188a-444c-90a6-d24b8c688a63', '1d14ce09c41e4b53a3be31ff980d47e3') Out[3]: ``` Signed-off-by: Quentin PradetProject: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2d0f446c Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2d0f446c Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2d0f446c Branch: refs/heads/trunk Commit: 2d0f446c05147d998a361a92e90ebb1c58d53377 Parents: f07c6dd Author: Rick van de Loo Authored: Mon Mar 19 14:09:52 2018 +0100 Committer: Quentin Pradet Committed: Wed Mar 21 21:08:36 2018 +0400 -- libcloud/compute/drivers/openstack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/2d0f446c/libcloud/compute/drivers/openstack.py -- diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py index 91eb1a4..ea38fad 100644 --- a/libcloud/compute/drivers/openstack.py +++ b/libcloud/compute/drivers/openstack.py @@ -2599,7 +2599,7 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver): headers={'Content-type': 'application/' 'openstack-images-' 'v2.1-json-patch'}, -method='PATCH', data=json.dumps(data) +method='PATCH', data=data ) return self._to_image(response.object) @@ -2652,7 +2652,7 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver): data = {'member': member_id} response = self.image_connection.request( '/v2/images/%s/members' % image_id, -method='POST', data=json.dumps(data) +method='POST', data=data ) return self._to_image_member(response.object) @@ -2692,7 +2692,7 @@ class OpenStack_2_NodeDriver(OpenStack_1_1_NodeDriver): data = {'status': 'accepted'} response = self.image_connection.request( '/v2/images/%s/members/%s' % (image_id, member_id), -method='PUT', data=json.dumps(data) +method='PUT', data=data ) return self._to_image_member(response.object)
[2/2] libcloud git commit: Add changes for #1190
Add changes for #1190 Closes #1190 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a297b3cc Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a297b3cc Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a297b3cc Branch: refs/heads/trunk Commit: a297b3cc83026557f8c3c34c7bd4b5541affae15 Parents: 2d0f446 Author: Quentin PradetAuthored: Wed Mar 21 21:10:34 2018 +0400 Committer: Quentin Pradet Committed: Wed Mar 21 21:10:34 2018 +0400 -- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/a297b3cc/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index e3ba9d4..f7db885 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -45,6 +45,9 @@ Compute - [OpenStack v2] Allow creating and accepting image members (GITHUB-1176) [Rick van de Loo] +- [OpenStack v2] Fix image members methods (GITHUB-1190) + [Rick van de Loo] + Changes in Apache Libcloud 2.3.0
[jira] [Comment Edited] (LIBCLOUD-989) Small bug in common/openstack.py
[ https://issues.apache.org/jira/browse/LIBCLOUD-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16407773#comment-16407773 ] Vincent Planchenault edited comment on LIBCLOUD-989 at 3/21/18 11:27 AM: - [~quentinp] Why not, but I have no idea of what/how to do... I already have a patch file for libcloud-2.2.1 and libcloud-2.3.0, but for my short-term need I've chosen to "Monkey patch" libcloud from my code (I don't want to force user of my code to patch libcloud). was (Author: ctacat): [~quentinp] Why not, but I have no idea of what/how to do... I already have a patch file for libcloud-2.2.1 and libcloud-2.3.0, but for my short-term need I've chosen to "Monkey patch" libcloud from my code, the idea being not to fork libcloud in any way. > Small bug in common/openstack.py > > > Key: LIBCLOUD-989 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-989 > Project: Libcloud > Issue Type: Bug > Components: Core > Environment: Python 2.7 > libcloud 2.3.0 >Reporter: Vincent Planchenault >Priority: Minor > > Hello, > I encountered a small bug in common/openstack.py, when an Openstack > compatible french Cloud Provider wanted to tell me I've used its API at a too > high rate. > In this case, the API returned a status 503, with a message composed of > fields 'message' and 'request', without 'code' field > The code in line 393 in common/openstack.py raises in this case a TypeError > exception, because there is no 'code' field in the values. > I changed this line from: > if len(values) > 0 and values[0]['code'] == 404 and key_pair_name: > to: > if len(values) > 0 and 'code' in values[0] and values[0]['code'] == 404 > and key_pair_name: > Now, it raises a libcloud.exception_from_message I can handle properly. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LIBCLOUD-989) Small bug in common/openstack.py
[ https://issues.apache.org/jira/browse/LIBCLOUD-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16407773#comment-16407773 ] Vincent Planchenault commented on LIBCLOUD-989: --- [~quentinp] Why not, but I have no idea of what/how to do... I already have a patch file for libcloud-2.2.1 and libcloud-2.3.0, but for my short-term need I've chosen to "Monkey patch" libcloud from my code, the idea being not to fork libcloud in any way. > Small bug in common/openstack.py > > > Key: LIBCLOUD-989 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-989 > Project: Libcloud > Issue Type: Bug > Components: Core > Environment: Python 2.7 > libcloud 2.3.0 >Reporter: Vincent Planchenault >Priority: Minor > > Hello, > I encountered a small bug in common/openstack.py, when an Openstack > compatible french Cloud Provider wanted to tell me I've used its API at a too > high rate. > In this case, the API returned a status 503, with a message composed of > fields 'message' and 'request', without 'code' field > The code in line 393 in common/openstack.py raises in this case a TypeError > exception, because there is no 'code' field in the values. > I changed this line from: > if len(values) > 0 and values[0]['code'] == 404 and key_pair_name: > to: > if len(values) > 0 and 'code' in values[0] and values[0]['code'] == 404 > and key_pair_name: > Now, it raises a libcloud.exception_from_message I can handle properly. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (LIBCLOUD-989) Small bug in common/openstack.py
[ https://issues.apache.org/jira/browse/LIBCLOUD-989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16407552#comment-16407552 ] Quentin Pradet commented on LIBCLOUD-989: - Thanks for the report! Would you like to work on getting this integrated into libcloud? > Small bug in common/openstack.py > > > Key: LIBCLOUD-989 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-989 > Project: Libcloud > Issue Type: Bug > Components: Core > Environment: Python 2.7 > libcloud 2.3.0 >Reporter: Vincent Planchenault >Priority: Minor > > Hello, > I encountered a small bug in common/openstack.py, when an Openstack > compatible french Cloud Provider wanted to tell me I've used its API at a too > high rate. > In this case, the API returned a status 503, with a message composed of > fields 'message' and 'request', without 'code' field > The code in line 393 in common/openstack.py raises in this case a TypeError > exception, because there is no 'code' field in the values. > I changed this line from: > if len(values) > 0 and values[0]['code'] == 404 and key_pair_name: > to: > if len(values) > 0 and 'code' in values[0] and values[0]['code'] == 404 > and key_pair_name: > Now, it raises a libcloud.exception_from_message I can handle properly. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[2/2] libcloud git commit: Add changes for #1191
Add changes for #1191 Closes #1191 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f07c6dd4 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f07c6dd4 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f07c6dd4 Branch: refs/heads/trunk Commit: f07c6dd45cbfcad542c9c2f65c1d18a3901d5ed3 Parents: f8fbd1d Author: Quentin PradetAuthored: Wed Mar 21 11:12:31 2018 +0400 Committer: Quentin Pradet Committed: Wed Mar 21 11:12:31 2018 +0400 -- CHANGES.rst | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f07c6dd4/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index c7e351a..e3ba9d4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,9 @@ Compute - [Digital Ocean] Support floating IPs (GITHUB-1177) [Rick van de Loo] +- [Digital Ocean] Support attach/detach for floating IPs (GITHUB-1191) + [Rick van de Loo] + - [Dimension Data] Fix IndexError in list_images (GITHUB-1171) [Adam Friedman]
[1/2] libcloud git commit: implement attach/detach floating IPs for DO
Repository: libcloud Updated Branches: refs/heads/trunk 6a8933fca -> f07c6dd45 implement attach/detach floating IPs for DO add methods to the DigitalOcean_v2_NodeDriver to attach and detach floating IPs from instances uniform to the `ex_attach_floating_ip_to_node` and `ex_detach_floating_ip_from_node` methods from the [OpenStack_1_1_NodeDriver](https://github.com/apache/libcloud/blob/2b298b7cd8d17b4b1c0db20292fdb7867a512ac6/libcloud/compute/drivers/openstack.py#L2394) see https://developers.digitalocean.com/documentation/v2/#assign-a-floating-ip-to-a-droplet and https://developers.digitalocean.com/documentation/v2/#unassign-a-floating-ip Signed-off-by: Quentin PradetProject: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f8fbd1dd Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f8fbd1dd Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f8fbd1dd Branch: refs/heads/trunk Commit: f8fbd1dd050a5a8d8c7af983d1f09087873d7d21 Parents: 6a8933f Author: Rick van de Loo Authored: Mon Mar 19 15:32:44 2018 +0100 Committer: Quentin Pradet Committed: Wed Mar 21 11:11:30 2018 +0400 -- libcloud/compute/drivers/digitalocean.py| 48 .../digitalocean_v2/attach_floating_ip.json | 1 + .../digitalocean_v2/detach_floating_ip.json | 1 + libcloud/test/compute/test_digitalocean_v2.py | 30 4 files changed, 80 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8fbd1dd/libcloud/compute/drivers/digitalocean.py -- diff --git a/libcloud/compute/drivers/digitalocean.py b/libcloud/compute/drivers/digitalocean.py index fbb8397..12e4a60 100644 --- a/libcloud/compute/drivers/digitalocean.py +++ b/libcloud/compute/drivers/digitalocean.py @@ -549,6 +549,54 @@ class DigitalOcean_v2_NodeDriver(DigitalOcean_v2_BaseDriver, raise ValueError('Floating ip %s not found' % ip) return matching_ips[0] +def ex_attach_floating_ip_to_node(self, node, ip): +""" +Attach the floating IP to the node + +:param node: node +:type node: :class:`Node` + +:param ip: floating IP to attach +:type ip: ``str`` or :class:`DigitalOcean_v2_FloatingIpAddress` + +:rtype: ``bool`` +""" +data = { +'type': 'assign', +'droplet_id': node.id +} +resp = self.connection.request( +'/v2/floating_ips/%s/actions' % ip.ip_address, +data=json.dumps(data), method='POST' +) +return resp.status == httplib.CREATED + +def ex_detach_floating_ip_from_node(self, node, ip): +""" +Detach a floating IP from the given node + +Note: the 'node' object is not used in this method but it is added +to the signature of ex_detach_floating_ip_from_node anyway so it +conforms to the interface of the method of the same name for other +drivers like for example OpenStack. + +:param node: Node from which the IP should be detached +:type node: :class:`Node` + +:param ip: Floating IP to detach +:type ip: :class:`DigitalOcean_v2_FloatingIpAddress` + +:rtype: ``bool`` +""" +data = { +'type': 'unassign' +} +resp = self.connection.request( +'/v2/floating_ips/%s/actions' % ip.ip_address, +data=json.dumps(data), method='POST' +) +return resp.status == httplib.CREATED + def _to_node(self, data): extra_keys = ['memory', 'vcpus', 'disk', 'region', 'image', 'size_slug', 'locked', 'created_at', 'networks', http://git-wip-us.apache.org/repos/asf/libcloud/blob/f8fbd1dd/libcloud/test/compute/fixtures/digitalocean_v2/attach_floating_ip.json -- diff --git a/libcloud/test/compute/fixtures/digitalocean_v2/attach_floating_ip.json b/libcloud/test/compute/fixtures/digitalocean_v2/attach_floating_ip.json new file mode 100644 index 000..c5773f0 --- /dev/null +++ b/libcloud/test/compute/fixtures/digitalocean_v2/attach_floating_ip.json @@ -0,0 +1 @@ +{"action":{"id":397123123,"status":"in-progress","type":"assign_ip","started_at":"2018-03-19T14:16:04Z","completed_at":null,"resource_id":1812306133,"resource_type":"floating_ip","region":{"name":"Amsterdam
[GitHub] libcloud pull request #1191: implement attach/detach floating IPs for DO
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/1191 ---
[jira] [Commented] (LIBCLOUD-986) List / Iterate container with prefix for Azure Blob service (This support exists in the other drivers already)
[ https://issues.apache.org/jira/browse/LIBCLOUD-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16407536#comment-16407536 ] Quentin Pradet commented on LIBCLOUD-986: - The first thing to do would be to run the tests locally: * git clone https://github.com/apache/libcloud.git * cd libcloud * pip install -r requirements-test.txt * cp libcloud/test/secrets.py-dist libcloud/test/secrets.py * pytest When you'll be working on the Azure Blobs tests, running `pytest -k azure_blobs` will be faster. The next step is to understand how the test fixtures work. Here's an example for another driver: https://github.com/apache/libcloud/pull/1157#issuecomment-355883772 Next we'll need to write a test that fails without your changes, and succeeds with your changes. Try to come up with a way to do this. If you're stuck, make sure to ask questions! > List / Iterate container with prefix for Azure Blob service (This support > exists in the other drivers already) > -- > > Key: LIBCLOUD-986 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-986 > Project: Libcloud > Issue Type: Improvement > Components: Storage >Reporter: Joshua Hawkinson >Priority: Major > > While testing out the libcloud storage abstraction I've come across a curious > omission in driver support. It seems that for many drivers there is > additional support for the {{list_container_objects()}} and > {{iterate_container_objects()}} to support a prefix (or {{ex_prefix)}}. > This functionality is not present in the Azure driver for some reason. I've > gone and checked the list_blobs API and it also supports this functionality > as seen here: > [https://docs.microsoft.com/en-us/rest/api/storageservices/list-blobs] > > I've attempted a quick and dirty patch that seems to work as well. > {code} > azure_blobs.py Line 384 > -def iterate_container_objects(self, container): > +def iterate_container_objects(self, container, ex_prefix=None): > """ > @inherits: :class:`StorageDriver.iterate_container_objects` > """ > params = {'restype': 'container', > 'comp': 'list', > + 'prefix': ex_prefix, > 'maxresults': RESPONSES_PER_REQUEST, > 'include': 'metadata'} > Line 419 (Add new function) > def list_container_objects(self, container, ex_prefix=None): > """ > Return a list of objects for the given container. > > :param container: Container instance. > :type container: :class:`Container` > > :param ex_prefix: Only return objects starting with ex_prefix > :type ex_prefix: ``str`` > > :return: A list of Object instances. > :rtype: ``list`` of :class:`Object` > """ > return list(self.iterate_container_objects(container, >ex_prefix=ex_prefix)) > > {code} > > I've just worked around this at a higher level for now. There isn't any > urgency on my end, but it would be nice if the abstraction was more > consistent so I could remove the workaround code. -- This message was sent by Atlassian JIRA (v7.6.3#76005)