mozilla-services / syncserver

Run-Your-Own Firefox Sync Server
Mozilla Public License 2.0
1.87k stars 145 forks source link

ConfigItems handled as list instead of string #54

Closed MrGid closed 6 years ago

MrGid commented 9 years ago

Hi everyone,

First I have to say I am no python dev, but in my installation it looks like the configurations are created as a list object and not as a string, so needed methods are not available.

sqluri = mysql://syncserver:***@localhost/syncserver

... [Thu Feb 26 06:33:41.929573 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/opt/syncserver/local/lib/python2.7/site-packages/syncstorage/init.py", line 18, in includeme [Thu Feb 26 06:33:41.929600 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] config.include("syncstorage.storage") [Thu Feb 26 06:33:41.929607 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/opt/syncserver/local/lib/python2.7/site-packages/pyramid/config/init.py", line 754, in include [Thu Feb 26 06:33:41.929616 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] c(configurator) [Thu Feb 26 06:33:41.929621 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/opt/syncserver/local/lib/python2.7/site-packages/syncstorage/storage/init.py", line 479, in includeme [Thu Feb 26 06:33:41.929712 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] storage = load_storage_from_settings("storage", settings) [Thu Feb 26 06:33:41.929726 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/opt/syncserver/local/lib/python2.7/site-packages/syncstorage/storage/init.py", line 503, in load_storage_from_settings [Thu Feb 26 06:33:41.929737 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] return klass(_section_settings) [Thu Feb 26 06:33:41.929743 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/opt/syncserver/local/lib/python2.7/site-packages/syncstorage/storage/sql/init.py", line 102, in init [Thu Feb 26 06:33:41.929925 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] self.dbconnector = DBConnector(sqluri, _dbkwds) [Thu Feb 26 06:33:41.929936 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/opt/syncserver/local/lib/python2.7/site-packages/syncstorage/storage/sql/dbconnect.py", line 240, in init [Thu Feb 26 06:33:41.930096 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] parsed_sqluri = urlparse.urlparse(sqluri) [Thu Feb 26 06:33:41.930106 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/usr/lib/python2.7/urlparse.py", line 572, in urlparse [Thu Feb 26 06:33:41.930257 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] tuple = urlsplit(url, scheme, allow_fragments) [Thu Feb 26 06:33:41.930266 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] File "/usr/lib/python2.7/urlparse.py", line 605, in urlsplit [Thu Feb 26 06:33:41.930276 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] cached = _parse_cache.get(key, None) [Thu Feb 26 06:33:41.930289 2015] [:error] [pid 2816] [remote 178.10.70.26:19959] TypeError: unhashable type: 'list'

Without configured sqluri the trim for the public_url fails

... [Thu Feb 26 06:38:23.754235 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] File "/opt/syncserver/syncserver/init.py", line 156, in main [Thu Feb 26 06:38:23.754243 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] config = get_configurator(global_config, settings) [Thu Feb 26 06:38:23.754248 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] File "/opt/syncserver/syncserver/init.py", line 148, in get_configurator [Thu Feb 26 06:38:23.754254 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] config.include(includeme) [Thu Feb 26 06:38:23.754258 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] File "/opt/syncserver/local/lib/python2.7/site-packages/pyramid/config/init.py", line 754, in include [Thu Feb 26 06:38:23.754265 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] c(configurator) [Thu Feb 26 06:38:23.754269 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] File "/opt/syncserver/syncserver/init**.py", line 30, in includeme [Thu Feb 26 06:38:23.754275 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] public_url = public_url.rstrip("/") [Thu Feb 26 06:38:23.754286 2015] [:error] [pid 2944] [remote 178.10.70.26:28255] AttributeError: 'list' object has no attribute 'rstrip'

I also tried to encase the values with ' ' and " " whithout any change of the issue.

is this caused in a missconfiguration?

cheers chris

rfk commented 9 years ago

Thanks for the report. IIRC there's some magic that auto-detects lists in the config file, but I'm surprised it's triggering in this case. Please post the full relevant config file (sans secrets etc), either here enclosed in triple-backquotes to preserve syntax, or via a pastebin at https://pastebin.mozilla.org/

rfk commented 9 years ago

Closing this out since we didn't hear back from the submitter; please feel free to re-open with the requested info if it's still a problem

Happyfeet01 commented 7 years ago

Hello,

i have the same error with the setup. Here is the complete output.

https://pastebin.mozilla.org/8980410

rfk commented 7 years ago

Hi @Happyfeet01, can you please share the contents of your config file, with secrets/password removed?

c0sco commented 6 years ago

I've run into this issue when I had a space before a config option, for example " allow_new_users = false" instead of "allow_new_users = false". You should be able to reproduce by editing syncserver.ini and adding a space at the beginning of an uncommented line.

rfk commented 6 years ago

I've run into this issue when I had a space before a config option, for example " allow_new_users = false" instead of "allow_new_users = false".

This makes sense, I guess it will treat the indented line as a continuation of the previous config setting and assemble the results into a list.

I'm not sure there's anything much we can do about that on the code side of things, but it's good to know this possible cause to help debugging similar problems in the future. Thanks!