You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/09/04 12:28:08 UTC

[01/14] git commit: Fix a regression introduced in 0.13.0 and make sure to include Content-Length 0 with PUT and POST requests. Also add test cases for it.

Updated Branches:
  refs/heads/0.13.1 [created] 7e18941c4


Fix a regression introduced in 0.13.0 and make sure to include
Content-Length 0 with PUT and POST requests. Also add test cases for it.

Part of LIBCLOUD-362.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a73cc099
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a73cc099
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a73cc099

Branch: refs/heads/0.13.1
Commit: a73cc099b5c6f04eeaef10a6de7147daf9f98cc7
Parents: 9c0d11a
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Aug 8 14:39:13 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 11:57:54 2013 +0200

----------------------------------------------------------------------
 CHANGES                          |  8 ++++
 libcloud/common/base.py          |  6 ++-
 libcloud/test/test_connection.py | 88 +++++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a73cc099/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 640bd2f..1206d98 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,13 @@
                                    -*- coding: utf-8 -*-
 
+Changes with Apache Libcloud in development
+
+ *) General
+
+    - Fix a regression introduced in 0.13.0 and make sure to include
+      Content-Length 0 with PUT and POST requests. (LIBCLOUD-362)
+      [Tomaz Muraus]
+
 Changes with Apache Libcloud 0.13.0:
 
  *) General

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a73cc099/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 464bec8..0634588 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -592,9 +592,11 @@ class Connection(object):
             headers.update({'Host': self.host})
 
         # Encode data if necessary
-        if data:
+        if data is not None:
             data = self.encode_data(data)
-            headers.update({'Content-Length': str(len(data))})
+            # Only send Content-Length 0 with POST and PUT request
+            if len(data) > 0 or (len(data) == 0 and method in ['POST', 'PUT']):
+                headers.update({'Content-Length': str(len(data))})
 
         params, headers = self.pre_connect_hook(params, headers)
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a73cc099/libcloud/test/test_connection.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_connection.py b/libcloud/test/test_connection.py
new file mode 100644
index 0000000..938e170
--- /dev/null
+++ b/libcloud/test/test_connection.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+# Licensed to the Apache Software Foundation (ASF) under one or moreĀ§
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import sys
+import unittest
+
+from mock import Mock
+
+from libcloud.common.base import Connection
+
+
+class ConnectionClassTestCase(unittest.TestCase):
+    def setUp(self):
+        self.originalConnect = Connection.connect
+        self.originalResponseCls = Connection.responseCls
+
+        Connection.connect = Mock()
+        Connection.responseCls = Mock()
+
+    def tearDown(self):
+        Connection.connect = self.originalConnect
+        Connection.responseCls = Connection.responseCls
+
+    def test_content_length(self):
+        con = Connection()
+        con.connection = Mock()
+
+        ## GET method
+        # No data, no content length should be present
+        con.request('/test', method='GET', data=None)
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertTrue('Content-Length' not in call_kwargs['headers'])
+
+        # '' as data, no content length should be present
+        con.request('/test', method='GET', data='')
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertTrue('Content-Length' not in call_kwargs['headers'])
+
+        # 'a' as data, content length should be present (data is GET is not
+        # corect, but anyways)
+        con.request('/test', method='GET', data='a')
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
+
+        ## POST, PUT method
+        # No data, no content length should be present
+        con.request('/test', method='POST', data=None)
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertTrue('Content-Length' not in call_kwargs['headers'])
+
+        con.request('/test', method='PUT', data=None)
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertTrue('Content-Length' not in call_kwargs['headers'])
+
+        # '' as data, content length should be present
+        con.request('/test', method='POST', data='')
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
+
+        con.request('/test', method='PUT', data='')
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
+
+        # 'a' as data, content length should be present
+        con.request('/test', method='POST', data='a')
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
+
+        con.request('/test', method='PUT', data='a')
+        call_kwargs = con.connection.request.call_args[1]
+        self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
+
+
+if __name__ == '__main__':
+    sys.exit(unittest.main())


[03/14] git commit: Only send Content-Length: 0 even if "data" is None.

Posted by to...@apache.org.
Only send Content-Length: 0 even if "data" is None.

Fixes LIBCLOUD-390.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c10249d1
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c10249d1
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c10249d1

Branch: refs/heads/0.13.1
Commit: c10249d1d733ba5215820c5d935265de5ae6bc84
Parents: 9e94e39
Author: Tomaz Muraus <to...@apache.org>
Authored: Wed Sep 4 10:58:44 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 11:58:41 2013 +0200

----------------------------------------------------------------------
 CHANGES                          |  2 +-
 libcloud/common/base.py          | 10 ++++++----
 libcloud/test/test_connection.py | 37 +++++++++++++----------------------
 3 files changed, 21 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c10249d1/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 1206d98..3727eb9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,7 +5,7 @@ Changes with Apache Libcloud in development
  *) General
 
     - Fix a regression introduced in 0.13.0 and make sure to include
-      Content-Length 0 with PUT and POST requests. (LIBCLOUD-362)
+      Content-Length 0 with PUT and POST requests. (LIBCLOUD-362, LIBCLOUD-390)
       [Tomaz Muraus]
 
 Changes with Apache Libcloud 0.13.0:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c10249d1/libcloud/common/base.py
----------------------------------------------------------------------
diff --git a/libcloud/common/base.py b/libcloud/common/base.py
index 0634588..4ffdbd5 100644
--- a/libcloud/common/base.py
+++ b/libcloud/common/base.py
@@ -591,12 +591,14 @@ class Connection(object):
         else:
             headers.update({'Host': self.host})
 
-        # Encode data if necessary
-        if data is not None:
+        if data:
+            # Encode data if provided
             data = self.encode_data(data)
+            headers.update({'Content-Length': str(len(data))})
+        else:
             # Only send Content-Length 0 with POST and PUT request
-            if len(data) > 0 or (len(data) == 0 and method in ['POST', 'PUT']):
-                headers.update({'Content-Length': str(len(data))})
+            if method.upper() in ['POST', 'PUT']:
+                headers.update({'Content-Length': '0'})
 
         params, headers = self.pre_connect_hook(params, headers)
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c10249d1/libcloud/test/test_connection.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_connection.py b/libcloud/test/test_connection.py
index 938e170..798f7ec 100644
--- a/libcloud/test/test_connection.py
+++ b/libcloud/test/test_connection.py
@@ -49,39 +49,30 @@ class ConnectionClassTestCase(unittest.TestCase):
         call_kwargs = con.connection.request.call_args[1]
         self.assertTrue('Content-Length' not in call_kwargs['headers'])
 
-        # 'a' as data, content length should be present (data is GET is not
+        # 'a' as data, content length should be present (data in GET is not
         # corect, but anyways)
         con.request('/test', method='GET', data='a')
         call_kwargs = con.connection.request.call_args[1]
         self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
 
         ## POST, PUT method
-        # No data, no content length should be present
-        con.request('/test', method='POST', data=None)
-        call_kwargs = con.connection.request.call_args[1]
-        self.assertTrue('Content-Length' not in call_kwargs['headers'])
-
-        con.request('/test', method='PUT', data=None)
-        call_kwargs = con.connection.request.call_args[1]
-        self.assertTrue('Content-Length' not in call_kwargs['headers'])
+        # No data, content length should be present
+        for method in ['POST', 'PUT', 'post', 'put']:
+            con.request('/test', method=method, data=None)
+            call_kwargs = con.connection.request.call_args[1]
+            self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
 
         # '' as data, content length should be present
-        con.request('/test', method='POST', data='')
-        call_kwargs = con.connection.request.call_args[1]
-        self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
-
-        con.request('/test', method='PUT', data='')
-        call_kwargs = con.connection.request.call_args[1]
-        self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
+        for method in ['POST', 'PUT', 'post', 'put']:
+            con.request('/test', method=method, data='')
+            call_kwargs = con.connection.request.call_args[1]
+            self.assertEqual(call_kwargs['headers']['Content-Length'], '0')
 
         # 'a' as data, content length should be present
-        con.request('/test', method='POST', data='a')
-        call_kwargs = con.connection.request.call_args[1]
-        self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
-
-        con.request('/test', method='PUT', data='a')
-        call_kwargs = con.connection.request.call_args[1]
-        self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
+        for method in ['POST', 'PUT', 'post', 'put']:
+            con.request('/test', method=method, data='a')
+            call_kwargs = con.connection.request.call_args[1]
+            self.assertEqual(call_kwargs['headers']['Content-Length'], '1')
 
 
 if __name__ == '__main__':


[10/14] git commit: LIBCLOUD-378: S3 uploads fail on small iterators

Posted by to...@apache.org.
LIBCLOUD-378: S3 uploads fail on small iterators


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/db4cfbdc
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/db4cfbdc
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/db4cfbdc

Branch: refs/heads/0.13.1
Commit: db4cfbdccd1358450ce513d64eb872c637b273e5
Parents: a8055c1
Author: Mahendra M <ma...@apache.org>
Authored: Tue Sep 3 16:50:37 2013 +0530
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:05:28 2013 +0200

----------------------------------------------------------------------
 CHANGES                        | 4 ++++
 libcloud/storage/drivers/s3.py | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/db4cfbdc/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 08db5b6..663fa23 100644
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,10 @@ Changes with Apache Libcloud in development
       Reported by Ben Meng (LIBCLOUD-366)
       [Tomaz Muraus]
 
+    - Ensure that AWS S3 multipart upload works for small iterators.
+      (LIBCLOUD-378)
+      [Mahendra M]
+
 Changes with Apache Libcloud 0.13.0:
 
  *) General

http://git-wip-us.apache.org/repos/asf/libcloud/blob/db4cfbdc/libcloud/storage/drivers/s3.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index 38bd723..5b20035 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -491,7 +491,8 @@ class S3StorageDriver(StorageDriver):
         params = {'uploadId': upload_id}
 
         # Read the input data in chunk sizes suitable for AWS
-        for data in read_in_chunks(iterator, chunk_size=CHUNK_SIZE):
+        for data in read_in_chunks(iterator, chunk_size=CHUNK_SIZE,
+                                   fill_size=True):
             bytes_transferred += len(data)
 
             if calculate_hash:


[14/14] git commit: Fix test failure in Python 3.3 This test relied on the querystring ordering and didn't always fail. *sigh*

Posted by to...@apache.org.
Fix test failure in Python 3.3 This test relied on the querystring ordering
and didn't always fail. *sigh*


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7e18941c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7e18941c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7e18941c

Branch: refs/heads/0.13.1
Commit: 7e18941c441b718e38f1808ba86f51d483a99bf1
Parents: 5926d03
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Aug 8 14:49:09 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:16:01 2013 +0200

----------------------------------------------------------------------
 libcloud/test/compute/test_ec2.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7e18941c/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index d0e2c8a..e54f453 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -438,6 +438,8 @@ class EC2MockHttp(MockHttpTestCase):
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _create_ex_blockdevicemappings_RunInstances(self, method, url, body, headers):
+        # Need to remove '/?'
+        url = url[2:]
         parameters = dict(parse_qsl(url))
         self.assertEqual(parameters['BlockDeviceMapping.1.DeviceName'],
                          '/dev/sdb')


[11/14] git commit: Fix s3 multipart test cases broken by LIBCLOUD-378

Posted by to...@apache.org.
Fix s3 multipart test cases broken by LIBCLOUD-378

The breakage was caused by an overzealous check.
Also added test cases for checking small and big uploads via
S3 multipart upload API


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fedd709c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fedd709c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fedd709c

Branch: refs/heads/0.13.1
Commit: fedd709cac9e406871310d73ce2c54d5da3a9496
Parents: db4cfbd
Author: Mahendra <ma...@apache.org>
Authored: Tue Sep 3 20:40:54 2013 +0530
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:05:51 2013 +0200

----------------------------------------------------------------------
 libcloud/test/storage/test_s3.py | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/fedd709c/libcloud/test/storage/test_s3.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_s3.py b/libcloud/test/storage/test_s3.py
index 2287d5c..9f35169 100644
--- a/libcloud/test/storage/test_s3.py
+++ b/libcloud/test/storage/test_s3.py
@@ -34,6 +34,7 @@ from libcloud.storage.drivers.s3 import S3StorageDriver, S3USWestStorageDriver
 from libcloud.storage.drivers.s3 import S3EUWestStorageDriver
 from libcloud.storage.drivers.s3 import S3APSEStorageDriver
 from libcloud.storage.drivers.s3 import S3APNEStorageDriver
+from libcloud.storage.drivers.s3 import CHUNK_SIZE
 from libcloud.storage.drivers.dummy import DummyIterator
 
 from libcloud.test import StorageMockHttp, MockRawResponse # pylint: disable-msg=E0611
@@ -243,8 +244,6 @@ class S3MockHttp(StorageMockHttp, MockHttpTestCase):
                 self.assertEqual(part_no, str(count))
                 self.assertEqual(etag, headers['etag'])
 
-            self.assertEqual(count, 3)
-
             body = self.fixtures.load('complete_multipart.xml')
             return (httplib.OK,
                     body,
@@ -740,7 +739,7 @@ class S3Tests(unittest.TestCase):
         self.assertTrue('some-value' in obj.meta_data)
         self.driver_type._upload_file = old_func
 
-    def test_upload_object_via_stream(self):
+    def test_upload_small_object_via_stream(self):
 
         if self.driver.supports_s3_multipart_upload:
             self.mock_raw_response_klass.type = 'MULTIPART'
@@ -762,6 +761,28 @@ class S3Tests(unittest.TestCase):
         self.assertEqual(obj.name, object_name)
         self.assertEqual(obj.size, 3)
 
+    def test_upload_big_object_via_stream(self):
+
+        if self.driver.supports_s3_multipart_upload:
+            self.mock_raw_response_klass.type = 'MULTIPART'
+            self.mock_response_klass.type = 'MULTIPART'
+        else:
+            self.mock_raw_response_klass.type = None
+            self.mock_response_klass.type = None
+
+        container = Container(name='foo_bar_container', extra={},
+                              driver=self.driver)
+        object_name = 'foo_test_stream_data'
+        iterator = DummyIterator(data=['2'*CHUNK_SIZE, '3'*CHUNK_SIZE, '5'])
+        extra = {'content_type': 'text/plain'}
+        obj = self.driver.upload_object_via_stream(container=container,
+                                                   object_name=object_name,
+                                                   iterator=iterator,
+                                                   extra=extra)
+
+        self.assertEqual(obj.name, object_name)
+        self.assertEqual(obj.size, CHUNK_SIZE*2 + 1)
+
     def test_upload_object_via_stream_abort(self):
         if not self.driver.supports_s3_multipart_upload:
             return


[05/14] git commit: Update changes.

Posted by to...@apache.org.
Update changes.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fe474122
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fe474122
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fe474122

Branch: refs/heads/0.13.1
Commit: fe47412230703d4556746c623219d25c0296e917
Parents: 847fd4c
Author: Tomaz Muraus <to...@apache.org>
Authored: Wed Sep 4 12:00:16 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:00:16 2013 +0200

----------------------------------------------------------------------
 CHANGES | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/fe474122/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3727eb9..741a565 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,12 @@ Changes with Apache Libcloud in development
       Content-Length 0 with PUT and POST requests. (LIBCLOUD-362, LIBCLOUD-390)
       [Tomaz Muraus]
 
+ *) Compute
+
+    - Fix a bug in the ElasticHosts driver and check for right HTTP status
+      code when determining drive imaging success. (LIBCLOUD-363)
+      [Bob Thompson]
+
 Changes with Apache Libcloud 0.13.0:
 
  *) General


[09/14] git commit: Update changes.

Posted by to...@apache.org.
Update changes.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a8055c1d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a8055c1d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a8055c1d

Branch: refs/heads/0.13.1
Commit: a8055c1d8dc8b75a98e974e26ac65e628a845a8c
Parents: 4bada33
Author: Tomaz Muraus <to...@apache.org>
Authored: Wed Sep 4 12:04:24 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:04:24 2013 +0200

----------------------------------------------------------------------
 CHANGES | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a8055c1d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 70aaa13..08db5b6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,10 @@ Changes with Apache Libcloud in development
       code when determining drive imaging success. (LIBCLOUD-363)
       [Bob Thompson]
 
+    - Update Opsource driver to include node public ip address (if available).
+      (LIBCLOUD-384)
+      [Michael Bennett]
+
   *) Storage
 
     - Fix a regression with calling encode_container_name instead of


[12/14] git commit: Fix local storage test failurs under Python 3.2.

Posted by to...@apache.org.
Fix local storage test failurs under Python 3.2.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c96e7a93
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c96e7a93
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c96e7a93

Branch: refs/heads/0.13.1
Commit: c96e7a9388ed9ae34fab06b2d733718d36d54dd0
Parents: fedd709
Author: Tomaz Muraus <to...@apache.org>
Authored: Fri Aug 23 14:54:07 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:09:53 2013 +0200

----------------------------------------------------------------------
 libcloud/storage/drivers/local.py   | 3 ++-
 libcloud/test/storage/test_local.py | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c96e7a93/libcloud/storage/drivers/local.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/local.py b/libcloud/storage/drivers/local.py
index b341d99..77ddb23 100644
--- a/libcloud/storage/drivers/local.py
+++ b/libcloud/storage/drivers/local.py
@@ -32,6 +32,7 @@ except ImportError:
 
 from libcloud.utils.files import read_in_chunks
 from libcloud.utils.py3 import relpath
+from libcloud.utils.py3 import u
 from libcloud.common.base import Connection
 from libcloud.storage.base import Object, Container, StorageDriver
 from libcloud.common.types import LibcloudError
@@ -175,7 +176,7 @@ class LocalStorageDriver(StorageDriver):
         # use only the mtime attribute here. If the file contents change,
         # the underlying file-system will change mtime
         data_hash = self._get_hash_function()
-        data_hash.update(str(stat.st_mtime))
+        data_hash.update(u(stat.st_mtime).encode('ascii'))
         data_hash = data_hash.hexdigest()
 
         extra = {}

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c96e7a93/libcloud/test/storage/test_local.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_local.py b/libcloud/test/storage/test_local.py
index d88c4b7..bb70f38 100644
--- a/libcloud/test/storage/test_local.py
+++ b/libcloud/test/storage/test_local.py
@@ -310,7 +310,7 @@ class LocalTests(unittest.TestCase):
 
         data = ''
         for buff in stream:
-            data += buff
+            data += buff.decode('utf-8')
 
         self.assertTrue(len(data), 4096)
 


[13/14] git commit: Fix a nasty test case which was failing under 3.3.

Posted by to...@apache.org.
Fix a nasty test case which was failing under 3.3.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5926d03e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5926d03e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5926d03e

Branch: refs/heads/0.13.1
Commit: 5926d03e3c324696b761e180551bcf106e2a425d
Parents: c96e7a9
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Aug 8 15:13:34 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:12:18 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/vcloud.py   | 4 +---
 libcloud/test/compute/test_vcloud.py | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/5926d03e/libcloud/compute/drivers/vcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/vcloud.py b/libcloud/compute/drivers/vcloud.py
index e7d9a7e..b258618 100644
--- a/libcloud/compute/drivers/vcloud.py
+++ b/libcloud/compute/drivers/vcloud.py
@@ -31,7 +31,6 @@ urlparse = urlparse.urlparse
 import time
 
 from xml.etree import ElementTree as ET
-from xml.etree.ElementTree import _ElementInterface
 from xml.parsers.expat import ExpatError
 
 from libcloud.common.base import XmlResponse, ConnectionUserAndKey
@@ -588,8 +587,7 @@ class VCloudNodeDriver(NodeDriver):
                 except Exception:
                     # The vApp was probably removed since the previous vDC query, ignore
                     e = sys.exc_info()[1]
-                    if not (isinstance(e.args[0], _ElementInterface) and
-                            e.args[0].tag.endswith('Error') and
+                    if not (e.args[0].tag.endswith('Error') and
                             e.args[0].get('minorErrorCode') == 'ACCESS_TO_RESOURCE_IS_FORBIDDEN'):
                         raise
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/5926d03e/libcloud/test/compute/test_vcloud.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_vcloud.py b/libcloud/test/compute/test_vcloud.py
index 87324bd..aa9cf65 100644
--- a/libcloud/test/compute/test_vcloud.py
+++ b/libcloud/test/compute/test_vcloud.py
@@ -412,7 +412,7 @@ class AnotherErrorMember(Exception):
         self.tag = 'Error'
 
     def get(self, foo):
-        return 'ACCESS_TO_RESOURCE_IS_FORBIDDEN'
+        return 'ACCESS_TO_RESOURCE_IS_FORBIDDEN_1'
 
 class AnotherError(Exception):
     pass


[04/14] git commit: Issue LIBCLOUD-363: Fix ElasticHosts bug. Now checks for HTTP 204 and HTTP 200 to determine drive imaging status.

Posted by to...@apache.org.
Issue LIBCLOUD-363: Fix ElasticHosts bug. Now checks for HTTP 204 and HTTP 200 to determine drive imaging status.

Signed-off-by: Tomaz Muraus <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/847fd4ce
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/847fd4ce
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/847fd4ce

Branch: refs/heads/0.13.1
Commit: 847fd4cecd44f659debdb10a5f5643247e70bfb9
Parents: c10249d
Author: Bob Thompson <bo...@gmail.com>
Authored: Tue Jul 16 14:31:17 2013 -0400
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:00:00 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/elasticstack.py   | 2 +-
 libcloud/test/compute/test_elasticstack.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/847fd4ce/libcloud/compute/drivers/elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/elasticstack.py b/libcloud/compute/drivers/elasticstack.py
index 7058dbd..e70a04f 100644
--- a/libcloud/compute/drivers/elasticstack.py
+++ b/libcloud/compute/drivers/elasticstack.py
@@ -276,7 +276,7 @@ class ElasticStackBaseNodeDriver(NodeDriver):
             method='POST'
         )
 
-        if response.status != 204:
+        if response.status not in (200, 204):
             raise ElasticStackException('Drive imaging failed')
 
         # We wait until the drive is imaged and then boot up the node

http://git-wip-us.apache.org/repos/asf/libcloud/blob/847fd4ce/libcloud/test/compute/test_elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_elasticstack.py b/libcloud/test/compute/test_elasticstack.py
index af08dfb..7f8a0ee 100644
--- a/libcloud/test/compute/test_elasticstack.py
+++ b/libcloud/test/compute/test_elasticstack.py
@@ -215,7 +215,7 @@ class ElasticStackMockHttp(MockHttp):
 
     def _drives_0012e24a_6eae_4279_9912_3432f698cec8_image_38df0986_4d85_4b76_b502_3878ffc80161_gunzip(self, method, url, body, headers):
         # ElasticHosts image
-        return (httplib.NO_CONTENT, body, {}, httplib.responses[httplib.NO_CONTENT])
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _drives_0012e24a_6eae_4279_9912_3432f698cec8_image_90aa51f2_15c0_4cff_81ee_e93aa20b9468_gunzip(self, method, url, body, headers):
         # Skalikloud image


[08/14] git commit: Fix a regression with calling encode_container_name instead of encode_object_name on object name in get_object method.

Posted by to...@apache.org.
Fix a regression with calling encode_container_name instead of
 encode_object_name on object name in get_object method.

Reported by Ben Meng, part of LIBCLOUD-366.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4bada333
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4bada333
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4bada333

Branch: refs/heads/0.13.1
Commit: 4bada3339cad8d88fd65938a1c746af0280db204
Parents: e83b0b4
Author: Tomaz Muraus <to...@apache.org>
Authored: Tue Jul 23 20:39:16 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:04:05 2013 +0200

----------------------------------------------------------------------
 CHANGES                                  |  7 +++++++
 libcloud/storage/drivers/cloudfiles.py   |  2 +-
 libcloud/test/storage/test_cloudfiles.py | 21 +++++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4bada333/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 741a565..70aaa13 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,6 +14,13 @@ Changes with Apache Libcloud in development
       code when determining drive imaging success. (LIBCLOUD-363)
       [Bob Thompson]
 
+  *) Storage
+
+    - Fix a regression with calling encode_container_name instead of
+      encode_object_name on object name in get_object method.
+      Reported by Ben Meng (LIBCLOUD-366)
+      [Tomaz Muraus]
+
 Changes with Apache Libcloud 0.13.0:
 
  *) General

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4bada333/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py b/libcloud/storage/drivers/cloudfiles.py
index d3fddc8..7e810b6 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -260,7 +260,7 @@ class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin):
     def get_object(self, container_name, object_name):
         container = self.get_container(container_name)
         container_name_encoded = self._encode_container_name(container_name)
-        object_name_encoded = self._encode_container_name(object_name)
+        object_name_encoded = self._encode_object_name(object_name)
 
         response = self.connection.request('/%s/%s' % (container_name_encoded,
                                                        object_name_encoded),

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4bada333/libcloud/test/storage/test_cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_cloudfiles.py b/libcloud/test/storage/test_cloudfiles.py
index e0390b5..b70be4f 100644
--- a/libcloud/test/storage/test_cloudfiles.py
+++ b/libcloud/test/storage/test_cloudfiles.py
@@ -201,6 +201,11 @@ class CloudFilesTests(unittest.TestCase):
         self.assertEqual(obj.meta_data['foo-bar'], 'test 1')
         self.assertEqual(obj.meta_data['bar-foo'], 'test 2')
 
+    def test_get_object_object_name_encoding(self):
+        obj = self.driver.get_object(container_name='test_container',
+                                     object_name='~/test_object/')
+        self.assertEqual(obj.name, '~/test_object/')
+
     def test_get_object_not_found(self):
         try:
             self.driver.get_object(container_name='test_container',
@@ -839,6 +844,22 @@ class CloudFilesMockHttp(StorageMockHttp, MockHttpTestCase):
                              'content-type': 'application/zip'})
         return (status_code, body, headers, httplib.responses[httplib.OK])
 
+    def _v1_MossoCloudFS_test_container__7E_test_object(
+        self, method, url, body, headers):
+        headers = copy.deepcopy(self.base_headers)
+        if method == 'HEAD':
+            # get_object_name_encoding
+            body = self.fixtures.load('list_container_objects_empty.json')
+            status_code = httplib.NO_CONTENT
+            headers.update({ 'content-length': 555,
+                             'last-modified': 'Tue, 25 Jan 2011 22:01:49 GMT',
+                             'etag': '6b21c4a111ac178feacf9ec9d0c71f17',
+                             'x-object-meta-foo-bar': 'test 1',
+                             'x-object-meta-bar-foo': 'test 2',
+                             'content-type': 'application/zip'})
+        return (status_code, body, headers, httplib.responses[httplib.OK])
+
+
     def _v1_MossoCloudFS_test_create_container(
         self, method, url, body, headers):
         # test_create_container_success


[06/14] git commit: Add returning the public ip address of opsrouce nodes when listing nodes

Posted by to...@apache.org.
Add returning the public ip address of opsrouce nodes when listing nodes

Signed-off-by: Tomaz Muraus <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/05b810c5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/05b810c5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/05b810c5

Branch: refs/heads/0.13.1
Commit: 05b810c5e1772daeb45498b247a3797724a0cf68
Parents: fe47412
Author: Michael <mi...@securitycompass.com>
Authored: Sun Aug 25 16:10:20 2013 -0400
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:02:45 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/opsource.py                        | 4 +++-
 ...8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml | 1 +
 libcloud/test/compute/test_opsource.py                      | 9 +++++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/05b810c5/libcloud/compute/drivers/opsource.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/opsource.py b/libcloud/compute/drivers/opsource.py
index 8b89ea8..d45ba3c 100644
--- a/libcloud/compute/drivers/opsource.py
+++ b/libcloud/compute/drivers/opsource.py
@@ -578,10 +578,12 @@ class OpsourceNodeDriver(NodeDriver):
             'status': status,
         }
 
+	public_ip = findtext(element, 'publicIpAddress', SERVER_NS)
+
         n = Node(id=findtext(element, 'id', SERVER_NS),
                  name=findtext(element, 'name', SERVER_NS),
                  state=state,
-                 public_ips=[],
+                 public_ips=[public_ip] if public_ip is not None else [],
                  private_ips=findtext(element, 'privateIpAddress', SERVER_NS),
                  driver=self.connection.driver,
                  extra=extra)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/05b810c5/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml b/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
index ae48208..a11d6c2 100644
--- a/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
+++ b/libcloud/test/compute/fixtures/opsource/oec_0_9_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_deployed.xml
@@ -17,6 +17,7 @@
         <sourceImageId>44ed8b72-ebea-11df-bdc1-001517c46384</sourceImageId>
         <networkId>53b4c05b-341e-4ac3-b688-bdd78e43ca9e</networkId>
         <privateIpAddress>10.162.1.1</privateIpAddress>
+        <publicIpAddress>200.16.132.7</publicIpAddress>
         <machineName>10-162-1-1</machineName>
         <isStarted>true</isStarted>
         <deployedTime>2011-03-02T17:16:09.882Z</deployedTime>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/05b810c5/libcloud/test/compute/test_opsource.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_opsource.py b/libcloud/test/compute/test_opsource.py
index c94dba7..f0518c4 100644
--- a/libcloud/test/compute/test_opsource.py
+++ b/libcloud/test/compute/test_opsource.py
@@ -144,6 +144,15 @@ class OpsourceTests(unittest.TestCase, TestCaseMixin):
         self.assertEqual(nets[0].name, 'test-net1')
         self.assertTrue(isinstance(nets[0].location, NodeLocation))
 
+    def test_node_public_ip(self):
+        nodes = self.driver.list_nodes()
+        for node in nodes:
+            if node.id == "abadbc7e-9e10-46ca-9d4a-194bcc6b6c16":
+                self.assertEqual(node.public_ips[0], '200.16.132.7')
+            else:
+                self.assertEqual(len(node.public_ips), 0)
+
+
 class OpsourceMockHttp(MockHttp):
 
     fixtures = ComputeFileFixtures('opsource')


[07/14] git commit: Fix indentation.

Posted by to...@apache.org.
Fix indentation.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e83b0b44
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e83b0b44
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e83b0b44

Branch: refs/heads/0.13.1
Commit: e83b0b44404c877ec2009b56fb5f5f60601482ae
Parents: 05b810c
Author: Tomaz Muraus <to...@apache.org>
Authored: Mon Aug 26 14:19:23 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 12:02:50 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/opsource.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e83b0b44/libcloud/compute/drivers/opsource.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/opsource.py b/libcloud/compute/drivers/opsource.py
index d45ba3c..b88751c 100644
--- a/libcloud/compute/drivers/opsource.py
+++ b/libcloud/compute/drivers/opsource.py
@@ -578,7 +578,7 @@ class OpsourceNodeDriver(NodeDriver):
             'status': status,
         }
 
-	public_ip = findtext(element, 'publicIpAddress', SERVER_NS)
+        public_ip = findtext(element, 'publicIpAddress', SERVER_NS)
 
         n = Node(id=findtext(element, 'id', SERVER_NS),
                  name=findtext(element, 'name', SERVER_NS),


[02/14] git commit: Modify GoGridConnection to call parent request method with an empty string for 'data' argument.

Posted by to...@apache.org.
Modify GoGridConnection to call parent request method with an empty string for
'data' argument.

Contributed by Bob Thompson, part of LIBCLOUD-362.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9e94e399
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9e94e399
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9e94e399

Branch: refs/heads/0.13.1
Commit: 9e94e399398ff15bcba9921b5b6d3977a44d27de
Parents: a73cc09
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Aug 8 15:26:50 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Wed Sep 4 11:58:06 2013 +0200

----------------------------------------------------------------------
 libcloud/common/gogrid.py | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e94e399/libcloud/common/gogrid.py
----------------------------------------------------------------------
diff --git a/libcloud/common/gogrid.py b/libcloud/common/gogrid.py
index a56ba3b..acc0c8d 100644
--- a/libcloud/common/gogrid.py
+++ b/libcloud/common/gogrid.py
@@ -82,6 +82,10 @@ class GoGridConnection(ConnectionUserAndKey):
         m = hashlib.md5(b(key + secret + str(int(time.time()))))
         return m.hexdigest()
 
+    def request(self, action, params=None, data='', headers=None, method='GET', raw=False):
+        return super(GoGridConnection, self).request(action, params, data,
+                     headers, method, raw)
+
 
 class GoGridIpAddress(object):
     """