askbot-setup returns invalid --db-engine choice: 2

asked 2020-11-27 04:57:18 -0500

chris710's avatar

I'm trying to create a new docker image with the latest version of Askbot. I'm running into a problem, when executing askbot-setup step with --db-engine option. Documentation states that it should contain value from 1-4, but actually running the command returns the following error:

Step 6/16 : RUN askbot-setup -n /app -e 2 -d /data/askbot.db
 ---> Running in 879c02131d2a
usage: askbot-setup [-h] [--root-directory ROOT_DIR] [--proj-name PROJ_NAME]
                    [--media-root MEDIA_ROOT] [--static-root STATIC_ROOT]
                    [--force] [--noinput] [--db-settings DATABASE_SETTINGS]
                    [--db-engine {postgresql,sqlite,mysql,oracle}]
                    [--db-name DATABASE_NAME] [--db-user DATABASE_USER]
                    [--db-password DATABASE_PASSWORD]
                    [--db-host DATABASE_HOST] [--db-port DATABASE_PORT]
                    [--admin-name ADMIN_NAME] [--admin-email ADMIN_EMAIL]
                    [--domain-name DOMAIN_NAME]
                    [--language-code LANGUAGE_CODE] [--timezone TIMEZONE]
                    [--log-file-path LOG_FILE_PATH]
                    [--email-settings EMAIL_SETTINGS]
                    [--server-email SERVER_EMAIL]
                    [--default-from-email DEFAULT_FROM_EMAIL]
                    [--email-host-user EMAIL_HOST_USER]
                    [--email-host-password EMAIL_HOST_PASSWORD]
                    [--email-subject-prefix EMAIL_SUBJECT_PREFIX]
                    [--email-host EMAIL_HOST] [--email-port EMAIL_PORT]
                    [--email-use-tls] [--email-backend EMAIL_BACKEND]
                    [--admin-settings ADMIN_SETTINGS]
                    [--language-settings LANGUAGE_SETTINGS]
                    [--logging-settings LOGGING_SETTINGS]
                    [--caching-settings CACHING_SETTINGS]
                    [--append-settings EXTRA_SETTINGS]
askbot-setup: error: argument --db-engine/-e: invalid choice: 2 (choose from 'postgresql', 'sqlite', 'mysql', 'oracle')
The command '/bin/sh -c askbot-setup -n /app -e 2 -d /data/askbot.db' returned a non-zero code: 2

When I try sqlite as an option I get the following:

Step 6/16 : RUN askbot-setup -n /app -e sqlite -d /data/askbot.db
 ---> Running in 54cca2d966da
usage: askbot-setup [-h] [--root-directory ROOT_DIR] [--proj-name PROJ_NAME]
                    [--media-root MEDIA_ROOT] [--static-root STATIC_ROOT]
                    [--force] [--noinput] [--db-settings DATABASE_SETTINGS]
                    [--db-engine {postgresql,sqlite,mysql,oracle}]
                    [--db-name DATABASE_NAME] [--db-user DATABASE_USER]
                    [--db-password DATABASE_PASSWORD]
                    [--db-host DATABASE_HOST] [--db-port DATABASE_PORT]
                    [--admin-name ADMIN_NAME] [--admin-email ADMIN_EMAIL]
                    [--domain-name DOMAIN_NAME]
                    [--language-code LANGUAGE_CODE] [--timezone TIMEZONE]
                    [--log-file-path LOG_FILE_PATH]
                    [--email-settings EMAIL_SETTINGS]
                    [--server-email SERVER_EMAIL]
                    [--default-from-email DEFAULT_FROM_EMAIL]
                    [--email-host-user EMAIL_HOST_USER]
                    [--email-host-password EMAIL_HOST_PASSWORD]
                    [--email-subject-prefix EMAIL_SUBJECT_PREFIX]
                    [--email-host EMAIL_HOST] [--email-port EMAIL_PORT]
                    [--email-use-tls] [--email-backend EMAIL_BACKEND]
                    [--admin-settings ADMIN_SETTINGS]
                    [--language-settings LANGUAGE_SETTINGS]
                    [--logging-settings LOGGING_SETTINGS]
                    [--caching-settings CACHING_SETTINGS]
                    [--append-settings EXTRA_SETTINGS]
askbot-setup: error: argument --db-engine/-e: invalid int value: 'sqlite'
The command '/bin/sh -c askbot-setup -n /app -e sqlite -d /data/askbot.db' returned a non-zero code: 2

I took a peek in the source code and found out that in file askbot-devel/askbot/deployment/\__init\__.py it expects in fact an integer value:

self.parser.add_argument(
        '--db-engine', '-e',
        dest='database_engine',
        action='store',
        choices=[eng[0] for eng in const.DATABASE_ENGINE_CHOICES],
        type=int,
        help=const.DATABASE_ENGINE_HELP
    )

The same problem happens when trying to execute askbot-setup command installed locally. However, running the instruction in interactive mode (with console input) returns no such error.

Did you manage to run the command successfully? Is there something that can be done?

edit retag flag offensive close merge delete