From 0b86a686aa3ffaefa74dbb124745ae0d3476d65b Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Tue, 3 Feb 2015 09:00:10 +0100 Subject: [PATCH] Remove the --dbaction option from the deploy command. --- doc/extending/getting_started.rst | 2 +- doc/getting_started/install.rst | 2 +- doc/getting_started/upgrade.rst | 2 +- modoboa/core/commands/deploy.py | 28 +++++++++------------------- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/doc/extending/getting_started.rst b/doc/extending/getting_started.rst index 7e773d1fe..3ef89ab9b 100644 --- a/doc/extending/getting_started.rst +++ b/doc/extending/getting_started.rst @@ -42,7 +42,7 @@ Deploy an instance for development Now that you have a :ref:`running environment `, you're ready to deploy a test instance:: - $ modoboa-admin.py deploy --dbaction install --devel --dburl + $ modoboa-admin.py deploy --devel --dburl $ cd $ python manage.py runserver diff --git a/doc/getting_started/install.rst b/doc/getting_started/install.rst index b8b12f323..4cb528003 100644 --- a/doc/getting_started/install.rst +++ b/doc/getting_started/install.rst @@ -94,7 +94,7 @@ Deployment `modoboa-admin.py`, a command line tool, lets you deploy a *ready-to-use* Modoboa site using only one instruction:: - $ modoboa-admin.py deploy modoboa_example --dbaction install --collectstatic [--with-amavis] [--dburl database-url] [--amavis_dburl database-url] + $ modoboa-admin.py deploy modoboa_example --collectstatic [--with-amavis] [--dburl database-url] [--amavis_dburl database-url] Just answer the few questions and you're done. You can now go to the :ref:`first_use` section. diff --git a/doc/getting_started/upgrade.rst b/doc/getting_started/upgrade.rst index 3cbb49fa0..230ad644a 100644 --- a/doc/getting_started/upgrade.rst +++ b/doc/getting_started/upgrade.rst @@ -35,7 +35,7 @@ your instance was first deployed:: Then, run ``modoboa-admin.py deploy``:: - $ modoboa-admin.py deploy --dbaction upgrade --collectstatic [--with-amavis] [--dburl database-url] [--amavis_dburl database-url] [--domain hostname] [--lang lang] [--timezone timezone] + $ modoboa-admin.py deploy --collectstatic [--with-amavis] [--dburl database-url] [--amavis_dburl database-url] [--domain hostname] [--lang lang] [--timezone timezone] If you prefer the manual way, check if :ref:`specific_upgrade_instructions` are required according to the diff --git a/modoboa/core/commands/deploy.py b/modoboa/core/commands/deploy.py index 4bcbd7e9a..e3802e229 100644 --- a/modoboa/core/commands/deploy.py +++ b/modoboa/core/commands/deploy.py @@ -1,4 +1,7 @@ # coding: utf-8 + +"""A shortcut to deploy a fresh modoboa instance.""" + import getpass import os import shutil @@ -12,7 +15,6 @@ from django.template import Context, Template import dj_database_url -from modoboa.lib.sysutils import exec_cmd from modoboa.core.commands import Command DBCONN_TPL = """ @@ -47,10 +49,6 @@ class DeployCommand(Command): '--with-amavis', action='store_true', default=False, help='Include amavis configuration' ) - self._parser.add_argument( - '--dbaction', type=str, default="install", - help='Action to take on the database (install|upgrade)' - ) self._parser.add_argument( '--collectstatic', action='store_true', default=False, help='Run django collectstatic command' @@ -215,24 +213,16 @@ class DeployCommand(Command): os.mkdir("%s/media" % parsed_args.name) os.unlink("%s/settings.pyc" % path) - if parsed_args.dbaction == "install": - self._exec_django_command( - "migrate", parsed_args.name, '--noinput' - ) - self._exec_django_command( - "load_initial_data", parsed_args.name - ) - elif parsed_args.dbaction == "upgrade": - exec_cmd('sed -ri "s|^#(\s+\'south)|\\1|" %s/settings.py' % path) - self._exec_django_command( - "syncdb", parsed_args.name, "--migrate" - ) - + self._exec_django_command( + "migrate", parsed_args.name, '--noinput' + ) + self._exec_django_command( + "load_initial_data", parsed_args.name + ) if parsed_args.collectstatic: self._exec_django_command( "collectstatic", parsed_args.name, '--noinput' ) - self._exec_django_command( "set_default_site", parsed_args.name, allowed_host )