Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-minio for openSUSE:Factory 
checked in at 2022-03-28 17:01:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-minio (Old)
 and      /work/SRC/openSUSE:Factory/.python-minio.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-minio"

Mon Mar 28 17:01:02 2022 rev:13 rq:965314 version:7.1.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-minio/python-minio.changes        
2021-10-25 15:18:36.153719493 +0200
+++ /work/SRC/openSUSE:Factory/.python-minio.new.1900/python-minio.changes      
2022-03-28 17:01:56.841082362 +0200
@@ -1,0 +2,24 @@
+Thu Mar 24 10:18:36 UTC 2022 - pgaj...@suse.com
+
+- version update to 7.1.5
+  7.1.5
+  -----
+  Add AssumeRoleWithCertificate credential provider. by @balamurugana in #1182
+  7.1.4
+  -----
+  docs: fix typo in object_lock config function name by @harshavardhana in 
#1176
+  fix progress bar division by zero error by @harshavardhana in #1177
+  Add policy unset method to minio admin by @federicober in #1180
+  fix: lint checks and enable MINIO_CI_CD=1 for functional tests by 
@harshavardhana in #1181
+  7.1.3
+  -----
+  Update set_object_lock_config.py by @anooptp in #1170
+  fix finding user's home directory in 
AWSConfigProvider/MinioClientConfigProvider by @nfioraio-ec in #1175
+  fix EnvAWSProvider/EnvMinioProvider to fetch access/secret keys and session 
token always from os.environ by @nfioraio-ec in #1174
+  7.1.2
+  -----
+  fix: do not enforce role value for replicationConfig (#1166) (11/24/21) 
(Harshavardhana)
+  fix: canonical request path if empty choose '/' (#1165) (11/24/21) 
(Harshavardhana)
+- do not require python-mock for build
+
+-------------------------------------------------------------------

Old:
----
  minio-7.1.1.tar.gz

New:
----
  minio-7.1.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-minio.spec ++++++
--- /var/tmp/diff_new_pack.zvSGJG/_old  2022-03-28 17:01:57.333083030 +0200
+++ /var/tmp/diff_new_pack.zvSGJG/_new  2022-03-28 17:01:57.337083036 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-minio
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-minio
-Version:        7.1.1
+Version:        7.1.5
 Release:        0
 Summary:        Minio library for Amazon S3 compatible cloud storage
 License:        Apache-2.0
@@ -38,7 +38,6 @@
 BuildRequires:  %{python_module Faker}
 BuildRequires:  %{python_module certifi}
 BuildRequires:  %{python_module future}
-BuildRequires:  %{python_module mock}
 BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module python-dateutil}
 BuildRequires:  %{python_module pytz}
@@ -63,6 +62,8 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
+# https://github.com/minio/minio-py/issues/1187
+sed -i 's:import mock:import unittest.mock as mock:' tests/unit/*.py
 %pytest
 
 %files %{python_files}

++++++ minio-7.1.1.tar.gz -> minio-7.1.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/PKG-INFO new/minio-7.1.5/PKG-INFO
--- old/minio-7.1.1/PKG-INFO    2021-10-08 21:43:40.517315100 +0200
+++ new/minio-7.1.5/PKG-INFO    2022-03-11 04:28:56.537088000 +0100
@@ -1,12 +1,12 @@
 Metadata-Version: 2.1
 Name: minio
-Version: 7.1.1
+Version: 7.1.5
 Summary: MinIO Python SDK for Amazon S3 Compatible Cloud Storage
 Home-page: https://github.com/minio/minio-py
+Download-URL: https://github.com/minio/minio-py/releases
 Author: MinIO, Inc.
 Author-email: d...@min.io
 License: Apache License 2.0
-Download-URL: https://github.com/minio/minio-py/releases
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/docs/API.md new/minio-7.1.5/docs/API.md
--- old/minio-7.1.1/docs/API.md 2021-10-08 21:41:08.000000000 +0200
+++ new/minio-7.1.5/docs/API.md 2022-03-11 04:27:21.000000000 +0100
@@ -828,7 +828,7 @@
 
 ```py
 config = ObjectLockConfig(GOVERNANCE, 15, DAYS)
-client.set_object_lock_condig("my-bucket", config)
+client.set_object_lock_config("my-bucket", config)
 ```
 
 ## 3. Object operations
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/minio-7.1.1/examples/minio_with_certificate_identity_provider.py 
new/minio-7.1.5/examples/minio_with_certificate_identity_provider.py
--- old/minio-7.1.1/examples/minio_with_certificate_identity_provider.py        
1970-01-01 01:00:00.000000000 +0100
+++ new/minio-7.1.5/examples/minio_with_certificate_identity_provider.py        
2022-03-11 04:27:21.000000000 +0100
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
+# (C) 2022 MinIO, Inc.
+#
+# Licensed 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.
+#
+
+from minio import Minio
+from minio.credentials import CertificateIdentityProvider
+
+# STS endpoint usually point to MinIO server.
+sts_endpoint = "https://STS-HOST:STS-PORT/";
+
+# client certificate file
+cert_file = "/path/to/client.pem"
+
+# client private key
+key_file = "/path/to/client.key"
+
+provider = CertificateIdentityProvider(
+    sts_endpoint, cert_file=cert_file, key_file=key_file,
+)
+
+client = Minio("MINIO-HOST:MINIO-PORT", credentials=provider)
+
+# Get information of an object.
+stat = client.stat_object("my-bucket", "my-object")
+print(stat)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/examples/progress.py 
new/minio-7.1.5/examples/progress.py
--- old/minio-7.1.1/examples/progress.py        2021-10-08 21:41:08.000000000 
+0200
+++ new/minio-7.1.5/examples/progress.py        2022-03-11 04:27:21.000000000 
+0100
@@ -106,7 +106,9 @@
                               prefix=self.prefix)
             self.display_queue.task_done()
             if current_size == total_length:
+                # once we have done uploading everything return
                 self.done_progress()
+                return
 
     def update(self, size):
         """
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/examples/set_object_lock_config.py 
new/minio-7.1.5/examples/set_object_lock_config.py
--- old/minio-7.1.1/examples/set_object_lock_config.py  2021-10-08 
21:41:08.000000000 +0200
+++ new/minio-7.1.5/examples/set_object_lock_config.py  2022-03-11 
04:27:21.000000000 +0100
@@ -25,4 +25,4 @@
 )
 
 config = ObjectLockConfig(GOVERNANCE, 15, DAYS)
-client.set_object_lock_condig("my-bucket", config)
+client.set_object_lock_config("my-bucket", config)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/minio/__init__.py 
new/minio-7.1.5/minio/__init__.py
--- old/minio-7.1.1/minio/__init__.py   2021-10-08 21:41:08.000000000 +0200
+++ new/minio-7.1.5/minio/__init__.py   2022-03-11 04:27:21.000000000 +0100
@@ -33,7 +33,7 @@
 
 __title__ = "minio-py"
 __author__ = "MinIO, Inc."
-__version__ = "7.1.1"
+__version__ = "7.1.5"
 __license__ = "Apache 2.0"
 __copyright__ = "Copyright 2015, 2016, 2017, 2018, 2019, 2020 MinIO, Inc."
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/minio/credentials/providers.py 
new/minio-7.1.5/minio/credentials/providers.py
--- old/minio-7.1.1/minio/credentials/providers.py      2021-10-08 
21:41:08.000000000 +0200
+++ new/minio-7.1.5/minio/credentials/providers.py      2022-03-11 
04:27:21.000000000 +0100
@@ -25,9 +25,11 @@
 import time
 from abc import ABCMeta, abstractmethod
 from datetime import timedelta
+from pathlib import Path
 from urllib.parse import urlencode, urlsplit
 from xml.etree import ElementTree
 
+import certifi
 import urllib3
 
 from minio.helpers import sha256_hash
@@ -64,6 +66,15 @@
     return res
 
 
+def _user_home_dir():
+    """Return current user home folder."""
+    return (
+        os.environ.get("HOME") or
+        os.environ.get("UserProfile") or
+        str(Path.home())
+    )
+
+
 class Provider:  # pylint: disable=too-few-public-methods
     """Credential retriever."""
     __metaclass__ = ABCMeta
@@ -115,6 +126,7 @@
         self._body = urlencode(query_params)
         self._content_sha256 = sha256_hash(self._body)
         url = urlsplit(sts_endpoint)
+        self._url = url
         self._host = url.netloc
         if (
                 (url.scheme == "http" and url.port == 80) or
@@ -131,7 +143,7 @@
         utctime = utcnow()
         headers = sign_v4_sts(
             "POST",
-            urlsplit(self._sts_endpoint),
+            self._url,
             self._region,
             {
                 "Content-Type": "application/x-www-form-urlencoded",
@@ -194,38 +206,30 @@
 class EnvAWSProvider(Provider):
     """Credential provider from AWS environment variables."""
 
-    def __init__(self):
-        access_key = (
-            os.environ.get("AWS_ACCESS_KEY_ID") or
-            os.environ.get("AWS_ACCESS_KEY")
-        )
-        secret_key = (
-            os.environ.get("AWS_SECRET_ACCESS_KEY") or
-            os.environ.get("AWS_SECRET_KEY")
-        )
-        self._credentials = Credentials(
-            access_key,
-            secret_key,
-            session_token=os.environ.get("AWS_SESSION_TOKEN"),
-        )
-
     def retrieve(self):
         """Retrieve credentials."""
-        return self._credentials
+        return Credentials(
+            access_key=(
+                os.environ.get("AWS_ACCESS_KEY_ID") or
+                os.environ.get("AWS_ACCESS_KEY")
+            ),
+            secret_key=(
+                os.environ.get("AWS_SECRET_ACCESS_KEY") or
+                os.environ.get("AWS_SECRET_KEY")
+            ),
+            session_token=os.environ.get("AWS_SESSION_TOKEN"),
+        )
 
 
 class EnvMinioProvider(Provider):
     """Credential provider from MinIO environment variables."""
 
-    def __init__(self):
-        self._credentials = Credentials(
-            os.environ.get("MINIO_ACCESS_KEY"),
-            os.environ.get("MINIO_SECRET_KEY"),
-        )
-
     def retrieve(self):
         """Retrieve credentials."""
-        return self._credentials
+        return Credentials(
+            access_key=os.environ.get("MINIO_ACCESS_KEY"),
+            secret_key=os.environ.get("MINIO_SECRET_KEY"),
+        )
 
 
 class AWSConfigProvider(Provider):
@@ -235,7 +239,7 @@
         self._filename = (
             filename or
             os.environ.get("AWS_SHARED_CREDENTIALS_FILE") or
-            os.path.join(os.environ.get("HOME"), ".aws", "credentials")
+            os.path.join(_user_home_dir(), ".aws", "credentials")
         )
         self._profile = profile or os.environ.get("AWS_PROFILE") or "default"
 
@@ -285,7 +289,7 @@
         self._filename = (
             filename or
             os.path.join(
-                os.environ.get("HOME"),
+                _user_home_dir(),
                 "mc" if sys.platform == "win32" else ".mc",
                 "config.json",
             )
@@ -590,3 +594,66 @@
 
     def _is_web_identity(self):
         return True
+
+
+class CertificateIdentityProvider(Provider):
+    """Credential provider using AssumeRoleWithCertificate API."""
+
+    def __init__(
+            self, sts_endpoint, cert_file=None, key_file=None,
+            key_password=None, ca_certs=None, duration_seconds=0,
+            http_client=None,
+    ):
+        if urlsplit(sts_endpoint).scheme != "https":
+            raise ValueError("STS endpoint scheme must be HTTPS")
+
+        if bool(http_client) != (cert_file and key_file):
+            pass
+        else:
+            raise ValueError(
+                "either cert/key file or custom http_client must be provided",
+            )
+
+        self._sts_endpoint = sts_endpoint + "?" + urlencode(
+            {
+                "Action": "AssumeRoleWithCertificate",
+                "Version": "2011-06-15",
+                "DurationSeconds": str(
+                    duration_seconds
+                    if duration_seconds > _DEFAULT_DURATION_SECONDS
+                    else _DEFAULT_DURATION_SECONDS
+                ),
+            },
+        )
+        self._http_client = http_client or urllib3.PoolManager(
+            maxsize=10,
+            cert_file=cert_file,
+            cert_reqs='CERT_REQUIRED',
+            key_file=key_file,
+            key_password=key_password,
+            ca_certs=ca_certs or certifi.where(),
+            retries=urllib3.Retry(
+                total=5,
+                backoff_factor=0.2,
+                status_forcelist=[500, 502, 503, 504],
+            ),
+        )
+        self._credentials = None
+
+    def retrieve(self):
+        """Retrieve credentials."""
+
+        if self._credentials and not self._credentials.is_expired():
+            return self._credentials
+
+        res = _urlopen(
+            self._http_client,
+            "POST",
+            self._sts_endpoint,
+        )
+
+        self._credentials = _parse_credentials(
+            res.data.decode(), "AssumeRoleWithCertificateResult",
+        )
+
+        return self._credentials
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/minio/minioadmin.py 
new/minio-7.1.5/minio/minioadmin.py
--- old/minio-7.1.1/minio/minioadmin.py 2021-10-08 21:41:08.000000000 +0200
+++ new/minio-7.1.5/minio/minioadmin.py 2022-03-11 04:27:21.000000000 +0100
@@ -153,6 +153,17 @@
             )
         raise ValueError("either user or group must be set")
 
+    def policy_unset(self, policy_name, user=None, group=None):
+        """Unset an IAM policy for a user or group."""
+        if (user is not None) ^ (group is not None):
+            return self._run(
+                [
+                    "policy", "unset", self._target, policy_name,
+                    ("user=" if user else "group=") + (user or group),
+                ],
+            )
+        raise ValueError("either user or group must be set")
+
     def config_get(self, key=None):
         """Get configuration parameters."""
         return self._run(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/minio/replicationconfig.py 
new/minio-7.1.5/minio/replicationconfig.py
--- old/minio-7.1.1/minio/replicationconfig.py  2021-10-08 21:41:08.000000000 
+0200
+++ new/minio-7.1.5/minio/replicationconfig.py  2022-03-11 04:27:21.000000000 
+0100
@@ -459,8 +459,6 @@
     """Replication configuration."""
 
     def __init__(self, role, rules):
-        if not role:
-            raise ValueError("role must be provided")
         if not rules:
             raise ValueError("rules must be provided")
         if len(rules) > 1000:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/minio/signer.py 
new/minio-7.1.5/minio/signer.py
--- old/minio-7.1.1/minio/signer.py     2021-10-08 21:41:08.000000000 +0200
+++ new/minio-7.1.5/minio/signer.py     2022-03-11 04:27:21.000000000 +0100
@@ -58,8 +58,8 @@
     for key, values in headers.items():
         key = key.lower()
         if key not in (
-                "authorization", "content-type",
-                "content-length", "user-agent",
+                "authorization",
+                "user-agent",
         ):
             values = values if isinstance(values, (list, tuple)) else [values]
             canonical_headers[key] = ",".join([
@@ -101,7 +101,7 @@
     #   HexEncode(Hash(RequestPayload))
     canonical_request = (
         f"{method}\n"
-        f"{url.path}\n"
+        f"{url.path or '/'}\n"
         f"{canonical_query_string}\n"
         f"{canonical_headers}\n\n"
         f"{signed_headers}\n"
@@ -248,7 +248,7 @@
     #   HexEncode(Hash(RequestPayload))
     canonical_request = (
         f"{method}\n"
-        f"{url.path}\n"
+        f"{url.path or '/'}\n"
         f"{canonical_query_string}\n"
         f"{canonical_headers}\n\n"
         f"{signed_headers}\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/minio.egg-info/PKG-INFO 
new/minio-7.1.5/minio.egg-info/PKG-INFO
--- old/minio-7.1.1/minio.egg-info/PKG-INFO     2021-10-08 21:43:38.000000000 
+0200
+++ new/minio-7.1.5/minio.egg-info/PKG-INFO     2022-03-11 04:28:55.000000000 
+0100
@@ -1,12 +1,12 @@
 Metadata-Version: 2.1
 Name: minio
-Version: 7.1.1
+Version: 7.1.5
 Summary: MinIO Python SDK for Amazon S3 Compatible Cloud Storage
 Home-page: https://github.com/minio/minio-py
+Download-URL: https://github.com/minio/minio-py/releases
 Author: MinIO, Inc.
 Author-email: d...@min.io
 License: Apache License 2.0
-Download-URL: https://github.com/minio/minio-py/releases
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
 Classifier: Intended Audience :: Developers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/minio.egg-info/SOURCES.txt 
new/minio-7.1.5/minio.egg-info/SOURCES.txt
--- old/minio-7.1.1/minio.egg-info/SOURCES.txt  2021-10-08 21:43:40.000000000 
+0200
+++ new/minio-7.1.5/minio.egg-info/SOURCES.txt  2022-03-11 04:28:56.000000000 
+0100
@@ -40,6 +40,7 @@
 examples/make_bucket.py
 examples/minio_with_assume_role_provider.py
 examples/minio_with_aws_config_provider.py
+examples/minio_with_certificate_identity_provider.py
 examples/minio_with_chained_provider.py
 examples/minio_with_client_grants_provider.py
 examples/minio_with_env_aws_provider.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/minio-7.1.1/tests/unit/credentials_test.py 
new/minio-7.1.5/tests/unit/credentials_test.py
--- old/minio-7.1.1/tests/unit/credentials_test.py      2021-10-08 
21:41:08.000000000 +0200
+++ new/minio-7.1.5/tests/unit/credentials_test.py      2022-03-11 
04:27:21.000000000 +0100
@@ -94,13 +94,33 @@
                 EnvAWSProvider(), EnvMinioProvider(),
             ]
         )
-        # retireve provider (env_aws) has priority
+        # retrieve provider (env_aws) has priority
         creds = provider.retrieve()
         # assert provider credentials
         self.assertEqual(creds.access_key, "access_aws")
         self.assertEqual(creds.secret_key, "secret_aws")
         self.assertEqual(creds.session_token, "token_aws")
 
+    def test_chain_retrieve_failed_provider(self):
+        # clear environment
+        os.environ.clear()
+        # prepare env for env_minio
+        os.environ["MINIO_ACCESS_KEY"] = "access_minio"
+        os.environ["MINIO_SECRET_KEY"] = "secret_minio"
+        # create chain provider with env_aws and env_minio providers
+
+        provider = ChainedProvider(
+            [
+                EnvAWSProvider(), EnvMinioProvider(),
+            ]
+        )
+        # retrieve provider: (env_minio) will be retrieved
+        creds = provider.retrieve()
+        # assert provider credentials
+        self.assertEqual(creds.access_key, "access_minio")
+        self.assertEqual(creds.secret_key, "secret_minio")
+        self.assertEqual(creds.session_token, None)
+
 
 class EnvAWSProviderTest(TestCase):
     def test_env_aws_retrieve(self):

Reply via email to