JanLuca / ansible-mailman3

1 stars 1 forks source link

SyntaxError: invalid syntax during 'Migrate Django-DB' #4

Closed theodotos closed 6 years ago

theodotos commented 6 years ago

Hi. I am trying to setup Mailman3 but I get this during the 'Migrate Django-DB' task:

fatal: [lists.example.com]: FAILED! =>
{
    "changed": true,
    "cmd": [
        "/srv/mailman/manage.py",
        "migrate",
        "--no-input"
    ],
    "delta": "0:00:00.329315",
    "end": "2018-04-04 10:20:04.843349",
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2018-04-04 10:20:04.514034",
    "stderr": "Traceback (most recent call last):\n  File \"/srv/mailman/manage.py\", line 11, in <module>\n    execute_from_command_line(sys.argv)\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 367, in execute_from_command_line\n    utility.execute()\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 316, in execute\n    settings.INSTALLED_APPS\n  File \"/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py\", line 53, in __getattr__\n    self._setup(name)\n  File \"/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py\", line 41, in _setup\n    self._wrapped = Settings(settings_module)\n  File \"/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py\", line 97, in __init__\n    mod = importlib.import_module(self.SETTINGS_MODULE)\n  File \"/usr/lib/python2.7/importlib/__init__.py\", line 37, in import_module\n    __import__(name)\n  File \"/srv/mailman/settings.py\", line 498, in <module>\n    from settings_local import *\n  File \"/srv/mailman/settings_local.py\", line 3\n    SECRET_KEY = '[u'1234567890123456789012']'\n                                                    ^\nSyntaxError: invalid syntax",
    "stderr_lines": [
        "Traceback (most recent call last):",
        "  File \"/srv/mailman/manage.py\", line 11, in <module>",
        "    execute_from_command_line(sys.argv)",
        "  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 367, in execute_from_command_line",
        "    utility.execute()",
        "  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 316, in execute",
        "    settings.INSTALLED_APPS",
        "  File \"/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py\", line 53, in __getattr__",
        "    self._setup(name)",
        "  File \"/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py\", line 41, in _setup",
        "    self._wrapped = Settings(settings_module)",
        "  File \"/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py\", line 97, in __init__",
        "    mod = importlib.import_module(self.SETTINGS_MODULE)",
        "  File \"/usr/lib/python2.7/importlib/__init__.py\", line 37, in import_module",
        "    __import__(name)",
        "  File \"/srv/mailman/settings.py\", line 498, in <module>",
        "    from settings_local import *",
        "  File \"/srv/mailman/settings_local.py\", line 3",
        "    SECRET_KEY = '[u'1234567890123456789012']'",
        "                                                                              ^",
        "SyntaxError: invalid syntax"
    ],
    "stdout": "",
    "stdout_lines": []
}

Running a syntax check on the candidate Mailman3 host I get:

$ python -m py_compile settings_local.py 
  File "settings_local.py", line 3
    SECRET_KEY = '[u'1234567890123456789012']'
                                                                              ^
SyntaxError: invalid syntax

Python version on the mailman host is 2.7.13

Any idea?

fabianfreyer commented 6 years ago

From the traceback, it seems like you are setting the mailman_production_secret_key as a list, not as a string. This should be a string, along the lines of:

mailman_production_secret_key: '1234567890123456789012'
theodotos commented 6 years ago

Yes, you are right! It works now, my fault.

Thanks @JanLuca !