From 9335c73003ba449f5308f62caf7362fe961a2e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Wed, 14 Jan 2015 19:35:59 +0100 Subject: [PATCH] Added config initialization on config command --- server/src/uds/core/util/Config.py | 3 ++- server/src/uds/management/commands/config.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/src/uds/core/util/Config.py b/server/src/uds/core/util/Config.py index 22704a719..d22ff8635 100644 --- a/server/src/uds/core/util/Config.py +++ b/server/src/uds/core/util/Config.py @@ -198,8 +198,9 @@ class Config(object): cfg.value = value cfg.save() logger.debug('Updated value for {0}.{1} to {2}'.format(section, key, value)) + return True except Exception: - pass + return False class GlobalConfig(object): diff --git a/server/src/uds/management/commands/config.py b/server/src/uds/management/commands/config.py index 2b6edd6bc..dd6365eb7 100644 --- a/server/src/uds/management/commands/config.py +++ b/server/src/uds/management/commands/config.py @@ -55,6 +55,7 @@ class Command(BaseCommand): mod, name = first else: mod, name = GLOBAL_SECTION, first[0] - Config.update(mod, name, value) + if Config.update(mod, name, value) is False: # If not exists, try to store value without any special parameters + Config.section(mod).value(name, value).get() except Exception: logger.exception("Error")