summaryrefslogtreecommitdiff
path: root/src/leap/base/config.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-12-12 03:29:31 +0900
committerkali <kali@leap.se>2012-12-12 04:23:39 +0900
commit04d423e2a89034dfb86fe305108162fd2a696079 (patch)
tree3d39b48495fbcfbfeab776af07558c345f4161cb /src/leap/base/config.py
parent18be85f13abc6bc94a3725950ec16ad1adec0ab8 (diff)
tests for openvpn options
and make the rest of tests pass after some changes in this branch (dirtyness in config files)
Diffstat (limited to 'src/leap/base/config.py')
-rw-r--r--src/leap/base/config.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/leap/base/config.py b/src/leap/base/config.py
index 321fbdcd..b307ad05 100644
--- a/src/leap/base/config.py
+++ b/src/leap/base/config.py
@@ -126,14 +126,33 @@ class JSONLeapConfig(BaseLeapConfig):
# mandatory baseconfig interface
- def save(self, to=None):
- if self._config.is_dirty():
+ def save(self, to=None, force=False):
+ """
+ force param will skip the dirty check.
+ :type force: bool
+ """
+ # XXX this force=True does not feel to right
+ # but still have to look for a better way
+ # of dealing with dirtiness and the
+ # trick of loading remote config only
+ # when newer.
+
+ if force:
+ do_save = True
+ else:
+ do_save = self._config.is_dirty()
+
+ if do_save:
if to is None:
to = self.filename
folder, filename = os.path.split(to)
if folder and not os.path.isdir(folder):
mkdir_p(folder)
self._config.serialize(to)
+ return True
+
+ else:
+ return False
def load(self, fromfile=None, from_uri=None, fetcher=None,
force_download=False, verify=False):