google / upvote_py2

A multi-platform binary whitelisting solution
Apache License 2.0
452 stars 35 forks source link

ImportError on preflight call #14

Open jsharpe opened 6 years ago

jsharpe commented 6 years ago

Calling preflight gives a 500 error.

Backtrace:

ImportError: No module named pkg_resources at (/base/data/home/apps/e~upvote-xxx/santa-api:auto.411705267076089495/external/gcloud_bigquery_archive/google/cloud/bigquery/init.py:31) at (/base/data/home/apps/e~upvote-xxx/santa-api:auto.411705267076089495/upvote/gae/bigquery/tables.py:25) at (/base/data/home/apps/e~upvote-xxx/santa-api:auto.411705267076089495/upvote/gae/datastore/models/santa.py:21) at (/base/data/home/apps/e~upvote-xxx/santa-api:auto.411705267076089495/upvote/gae/datastore/models/rule.py:17) at (/base/data/home/apps/e~upvote-xxx/santa-api:auto.411705267076089495/upvote/gae/real_appengine_config.py:20) at (/base/data/home/apps/e~upvote-xxx/santa-api:auto.411705267076089495/appengine_config.py:10) at import_module (/base/alloc/tmpfs/dynamic_runtimes/python27/8882c914eb6132e9_unzipped/python27_dist/lib/python2.7/importlib/init.py:37) at initialize (/base/alloc/tmpfs/dynamic_runtimes/python27/8882c914eb6132e9_unzipped/python27_lib/versions/1/google/appengine/api/lib_config.py:165) at _update_configs (/base/alloc/tmpfs/dynamic_runtimes/python27/8882c914eb6132e9_unzipped/python27_lib/versions/1/google/appengine/api/lib_config.py:294) at getattr (/base/alloc/tmpfs/dynamic_runtimes/python27/8882c914eb6132e9_unzipped/python27_lib/versions/1/google/appengine/api/lib_config.py:358) at Handle (/base/alloc/tmpfs/dynamic_runtimes/python27/8882c914eb6132e9_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:240)

msuozzo commented 6 years ago

Yep this is an issue with the recent version update we did with the Bigquery library.

As a mitigation, you should be able to add a file to the top-level directory and add it to the main BUILD rule.

# ./pkg_resources.py
def get_distribution(name):
  fake_dist = object()
  setattr(fake_dist, 'version', '1.1.0')
  return fake_dist

We'll work on getting an actual solution out in the near future.

Thanks for the report!

thehesiod commented 6 years ago

I haven't figured out how to do this, I put a file at the root of upvote and I still get the error. I even tried adding setuptools as an external library. Does anyone know how to do this?

thehesiod commented 6 years ago

ok, finally fixed it: https://github.com/farmersbusinessnetwork/upvote/commit/e9dbe133b78b918b91ebf48b77d2080f112da3bc