]> git.proxmox.com Git - pmg-api.git/commitdiff
PMG/Config.pm: new helper get_config()
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 15 Feb 2017 11:52:37 +0000 (12:52 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 15 Feb 2017 11:52:37 +0000 (12:52 +0100)
PMG/Config.pm

index 84c5109ba0f2d4c0325c1bcf919c90092be52481..711a8475f3186e8b37d5294ff37f720d0f571e45 100755 (executable)
@@ -349,6 +349,23 @@ sub get_section {
     return $res;
 }
 
+# get a whole config with default values
+# this does not work for ldap entries
+sub get_config {
+    my ($self) = @_;
+
+    my $res = {};
+
+    foreach my $key (keys %{$self->{ids}}) {
+       if ($key =~ m/^section_(\S+)$/) {
+           my $section = $1;
+           $res->{$section} = $self->get_section($section);
+       }
+    }
+
+    return $res;
+}
+
 sub read_pmg_conf {
     my ($filename, $fh) = @_;