-
-
Notifications
You must be signed in to change notification settings - Fork 915
Closed
Description
Steps to reproduce:
-
Build a Docker image
# Dockerfile FROM ubuntu:20.04 RUN apt-get update && apt-get install -y s3cmd
$ docker build . -t my-image -
Create a docker container with just
AWS_ACCESS_KEY_IDbut notAWS_SECRET_ACCESS_KEYset.$ docker run --rm -it --env AWS_ACCESS_KEY_ID=1234567800000 my-image /bin/bash
-
Verify the ENV variables in question.
root@730f1ea70045:/# echo $AWS_ACCESS_KEY_ID 1234567800000 root@730f1ea70045:/# echo $AWS_SECRET_ACCESS_KEY root@730f1ea70045:/#
-
Run
$ s3cmd --configureroot@730f1ea70045:/# s3cmd --configure
Actual behavior:
root@730f1ea70045:/# s3cmd --configure
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
An unexpected error has occurred.
Please try reproducing the error using
the latest s3cmd code from the git master
branch found at:
https://github.com/s3tools/s3cmd
and have a look at the known issues list:
https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions
If the error persists, please report the
following lines (removing any private
info as necessary) to:
s3tools-bugs@lists.sourceforge.net
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Invoked as: /usr/bin/s3cmd --configure
Problem: <class 'TypeError: decoding to str: need a bytes-like object, NoneType found
S3cmd: 2.0.2
python: 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0]
Traceback (most recent call last):
File "/usr/bin/s3cmd", line 3092, in <module>
rc = main()
File "/usr/bin/s3cmd", line 2792, in main
cfg = Config(options.config, options.access_key, options.secret_key, options.access_token)
File "/usr/lib/python3/dist-packages/S3/Config.py", line 239, in __init__
self.secret_key = config_unicodise(env_secret_key)
File "/usr/lib/python3/dist-packages/S3/Config.py", line 49, in config_unicodise
return unicode(string, encoding, errors)
TypeError: decoding to str: need a bytes-like object, NoneType found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/s3cmd", line 3172, in <module>
report_exception(e)
File "/usr/bin/s3cmd", line 3047, in report_exception
sys.stderr.write(u"environment LANG=%s\n" % unicodise_s(os.getenv("LANG"), 'ascii'))
File "/usr/lib/python3/dist-packages/S3/Utils.py", line 321, in unicodise_s
return unicodise(string, encoding, errors, True)
File "/usr/lib/python3/dist-packages/S3/Utils.py", line 312, in unicodise
return unicode(string, encoding, errors)
TypeError: decoding to str: need a bytes-like object, NoneType foundExpected behavior:
It should fail gracefully. Best, only picking up the Access Key from env variables while asking the Secret Key without prefilled value.
Regards,
Martin