Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensure configuration uses correct HTTP methods as per RFC 3253. Provi…

…de configuration upgrade path.
  • Loading branch information...
commit 299a8cabf87e91c73c0ae34dfcca683b1277d6e1 1 parent 444bf1e
@davidjb davidjb authored
Showing with 32 additions and 2 deletions.
  1. +30 −0 admin/config_version.py
  2. +2 −2 admin/plugins/method.py
View
30 admin/config_version.py
@@ -71,6 +71,32 @@ def upgrade_to_1_0_13 (cfg):
elif val == '0':
del(cfg[key])
+# Converts to 1.2.102
+METHODS_MAP = {'baseline_control': 'baseline-control',
+ 'version_control': 'version-control'
+ }
+def update_rules_methods(cfg, key, node):
+ if node.value == 'method':
+ method_key = '%s!method' % key
+ method_value = cfg.get_val(method_key)
+ # Check rule's method key value and replace if problematic
+ if method_value in METHODS_MAP:
+ cfg[method_key] = METHODS_MAP[method_value]
+ else:
+ for k in node.keys():
+ child_key = '%s!%s' % (key, k)
+ child_node = cfg[child_key]
+ update_rules_methods(cfg, child_key, child_node)
+
+def upgrade_to_1_2_102 (cfg):
+ # Update HTTP method specifications for those that were incorrect
+
+ for v in cfg.keys('vserver'):
+ for r in cfg.keys('vserver!%s!rule' % (v)):
+ # Traverse rules and look for HTTP method 'match' elements
+ rule_key = 'vserver!%s!rule!%s!match' % (v,r)
+ rule_node = cfg[rule_key]
+ update_rules_methods(cfg, rule_key, rule_node)
def config_version_get_current():
ver = configured.VERSION.split ('b')[0]
@@ -145,5 +171,9 @@ def config_version_update_cfg (cfg):
if ver_config_i < 1000013:
upgrade_to_1_0_13 (cfg)
+ # Update to.. 1.2.102
+ if ver_config_i < 1002102:
+ upgrade_to_1_2_102 (cfg)
+
cfg["config!version"] = ver_release_s
return True
View
4 admin/plugins/method.py
@@ -52,7 +52,7 @@
('unsubscribe', 'UNSUBSCRIBE'),
('report', 'REPORT'),
('patch', 'PATCH'),
- ('version_control', 'VERSION_CONTROL'),
+ ('version-control', 'VERSION-CONTROL'),
('checkout', 'CHECKOUT'),
('uncheckout', 'UNCHECKOUT'),
('checkin', 'CHECKIN'),
@@ -60,7 +60,7 @@
('label', 'LABEL'),
('mkworkspace', 'MKWORKSPACE'),
('mkactivity', 'MKACTIVITY'),
- ('baseline_control', 'BASELINE_CONTROL'),
+ ('baseline-control', 'BASELINE-CONTROL'),
('merge', 'MERGE')
]
Please sign in to comment.
Something went wrong with that request. Please try again.