MinIO: InvalidCredsError when trying to retrieve an object

オープン
#1,608 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
cloud

調査の方向性

tests/test_demo_bug.py から始め、pytest -k test_demo_InvalidCreds を使って失敗を再現します。s3.py 内の MinIO get_object を、特に S3Response.parse_error と HEAD リクエストを中心に追跡し、その後、アップロードしたオブジェクトの取得で InvalidCredsError が発生しないことを示す回帰テストのカバレッジを追加します。同時に、本物の認証情報エラーは引き続き識別できるようにします。

索引モデルが issue の本文から書いたものです。

説明

api: storage drivers: minio stale

Summary

When using the minio provider and getting an object, the method raises an libcloud.common.types.InvalidCredsError, despite the fact that it was able to create a container and upload it the object (so it doesn't look like a credential issue)
100% repro, code to repro the bug is provided

Detailed Information

libcloud: latest stable, 3.3.1
Python: 3.8.10
OS: Ubuntu 20.04

Here you can find a repo to repro the bug, using pytest (Actually there are 2 bugs to report):
https://github.com/Wenzel/libcloud_bug

$ pytest -k test_demo_InvalidCreds
__________________________________________________________________________________________ test_demo_InvalidCreds ___________________________________________________________________________________________

clean_minio_db = <libcloud.storage.drivers.minio.MinIOStorageDriver object at 0x7f76b6282a00>, tmp_path = PosixPath('/tmp/pytest-of-wenzel/pytest-22/test_demo_InvalidCreds0')

    def test_demo_InvalidCreds(clean_minio_db, tmp_path):
        # setup
        expected_data = b"data"
        with open(tmp_path / "file1.txt", "wb") as f:
            f.write(expected_data)
        adapter = clean_minio_db
        c = adapter.create_container("objects")
        # test
        ret = adapter.upload_object(tmp_path / "file1.txt", c, "file1")
>       obj = adapter.get_object(c, "file1")

tests/test_demo_bug.py:31: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.cache/pypoetry/virtualenvs/libcloud-bug-IT-EyGKG-py3.8/lib/python3.8/site-packages/libcloud/storage/drivers/s3.py:370: in get_object
    response = self.connection.request(object_path, method='HEAD')
../../.cache/pypoetry/virtualenvs/libcloud-bug-IT-EyGKG-py3.8/lib/python3.8/site-packages/libcloud/common/base.py:655: in request
    response = responseCls(**kwargs)
../../.cache/pypoetry/virtualenvs/libcloud-bug-IT-EyGKG-py3.8/lib/python3.8/site-packages/libcloud/common/base.py:166: in __init__
    message=self.parse_error(),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <libcloud.storage.drivers.s3.S3Response object at 0x7f76b6282700>

    def parse_error(self):
        if self.status in [httplib.UNAUTHORIZED, httplib.FORBIDDEN]:
>           raise InvalidCredsError(self.body)
E           libcloud.common.types.InvalidCredsError: ''

../../.cache/pypoetry/virtualenvs/libcloud-bug-IT-EyGKG-py3.8/lib/python3.8/site-packages/libcloud/storage/drivers/s3.py:138: InvalidCredsError
------------------------------------------------------------------------------------------- Captured stdout setup -------------------------------------------------------------------------------------------
ca19a7e29a92d875ec58b0285c854403ae5a95433a71e084011d32018a9141d1
----------------------------------------------------------------------------------------- Captured stdout teardown ------------------------------------------------------------------------------------------
libcloud_bug_objectmistmatch_miniodb
========================================================================================== short test summary info ==========================================================================================
FAILED tests/test_demo_bug.py::test_demo_InvalidCreds - libcloud.common.types.InvalidCredsError: ''

Thanks for your help !

主要言語
Python
スター
2.1k
フォーク
935
平均マージ
5日 3時間
マージ済み PR(30日)
15

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/libcloud のほかの issue

apache/libcloud の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。