From 69ba82e99bfa415faaa86a3280777e9f65967e60 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 15 Nov 2013 08:15:39 +0100 Subject: [PATCH] isert section when writing ceph.conf --- PVE/API2/Ceph.pm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm index 17e77f24..684c97c3 100644 --- a/PVE/API2/Ceph.pm +++ b/PVE/API2/Ceph.pm @@ -205,13 +205,25 @@ my $write_ceph_config = sub { my ($cfg) = @_; my $out = ''; - foreach my $section (keys %$cfg) { - $out .= "[$section]\n"; - foreach my $key (sort keys %{$cfg->{$section}}) { - $out .= "\t $key = $cfg->{$section}->{$key}\n"; + + my $cond_write_sec = sub { + my $re = shift; + + foreach my $section (keys %$cfg) { + next if $section !~ m/^$re$/; + $out .= "[$section]\n"; + foreach my $key (sort keys %{$cfg->{$section}}) { + $out .= "\t $key = $cfg->{$section}->{$key}\n"; + } + $out .= "\n"; } - $out .= "\n"; - } + }; + + &$cond_write_sec('global'); + &$cond_write_sec('mon'); + &$cond_write_sec('osd'); + &$cond_write_sec('mon\..*'); + &$cond_write_sec('osd\..*'); PVE::Tools::file_set_contents($pve_ceph_cfgpath, $out); }; -- 2.39.5