Verified Commit 65dcb2f5 authored by Martin Abbrent's avatar Martin Abbrent 💬
Browse files

Add set_bucket_tags methode

parent 95ccc7c8
Pipeline #51195 passed with stage
in 3 minutes and 5 seconds
MAJOR = 0
MINOR = 0
PATCH = 10
PATCH = 11
__version__ = '{}.{}.{}'.format(MAJOR, MINOR, PATCH)
......@@ -4,7 +4,7 @@ import subprocess
import tempfile
from minio import Minio
from minio.commonconfig import GOVERNANCE
from minio.commonconfig import GOVERNANCE, Tags
from minio.objectlockconfig import ObjectLockConfig, YEARS
......@@ -93,6 +93,7 @@ class Mc:
err_from_stdout = ret.stdout if json.loads(ret.stdout).get('status') == 'error' else ''
msg = ret.stderr or err_from_stdout or '"Unspecified error: Empty response from minio ' \
'client" '
self.logger.error(msg)
raise MinIoClientError(json.dumps(json.loads(msg), indent=4))
if not confidential:
......@@ -164,3 +165,11 @@ class Mc:
# add event listener
for target in targets:
self._command(['event', 'add', '{}/{}'.format(self.alias, bucket_name), target])
def set_bucket_tags(self, bucket_name: str, plain_tags: dict):
bucket_tags = Tags.new_bucket_tags()
for k, v in plain_tags.items():
bucket_tags[k] = v
self.minio.set_bucket_tags(bucket_name, bucket_tags)
......@@ -33,4 +33,4 @@ m.bucket_exists('test')
m.make_locked_bucket('test')
m.set_bucket_100y_retention('test')
m.enable_bucket_notification('test')
m.set_bucket_tags('test', {'foo': 'bar'})
Supports Markdown
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