diff options
author | Eugeni Dodonov <eugeni@mandriva.org> | 2009-10-02 16:02:35 +0000 |
---|---|---|
committer | Eugeni Dodonov <eugeni@mandriva.org> | 2009-10-02 16:02:35 +0000 |
commit | db8b644bb8af35997079f1fe5a00b46207c54514 (patch) | |
tree | 44a87a93732c9f37bc86b8018ccda8684bf4af96 /src | |
parent | 4338b66e3df5add2adfeea5a72770965b8a808dd (diff) | |
download | msec-db8b644bb8af35997079f1fe5a00b46207c54514.tar msec-db8b644bb8af35997079f1fe5a00b46207c54514.tar.gz msec-db8b644bb8af35997079f1fe5a00b46207c54514.tar.bz2 msec-db8b644bb8af35997079f1fe5a00b46207c54514.tar.xz msec-db8b644bb8af35997079f1fe5a00b46207c54514.zip |
Correctly saving new levels.
Diffstat (limited to 'src')
-rw-r--r-- | src/msec/config.py | 8 | ||||
-rwxr-xr-x | src/msec/msec.py | 2 | ||||
-rwxr-xr-x | src/msec/msecperms.py | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/msec/config.py b/src/msec/config.py index e928ab4..9561300 100644 --- a/src/msec/config.py +++ b/src/msec/config.py @@ -334,6 +334,14 @@ class PermConfig(MsecConfig): self.log = log self.regexp = re.compile("^([^\s]*)\s*([a-z]*)\.([a-z]*)\s*([\d]?\d\d\d|current)\s*(force)?$") + def merge(self, newconfig, overwrite=False): + """Merges parameters from newconfig to current config""" + for opt in newconfig.list_options(): + if overwrite: + self.set(opt, newconfig.get(opt)) + else: + self.get(opt, newconfig.get(opt)) + def reset(self): MsecConfig.reset(self) del self.options_order diff --git a/src/msec/msec.py b/src/msec/msec.py index 0bb43a6..879ec19 100755 --- a/src/msec/msec.py +++ b/src/msec/msec.py @@ -147,7 +147,7 @@ if __name__ == "__main__": # saving current setting as new level if save: newlevel = config.MsecConfig(log, config=config.SECURITY_LEVEL % (root, level)) - newlevel.merge(msec_config) + newlevel.merge(permconf, overwrite=True) # update new level name newlevel.set("BASE_LEVEL", level) newlevel.save() diff --git a/src/msec/msecperms.py b/src/msec/msecperms.py index cdb9b0e..f07b745 100755 --- a/src/msec/msecperms.py +++ b/src/msec/msecperms.py @@ -164,8 +164,8 @@ if __name__ == "__main__": # saving current setting as new level if save: - newlevel = config.MsecConfig(log, config=config.SECURITY_LEVEL % (root, level)) - newlevel.merge(permconf) + newlevel = config.PermConfig(log, config=config.PERMISSIONS_LEVEL % (root, level)) + newlevel.merge(permconf, overwrite=True) newlevel.save() sys.exit(0) |