Commit 6aadd6e1 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Do not unpublish by default @ pithos rest calls

Refs: #3780
parent 4a469d38
......@@ -7,6 +7,7 @@ Bug Fixes:
- Restore 2nd level command syntax in shell [#3736]
- Allow copy of deleted objects by refering to older version [#3737]
- Add image.add_member missing content-length header
- Do not unpublish by default in all pithos low level requests [#3780]
Changes:
......
......@@ -513,7 +513,7 @@ class PithosRestClient(StorageClient):
content_disposition=None,
manifest=None,
permissions=None,
public=False,
public=None,
metadata=None,
*args, **kwargs):
""" Full Pithos+ PUT at object level
......@@ -564,8 +564,7 @@ class PithosRestClient(StorageClient):
{ 'read':[user1, group1, user2, ...],
'write':['user3, group2, group3, ...] }
:param public: (bool) If true, Object is publicly accessible,
if false, not
:param public: (bool) If true, Object is published, False, unpublished
:param metadata: (dict) Optional user defined metadata in the form
{'meta-key-1':'meta-value-1', 'meta-key-2':'meta-value-2', ...}
......@@ -602,7 +601,7 @@ class PithosRestClient(StorageClient):
perms += ';' if perms else ''
perms += '%s=%s' % (perm_type, ','.join(perm_list))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
self.set_header('X-Object-Public', public, public is not None)
if metadata:
for key, val in metadata.items():
self.set_header('X-Object-Meta-' + key, val)
......@@ -623,7 +622,7 @@ class PithosRestClient(StorageClient):
content_disposition=None,
source_version=None,
permissions=None,
public=False,
public=None,
metadata=None,
*args, **kwargs):
""" Full Pithos+ COPY at object level
......@@ -660,7 +659,7 @@ class PithosRestClient(StorageClient):
{ 'read':[user1, group1, user2, ...],
'write':['user3, group2, group3, ...] }
:param public: (bool) If true, Object is publicly accessible
:param public: (bool) If true, Object is published, False, unpublished
:param metadata: (dict) Optional user defined metadata in the form
{'meta-key-1':'meta-value-1', 'meta-key-2':'meta-value-2', ...}
......@@ -692,7 +691,7 @@ class PithosRestClient(StorageClient):
perms += ';' if perms else ''
perms += '%s=%s' % (perm_type, ','.join(perm_list))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
self.set_header('X-Object-Public', public, public is not None)
if metadata:
for key, val in metadata.items():
self.set_header('X-Object-Meta-' + key, val)
......@@ -713,7 +712,7 @@ class PithosRestClient(StorageClient):
content_encoding=None,
content_disposition=None,
permissions={},
public=False,
public=None,
metadata={},
*args, **kwargs):
""" Full Pithos+ COPY at object level
......@@ -750,7 +749,7 @@ class PithosRestClient(StorageClient):
{ 'read':[user1, group1, user2, ...],
'write':['user3, group2, group3, ...] }
:param public: (bool) If true, Object is publicly accessible
:param public: (bool) If true, Object is published, False, unpublished
:param metadata: (dict) Optional user defined metadata in the form
{'meta-key-1':'meta-value-1', 'meta-key-2':'meta-value-2', ...}
......@@ -779,7 +778,7 @@ class PithosRestClient(StorageClient):
perms += ';' if perms else ''
perms += '%s=%s' % (perm_type, ','.join(perm_list))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
self.set_header('X-Object-Public', public, public is not None)
if metadata:
for key, val in metadata.items():
self.set_header('X-Object-Meta-' + key, val)
......@@ -806,7 +805,7 @@ class PithosRestClient(StorageClient):
object_bytes=None,
manifest=None,
permissions={},
public=False,
public=None,
metadata={},
*args, **kwargs):
""" Full Pithos+ POST at object level
......@@ -854,7 +853,7 @@ class PithosRestClient(StorageClient):
{ 'read':[user1, group1, user2, ...],
'write':['user3, group2, group3, ...] }
:param public: (bool) If true, Object is publicly accessible
:param public: (bool) If true, Object is published, False, unpublished
:param metadata: (dict) Optional user defined metadata in the form
{'meta-key-1':'meta-value-1', 'meta-key-2':'meta-value-2', ...}
......@@ -892,7 +891,7 @@ class PithosRestClient(StorageClient):
perms += ';' if perms else ''
perms += '%s=%s' % (perm_type, ','.join(perm_list))
self.set_header('X-Object-Sharing', perms)
self.set_header('X-Object-Public', public)
self.set_header('X-Object-Public', public, public is not None)
for key, val in metadata.items():
self.set_header('X-Object-Meta-' + key, val)
......
......@@ -1650,13 +1650,13 @@ class PithosClient(TestCase):
read_perms = ['u1', 'g1', 'u2', 'g2']
write_perms = ['u1', 'g1']
for kwargs in (
dict(read_permition=read_perms, write_permition=write_perms),
dict(read_permition=read_perms),
dict(write_permition=write_perms),
dict(read_permission=read_perms, write_permission=write_perms),
dict(read_permission=read_perms),
dict(write_permission=write_perms),
dict()):
self.client.set_object_sharing(obj, **kwargs)
kwargs['read'] = kwargs.pop('read_permition', '')
kwargs['write'] = kwargs.pop('write_permition', '')
kwargs['read'] = kwargs.pop('read_permission', '')
kwargs['write'] = kwargs.pop('write_permission', '')
self.assertEqual(
OP.mock_calls[-1],
call(obj, update=True, permissions=kwargs))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment