lyft / metadataproxy

A proxy for AWS's metadata service that gives out scoped IAM credentials from STS
Other
456 stars 69 forks source link

FileExistsError is not defined in python 2.x #96

Closed arudnev closed 4 years ago

arudnev commented 4 years ago

When restarting container based on lyft/metadataproxy:2.0.0 we are sometimes getting the following in the logs and container fails to start:

Failed to read config file: /etc/gunicorn/gunicorn.conf
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 106, in get_config_from_filename
    execfile_(filename, cfg, cfg)
  File "/usr/local/lib/python2.7/site-packages/gunicorn/_compat.py", line 91, in execfile_
    return execfile(fname, *args)
  File "/etc/gunicorn/gunicorn.conf", line 54, in <module>
    except FileExistsError:
NameError: name 'FileExistsError' is not defined

This happens due to the following reference to FileExistsError, which presumably does not exist in python 2.7.1:

https://github.com/lyft/metadataproxy/blob/1f67dec669cef9f37c3cc1c380ded22015760228/config/gunicorn.conf#L54

To reproduce something like this can be used:

docker run --rm lyft/metadataproxy:2.0.0 sh -c "mkdir -p /run/gunicorn && /bin/sh run-server.sh"
ryan-lane commented 4 years ago

Ah. This should be OSError.

ryan-lane commented 4 years ago

Thanks for the bug report!

ryan-lane commented 4 years ago

Just released in 2.1.0