Browse files

Adds a new stage to the configuration file converter. It fixes the

encoder entries so the '1' values are transformed to 'allow' and the
'0' removed. RFE #1054: Part of http://bugs.cherokee-project.com/1054

git-svn-id: svn://cherokee-project.com/cherokee/trunk@5879 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent dfa05b3 commit 88b6150ea9004b0bad36ffa4cf0f295546443cec @alobbs alobbs committed Dec 5, 2010
Showing with 17 additions and 0 deletions.
  1. +17 −0 admin/config_version.py
View
17 admin/config_version.py
@@ -52,6 +52,19 @@ def upgrade_to_1_0_7 (cfg):
cfg.get_val('vserver!%s!rule!%s!match!extensions'%(v,r)) == 'php':
cfg['vserver!%s!rule!%s!match!check_local_file'%(v,r)] = '1'
+# Converts from 1.0.7 to 1.0.13
+def upgrade_to_1_0_13 (cfg):
+ # Converts !encoder!<x> = '1' to 'allow', and remove '0's
+ for v in cfg.keys('vserver'):
+ for r in cfg.keys('vserver!%s!rule'%(v)):
+ for e in cfg.keys('vserver!%s!rule!%s!encoder'%(v,r)):
+ key = 'vserver!%s!rule!%s!encoder!%s'%(v,r,e)
+ val = cfg.get_val(key)
+ if val == '1':
+ cfg[key] = 'allow'
+ elif val == '0':
+ del(cfg[key])
+
def config_version_get_current():
ver = configured.VERSION.split ('b')[0]
@@ -122,5 +135,9 @@ def config_version_update_cfg (cfg):
if ver_config_i < 1000007:
upgrade_to_1_0_7 (cfg)
+ # Update to.. 1.0.13
+ if ver_config_i < 1000013:
+ upgrade_to_1_0_13 (cfg)
+
cfg["config!version"] = ver_release_s
return True

0 comments on commit 88b6150

Please sign in to comment.