]> git.proxmox.com Git - pve-storage.git/commitdiff
CephConfig: map special config key characters to _
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 19 Jun 2019 07:17:52 +0000 (09:17 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 19 Jun 2019 08:21:42 +0000 (10:21 +0200)
we want a consistent config has, regardless of how the user or a tool
adds it to the config, so we map ' ' and '-' to '_' in the keys

this way we can always access the correct key without trying multiple
times

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/CephConfig.pm

index 1719b8b5ba04e66e8224cbb35234900eba4318fd..ced8358f4186de91eb6213736a132cc8cbe4e272 100644 (file)
@@ -33,7 +33,11 @@ sub parse_ceph_config {
        }
 
        if ($line =~ m/^(.*?\S)\s*=\s*(\S.*)$/) {
-           $cfg->{$section}->{$1} = $2;
+           my ($key, $val) = ($1, $2);
+           # ceph treats ' ', '_' and '-' in keys the same, so we
+           # map it to '_' to get a consistent hash
+           $key =~ s/[-\ ]/_/g;
+           $cfg->{$section}->{$key} = $val;
        }
 
     }