diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2015-05-09 19:46:20 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander.sulfrian@fu-berlin.de> | 2015-09-21 18:11:10 +0200 |
commit | b905d6de1989bad49cc27aa9a15899160b3cb9f1 (patch) | |
tree | 104448ec767c936da54c22a17f8b08625a497a3b /src/lib/Bcfg2/Server/Admin.py | |
parent | 04c357d9bba17696af0ce47bd20c4898527b6ca2 (diff) | |
download | bcfg2-b905d6de1989bad49cc27aa9a15899160b3cb9f1.tar.gz bcfg2-b905d6de1989bad49cc27aa9a15899160b3cb9f1.tar.bz2 bcfg2-b905d6de1989bad49cc27aa9a15899160b3cb9f1.zip |
bcfg2-admin: Add command to generate migrations
Add makemigration for django>1.7 or schemamigration for django<=1.6 with south.
Diffstat (limited to 'src/lib/Bcfg2/Server/Admin.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Admin.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Admin.py b/src/lib/Bcfg2/Server/Admin.py index c294e6be5..a17aeca62 100644 --- a/src/lib/Bcfg2/Server/Admin.py +++ b/src/lib/Bcfg2/Server/Admin.py @@ -877,6 +877,7 @@ if HAS_DJANGO: Django management system """ command = None args = [] + kwargs = {} def run(self, _): '''Call a django command''' @@ -885,7 +886,7 @@ if HAS_DJANGO: else: command = self.__class__.__name__.lower() args = [command] + self.args - management.call_command(*args) + management.call_command(*args, **self.kwargs) class DBShell(_DjangoProxyCmd): """ Call the Django 'dbshell' command on the database """ @@ -915,6 +916,17 @@ if HAS_DJANGO: self.logger.error("Database update failed: %s" % err) raise SystemExit(1) + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + class Makemigrations(_DjangoProxyCmd): + """ Call the 'makemigrations' command on the database """ + args = ['Reporting'] + + else: + class Schemamigration(_DjangoProxyCmd): + """ Call the South 'schemamigration' command on the database """ + args = ['Bcfg2.Reporting'] + kwargs = {'auto': True} + if HAS_REPORTS: import datetime |