From 650623f8f5425ac4b629d19a1d4db79459d4f43e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 27 Jan 2015 19:24:59 +0100 Subject: DBSettings: Add possibility to specify arbitrary django options. --- doc/man/bcfg2.conf.txt | 5 +++++ man/bcfg2.conf.5 | 5 +++++ src/lib/Bcfg2/DBSettings.py | 9 ++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doc/man/bcfg2.conf.txt b/doc/man/bcfg2.conf.txt index 62c4ac1a8..2f014812e 100644 --- a/doc/man/bcfg2.conf.txt +++ b/doc/man/bcfg2.conf.txt @@ -718,6 +718,11 @@ Reporting options Maximum number of children for the reporting collector. Use 0 to disable the limit. (default is 0) + django_settings + Arbitrary options for the Django installation. The value expected + is a literal python dictionary, that is merged with the already set + django settings. + See Also -------- diff --git a/man/bcfg2.conf.5 b/man/bcfg2.conf.5 index 13000a719..ba5158a0d 100644 --- a/man/bcfg2.conf.5 +++ b/man/bcfg2.conf.5 @@ -778,6 +778,11 @@ Turn on Django debugging. .B max_children Maximum number of children for the reporting collector. Use 0 to disable the limit. (default is 0) +.TP +.B django_settings +Arbitrary options for the Django installation. The value expected +is a literal python dictionary, that is merged with the already set +django settings. .UNINDENT .UNINDENT .UNINDENT diff --git a/src/lib/Bcfg2/DBSettings.py b/src/lib/Bcfg2/DBSettings.py index 1c8c34978..3e101405d 100644 --- a/src/lib/Bcfg2/DBSettings.py +++ b/src/lib/Bcfg2/DBSettings.py @@ -123,6 +123,9 @@ def finalize_django_config(opts=None, silent=False): opts.web_prefix.rstrip('/') + \ settings['MEDIA_URL'] + if opts.django_settings: + settings.update(opts.django_settings) + logger = logging.getLogger() logger.debug("Finalizing Django settings: %s" % settings) @@ -265,7 +268,11 @@ class _OptionContainer(object): Bcfg2.Options.BooleanOption( cf=('reporting', 'web_debug'), help='Django debug'), Bcfg2.Options.Option( - cf=('reporting', 'web_prefix'), help='Web prefix')] + cf=('reporting', 'web_prefix'), help='Web prefix'), + Bcfg2.Options.Option( + cf=('reporting', 'django_settings'), + help='Additional django settings', + type=Bcfg2.Options.Types.literal_dict, default=dict())] @staticmethod def component_parsed_hook(opts): -- cgit v1.2.3-1-g7c22