From 7b763dc487f129926d37722dad94a0924866ee77 Mon Sep 17 00:00:00 2001 From: Jochen Maes Date: Fri, 14 Jun 2013 07:28:24 +0200 Subject: [PATCH] adds 2 django commands (migrate, collectstatic) Signed-off-by: Jochen Maes --- library/web_infrastructure/django_manage | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/library/web_infrastructure/django_manage b/library/web_infrastructure/django_manage index ae77c36b3d1..eb766c6a0b0 100644 --- a/library/web_infrastructure/django_manage +++ b/library/web_infrastructure/django_manage @@ -28,7 +28,7 @@ description: version_added: "1.1" options: command: - choices: [ 'cleanup', 'flush', 'loaddata', 'runfcgi', 'syncdb', 'test', 'validate' ] + choices: [ 'cleanup', 'flush', 'loaddata', 'runfcgi', 'syncdb', 'test', 'validate', 'migrate', 'collectstatic' ] description: - The name of the Django management command to run. Allowed commands are cleanup, createcachetable, flush, loaddata, syncdb, test, validate. required: true @@ -70,10 +70,24 @@ options: description: - A space-delimited list of fixture file names to load in the database. B(Required) by the 'loaddata' command. required: false + skip: + description: + - Will skip over out-of-order missing migrations, you can only use this parameter with I(migrate) + required: false + merge: + description: + - Will run out-of-order or missing migrations as they are not rollback migrations, you can only use this parameter with 'migrate' command + required: false + link: + description: + - Will create links to the files instead of copying them, you can only use this parameter with 'collectstatic' command + required: false notes: - I(virtualenv) (U(http://www.virtualenv.org)) must be installed on the remote host if the virtualenv parameter is specified. - This module will create a virtualenv if the virtualenv parameter is specified and a virtualenv does not already exist at the given location. - This module assumes English error messages for the 'createcachetable' command to detect table existence, unfortunately. + - To be able to use the migrate command, you must have south installed and added as an app in your settings + - To be able to use the collectstatic command, you must have enabled staticfiles in your settings requirements: [ "virtualenv", "django" ] author: Scott Anderson ''' @@ -150,6 +164,8 @@ def main(): syncdb=('database', ), test=('failfast', 'testrunner', 'liveserver', 'apps', ), validate=(), + migrate=('apps', 'skip', 'database', 'merge'), + collectstatic=('link', ), ) command_required_param_map = dict( @@ -162,6 +178,7 @@ def main(): 'flush', 'syncdb', 'test', + 'collectstatic', ) # These params are allowed for certain commands only @@ -169,7 +186,7 @@ def main(): # These params are automatically added to the command if present general_params = ('settings', 'pythonpath', ) - specific_boolean_params = ('failfast', ) + specific_boolean_params = ('failfast', 'skip', 'merge', 'link' ) end_of_command_params = ('apps', 'cache_table', 'fixtures', ) module = AnsibleModule( @@ -187,6 +204,9 @@ def main(): fixtures = dict(default=None, required=False), liveserver = dict(default=None, required=False, aliases=['live_server']), testrunner = dict(default=None, required=False, aliases=['test_runner']), + skip = dict(default=None, required=False, choices=BOOLEANS), + merge = dict(default=None, required=False, choices=BOOLEANS), + link = dict(default=None, required=False, choices=BOOLEANS), ), )