summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.zuul.yaml12
-rw-r--r--setup.cfg1
-rw-r--r--swiftclient/utils.py14
-rw-r--r--test/unit/test_utils.py26
-rw-r--r--tox.ini2
5 files changed, 51 insertions, 4 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
index 00d179d..3c680ab 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -10,6 +10,9 @@
# for installation.
required-projects:
- opendev.org/openstack/python-swiftclient
+ vars:
+ # New tox keeps breaking things as of 2023-01
+ ensure_tox_version: '<4'
- job:
name: swiftclient-functional
@@ -33,18 +36,27 @@
- openstack-python3-jobs
- publish-openstack-docs-pti
- release-notes-jobs-python3
+ experimental:
+ # on-demand pipeline used to test older (but still supported) versions of python
+ jobs:
+ - openstack-tox-py36
+ - openstack-tox-py37
check:
jobs:
- swiftclient-swift-functional
- swiftclient-functional
- openstack-tox-py39:
voting: true
+ - openstack-tox-py310:
+ voting: true
gate:
jobs:
- swiftclient-swift-functional
- swiftclient-functional
- openstack-tox-py39:
voting: true
+ - openstack-tox-py310:
+ voting: true
post:
jobs:
- openstack-tox-cover
diff --git a/setup.cfg b/setup.cfg
index e429b12..dfeb3b7 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -21,6 +21,7 @@ classifier =
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
+ Programming Language :: Python :: 3.10
Programming Language :: Python :: 3 :: Only
[files]
diff --git a/swiftclient/utils.py b/swiftclient/utils.py
index 1b80e6d..0a67537 100644
--- a/swiftclient/utils.py
+++ b/swiftclient/utils.py
@@ -173,7 +173,11 @@ def generate_temp_url(path, seconds, key, method, absolute=False,
raise ValueError('digest must be one of sha1, sha256, or sha512')
parts = path_for_body.split('/', 4)
- if len(parts) != 5 or parts[0] or not all(parts[1:(4 if prefix else 5)]):
+ if path_for_body == '/info':
+ # /info signatures do not support prefixes or ip ranges
+ prefix = False
+ ip_range = None
+ elif len(parts) != 5 or parts[0] or not all(parts[1:(4 if prefix else 5)]):
if prefix:
raise ValueError('path must at least contain /v1/a/c/')
else:
@@ -220,8 +224,12 @@ def generate_temp_url(path, seconds, key, method, absolute=False,
expiration = time.strftime(
EXPIRES_ISO8601_FORMAT, time.gmtime(expiration))
- temp_url = '{path}?temp_url_sig={sig}&temp_url_expires={exp}'.format(
- path=path_for_body, sig=sig, exp=expiration)
+ if path_for_body == '/info':
+ temp_url = '{path}?swiftinfo_sig={sig}&swiftinfo_expires={exp}'.format(
+ path=path_for_body, sig=sig, exp=expiration)
+ else:
+ temp_url = '{path}?temp_url_sig={sig}&temp_url_expires={exp}'.format(
+ path=path_for_body, sig=sig, exp=expiration)
if ip_range:
temp_url += '&temp_url_ip_range={}'.format(ip_range)
diff --git a/test/unit/test_utils.py b/test/unit/test_utils.py
index 6d2f4a1..deb3857 100644
--- a/test/unit/test_utils.py
+++ b/test/unit/test_utils.py
@@ -508,6 +508,32 @@ class TestTempURLBytesPathAndNonUtf8Key(TestTempURL):
])
+class TestTempURLInfoPath(TestTempURL):
+ url = '/info'.encode('utf-8')
+ expected_body = b'\n'.join([
+ b'GET',
+ b'1400003600',
+ url,
+ ])
+
+ @property
+ def expected_url(self):
+ if isinstance(self.url, bytes):
+ return self.url + (b'?swiftinfo_sig=temp_url_signature'
+ b'&swiftinfo_expires=1400003600')
+ return self.url + (u'?swiftinfo_sig=temp_url_signature'
+ u'&swiftinfo_expires=1400003600')
+
+ @property
+ def expected_sha512_url(self):
+ if isinstance(self.url, bytes):
+ return self.url + (
+ b'?swiftinfo_sig=sha512:dGVtcF91cmxfc2lnbmF0dXJl'
+ b'&swiftinfo_expires=1400003600')
+ return self.url + (u'?swiftinfo_sig=sha512:dGVtcF91cmxfc2lnbmF0dXJl'
+ u'&swiftinfo_expires=1400003600')
+
+
class TestReadableToIterable(unittest.TestCase):
def test_iter(self):
diff --git a/tox.ini b/tox.ini
index e1e679d..3a6cd8a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -18,7 +18,7 @@ commands = sh -c '(find . -not \( -type d -name .?\* -prune \) \
-print0) | xargs -0 rm -rf'
stestr run {posargs}
allowlist_externals = sh
-passenv = SWIFT_* *_proxy
+passenv = SWIFT_*
[testenv:pep8]
commands =