]>
Commit | Line | Data |
---|---|---|
f872534d DM |
1 | #!/usr/bin/perl |
2 | ||
3 | use lib '.'; | |
4 | use strict; | |
5 | use warnings; | |
6 | use PVE::RESTHandler; | |
7 | ||
8 | use Data::Dumper; | |
9 | ||
10 | use PMG::Config; | |
11 | ||
12 | my $types = PMG::Config::Base->lookup_types; | |
13 | ||
7608b70c DM |
14 | my $single_section = shift; |
15 | my $found = 0; | |
16 | ||
e09057ab | 17 | my $key_groups = { |
d9c56b22 DM |
18 | 'mail-ports' => [ |
19 | 'mail' , { | |
20 | int_port => 1, | |
21 | ext_port => 1, | |
22 | }], | |
e09057ab DM |
23 | 'mail-relaying' => [ |
24 | 'mail' , { | |
25 | relay => 1, | |
26 | relaynomx => 1, | |
27 | relayport => 1, | |
28 | smarthost => 1, | |
29 | }], | |
30 | }; | |
31 | ||
32 | my $select_keys; | |
33 | ||
34 | if ($single_section) { | |
35 | if (my $a = $key_groups->{$single_section}) { | |
36 | my ($sec, $hash) = @$a; | |
37 | $single_section = $sec; | |
38 | $select_keys = $hash; | |
39 | } | |
40 | } | |
41 | ||
42 | ||
f872534d DM |
43 | foreach my $section (@$types) { |
44 | my $plugin = PMG::Config::Base->lookup($section); | |
45 | my $schema = $plugin->updateSchema(1); | |
46 | my $properties = $schema->{properties}; | |
7608b70c DM |
47 | |
48 | if (defined($single_section)) { | |
49 | next if $section ne $single_section; | |
50 | } else { | |
51 | print ".Section '$section'\n\n"; | |
52 | } | |
53 | ||
54 | $found = 1; | |
a18c67c0 DM |
55 | |
56 | my $filter = sub { | |
57 | my ($key, $phash) = @_; | |
58 | return 1 if $key eq 'digest'; | |
59 | return 1 if $key eq 'delete'; | |
e09057ab | 60 | return 1 if $select_keys && !$select_keys->{$key}; |
a18c67c0 DM |
61 | return 0; |
62 | }; | |
f872534d | 63 | |
a18c67c0 DM |
64 | print PVE::RESTHandler::dump_properties( |
65 | $properties, 'asciidoc', 'config', $filter); | |
f872534d | 66 | } |
7608b70c DM |
67 | |
68 | if (defined($single_section)) { | |
69 | die "no such section '$single_section'" if !$found; | |
70 | } | |
f872534d DM |
71 | |
72 | exit(0); |