Skip to content

"failsafe" parameter not working for check_credentials #1

@nabinkhadka

Description

@nabinkhadka

For case with incorrect creds in the URL, I can see the following

>>> from kiwixstorage import KiwixStorage
>>> s3_storage = KiwixStorage('https://s3.eu-central-1.wasabisys.com/?keyId=XXXXX&secretAccessKey=XXXXXX&bucketName=testbucket-nabin')
>>>s3_storage.check_credentials(list_buckets=True, failsafe=True)
False

In this case, the failsafe command works as expected.

Now , if I check for access to the bucket in URL,

>>> s3_storage.check_credentials(bucket=True, failsafe=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 331, in check_credentials
    self.test_access_bucket(bucket_name=bucket_name)
  File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/kiwixstorage/__init__.py", line 277, in test_access_bucket
    if self.get_bucket(bucket_name).creation_date is None:
  File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/boto3/resources/factory.py", line 339, in property_loader
    self.load()
  File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/boto3/s3/inject.py", line 72, in bucket_load
    response = self.meta.client.list_buckets()
  File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/nabin/upwork/kiwix/v3.8/lib/python3.8/site-packages/botocore/client.py", line 626, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (SignatureDoesNotMatch) when calling the ListBuckets operation: The request signature we calculated does not match the signature you provided. Check your key and signing method.

The failsafe parameter does not work as expected. Similar behavior can be seen for other checks as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions