关于让 Google KMS与 App Engine 一起工作的问题,我提出了一个关于相关但有问题的副作用的新问题。
也就是说,Google Cloud API 发现似乎想要在 AppEngine 沙箱之外走多条路径。这本身不是问题,但它使测试和调试非常有问题,因为每次尝试都会被记录下来,产生数百行如下所示:
信息 2017 年 7 月 3 日 14:44:51 沙盒阻止访问文件“/用户”
INFO 2017 年 7 月 3 日 14:44:51 如果它是静态文件,请检查
application_readable: true
您的 app.yaml 中是否设置了该文件信息 2017 年 7 月 3 日 14:44:52 沙盒阻止访问文件“/usr/lib/Acrobat9/Resource/CMap”
INFO 2017 年 7 月 3 日 14:44:52 如果它是静态文件,请检查
application_readable: true
在您的 app.yaml 中设置信息 2017 年 7 月 3 日 14:44:52 沙盒阻止访问文件“/usr/lib/Acrobat8/Resource/CMap”
INFO 2017 年 7 月 3 日 14:44:52 如果它是静态文件,请检查
application_readable: true
在您的 app.yaml 中设置
有没有办法禁用或静音这些请求或日志?
编辑*traceback.print_stack()
通过添加到log_access_check_fail
in打印的众多结果之一stub.py
(抱歉,这里不是很清晰):
测试 #1:Sentry.io 的 Raven 导入pkg_resources
File "/Users/bmh/testapp/application.py", line 3, in <module>
from nassau.application import app, sentry
File "/Users/bmh/testapp/nassau/application.py", line 28, in <module>
from raven.contrib.flask import Sentry
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/raven/__init__.py", line 16, in <module>
VERSION = __import__('pkg_resources') \
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3037, in <module>
@_call_aside
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3021, in _call_aside
f(*args, **kwargs)
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3050, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 646, in _build_master
ws = cls()
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 639, in __init__
self.add_entry(entry)
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 695, in add_entry
for dist in find_distributions(entry, True):
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2006, in find_on_path
path_item = _normalize_cached(path_item)
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2217, in _normalize_cached
_cache[filename] = result = normalize_path(filename)
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2210, in normalize_path
return os.path.normcase(os.path.realpath(filename))
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/posixpath.py", line 375, in realpath
path, ok = _joinrealpath('', filename, {})
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/posixpath.py", line 400, in _joinrealpath
if not islink(newpath):
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/posixpath.py", line 135, in islink
st = os.lstat(path)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", line 286, in __call__
log_access_check_fail(path)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", line 51, in log_access_check_fail
traceback.print_stack()
我删除了对 Sentry / Raven 的依赖,但堆栈跟踪继续,通过:
测试 #2:Flask 导入pkgutil
File "/Users/bmh/testapp/application.py", line 3, in <module>
from nassau.application import app
File "/Users/bmh/testapp/nassau/application.py", line 72, in <module>
app = Flask('nassau')
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/flask/app.py", line 331, in __init__
instance_path = self.auto_find_instance_path()
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/flask/app.py", line 622, in auto_find_instance_path
prefix, package_path = find_package(self.import_name)
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/site-packages/flask/helpers.py", line 661, in find_package
loader = pkgutil.get_loader(root_mod_name)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 464, in get_loader
return find_loader(fullname)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 475, in find_loader
loader = importer.find_module(fullname)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 184, in find_module
path = [os.path.realpath(self.path)]
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/posixpath.py", line 375, in realpath
path, ok = _joinrealpath('', filename, {})
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/posixpath.py", line 400, in _joinrealpath
if not islink(newpath):
File "/Users/bmh/testapp/python-virtualenv/lib/python2.7/posixpath.py", line 135, in islink
st = os.lstat(path)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", line 286, in __call__
log_access_check_fail(path)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", line 51, in log_access_check_fail
traceback.print_stack()
必须有更好的方法来表示堆栈溢出时的堆栈跟踪:)