This adds support for writing arbitrary sections to 'ceph.conf' while ensuring that already written sections are not duplicated.
Signed-off-by: Max Carrara <m.carr...@proxmox.com> --- Changes v1 --> v2: * Instead of just adding 'client.crash' as a separate section, also allow writing arbitrary sections Changes v2 --> v3: * this patch now only contains the changes actually mentioned in the commit message; the other changes have been put into separate patches Changes v3 --> v4: * none Changes v4 --> v5: * rebase onto changes of patch 01 * move writing 'client.*' sections to patch 05 (of this series) src/PVE/CephConfig.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/PVE/CephConfig.pm b/src/PVE/CephConfig.pm index 9934fd5..1fb467d 100644 --- a/src/PVE/CephConfig.pm +++ b/src/PVE/CephConfig.pm @@ -60,6 +60,7 @@ my $parse_ceph_file = sub { sub write_ceph_config { my ($filename, $cfg) = @_; + my $written_sections = {}; my $out = ''; my $cond_write_sec = sub { @@ -67,12 +68,15 @@ sub write_ceph_config { for my $section (sort keys $cfg->%*) { next if $section !~ m/^$re$/; + next if exists($written_sections->{$section}); $out .= "[$section]\n"; for my $key (sort keys $cfg->{$section}->%*) { $out .= "\t $key = $cfg->{$section}->{$key}\n"; } $out .= "\n"; + + $written_sections->{$section} = 1; } }; @@ -89,6 +93,8 @@ sub write_ceph_config { qr/mon\..*/, qr/osd\..*/, qr/mgr\..*/, + + qr/.*/, ); for my $re (@rexprs) { -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel