adds 2 django commands (migrate, collectstatic)

Signed-off-by: Jochen Maes <jochen@sejo-it.be>
This commit is contained in:
Jochen Maes 2013-06-14 07:28:24 +02:00 committed by Michael DeHaan
parent 78a10dce8f
commit 0830376b0b

View file

@ -28,7 +28,7 @@ description:
version_added: "1.1" version_added: "1.1"
options: options:
command: command:
choices: [ 'cleanup', 'flush', 'loaddata', 'runfcgi', 'syncdb', 'test', 'validate' ] choices: [ 'cleanup', 'flush', 'loaddata', 'runfcgi', 'syncdb', 'test', 'validate', 'migrate', 'collectstatic' ]
description: description:
- The name of the Django management command to run. Allowed commands are cleanup, createcachetable, flush, loaddata, syncdb, test, validate. - The name of the Django management command to run. Allowed commands are cleanup, createcachetable, flush, loaddata, syncdb, test, validate.
required: true required: true
@ -70,10 +70,24 @@ options:
description: description:
- A space-delimited list of fixture file names to load in the database. B(Required) by the 'loaddata' command. - A space-delimited list of fixture file names to load in the database. B(Required) by the 'loaddata' command.
required: false 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: notes:
- I(virtualenv) (U(http://www.virtualenv.org)) must be installed on the remote host if the virtualenv parameter is specified. - 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 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. - 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" ] requirements: [ "virtualenv", "django" ]
author: Scott Anderson author: Scott Anderson
''' '''
@ -150,6 +164,8 @@ def main():
syncdb=('database', ), syncdb=('database', ),
test=('failfast', 'testrunner', 'liveserver', 'apps', ), test=('failfast', 'testrunner', 'liveserver', 'apps', ),
validate=(), validate=(),
migrate=('apps', 'skip', 'database', 'merge'),
collectstatic=('link', ),
) )
command_required_param_map = dict( command_required_param_map = dict(
@ -162,6 +178,7 @@ def main():
'flush', 'flush',
'syncdb', 'syncdb',
'test', 'test',
'collectstatic',
) )
# These params are allowed for certain commands only # These params are allowed for certain commands only
@ -169,7 +186,7 @@ def main():
# These params are automatically added to the command if present # These params are automatically added to the command if present
general_params = ('settings', 'pythonpath', ) general_params = ('settings', 'pythonpath', )
specific_boolean_params = ('failfast', ) specific_boolean_params = ('failfast', 'skip', 'merge', 'link' )
end_of_command_params = ('apps', 'cache_table', 'fixtures', ) end_of_command_params = ('apps', 'cache_table', 'fixtures', )
module = AnsibleModule( module = AnsibleModule(
@ -187,6 +204,9 @@ def main():
fixtures = dict(default=None, required=False), fixtures = dict(default=None, required=False),
liveserver = dict(default=None, required=False, aliases=['live_server']), liveserver = dict(default=None, required=False, aliases=['live_server']),
testrunner = dict(default=None, required=False, aliases=['test_runner']), 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),
), ),
) )