ioda-net / geo-api3

Backend from geoadmin/mf-chsdi3
Other
2 stars 0 forks source link

pyramid 1.9 has broken parts #61

Open tigerfoot opened 6 years ago

tigerfoot commented 6 years ago

Since pyramid 1.9 (and newer paste-deploy) there's an error in parsing our configuration

Starting monitor for PID 3880.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.6/site-packages/hupper/ipc.py", line 322, in spawn_main
    func(**kwargs)
  File "/usr/lib/python3.6/site-packages/hupper/worker.py", line 237, in worker_main
    func(*spec_args, **spec_kwargs)
  File "/usr/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 32, in main
    return command.run()
  File "/usr/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 229, in run
    app = loader.get_wsgi_app(app_name, config_vars)
  File "/usr/lib/python3.6/site-packages/plaster_pastedeploy/__init__.py", line 131, in get_wsgi_app
    global_conf=defaults)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 271, in loadobj
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
    return loader.get_context(object_type, name, global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 454, in get_context
    section)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 476, in _context_from_use
    object_type, name=use, global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 406, in get_context
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
    return loader.get_context(object_type, name, global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 413, in get_context
    defaults = self.parser.defaults()
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 68, in defaults
    defaults[key] = self.get('DEFAULT', key) or val
  File "/usr/lib64/python3.6/configparser.py", line 800, in get
    d)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 95, in before_get
    value, defaults)
  File "/usr/lib64/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/lib64/python3.6/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: Error in file /ioda/home/bruno/git/geo/geo-api3/production.ini: '%' must be followed by '%' or '(', found: '%s %s'
Server with PID 3880 exited with code 1.
Waiting for changes before reloading.

Or formatter_generic line is almost the same as the one in [https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html, documentation]

format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

Trying pserve development.ini

pserve development.ini
Traceback (most recent call last):
  File "/usr/bin/pserve", line 11, in <module>
    load_entry_point('pyramid==1.9.1', 'console_scripts', 'pserve')()
  File "/usr/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 32, in main
    return command.run()
  File "/usr/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 229, in run
    app = loader.get_wsgi_app(app_name, config_vars)
  File "/usr/lib/python3.6/site-packages/plaster_pastedeploy/__init__.py", line 131, in get_wsgi_app
    global_conf=defaults)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 271, in loadobj
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
    return loader.get_context(object_type, name, global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 454, in get_context
    section)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 476, in _context_from_use
    object_type, name=use, global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 406, in get_context
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 296, in loadcontext
    global_conf=global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 320, in _loadconfig
    return loader.get_context(object_type, name, global_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 413, in get_context
    defaults = self.parser.defaults()
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 68, in defaults
    defaults[key] = self.get('DEFAULT', key) or val
  File "/usr/lib64/python3.6/configparser.py", line 800, in get
    d)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 95, in before_get
    value, defaults)
  File "/usr/lib64/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/lib64/python3.6/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: Error in file /ioda/home/bruno/git/geo/geo-api3/production.ini: '%' must be followed by '%' or '(', found: '%s %s'
Jenselme commented 6 years ago

Strange. Running pserve production.ini works.

It looks like the loading from another ini file is broken. By changing use = config:production.ini into use = egg:geo_api3 and by duplicating keys from production.ini not present in development.ini I can make it work again.

This can be a temporary solution until there is a proper fix upstream. I tried to downgrade PasteDeploy but it had no effect. Downgrading pyramid to 1.8.5 fixed it correctly. I also tried to install pyramid from master with pip install 'git+https://github.com/Pylons/pyramid.git' but the bug is still here.

Perhaps you can try the IRC channel pyramid or open an issue on github.

mmerickel commented 6 years ago

Is this still an issue? There were some problems at one point because plaster_pastedeploy was injecting environment variables into the config which caused some interpolation problems but that has since been fixed.