From: Stoiko Ivanov Date: Mon, 11 Feb 2019 14:43:07 +0000 (+0100) Subject: extend `pmgdb dump` X-Git-Url: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff_plain;h=0d161f4d114da87984cb1f0bd8949f230f477f93 extend `pmgdb dump` add priority, direction and an active flag to `pmgdb dump` output. pmgdb dump provides the complete ruleset including all rules and related objects. The information whether a rule is active and in which direction it works is necessary to get an overview about the setup for pmg-smtp-filter. Additionally the priority was explicitly added to the output for easier matching with the GUI. Signed-off-by: Stoiko Ivanov --- diff --git a/PMG/CLI/pmgdb.pm b/PMG/CLI/pmgdb.pm index e3031a0..cabf619 100644 --- a/PMG/CLI/pmgdb.pm +++ b/PMG/CLI/pmgdb.pm @@ -39,7 +39,15 @@ sub print_objects { sub print_rule { my ($ruledb, $rule) = @_; - print "Found RULE $rule->{id}: $rule->{name}\n"; + my $direction = { + 0 => 'in', + 1 => 'out', + 2 => 'in+out', + }; + my $active = $rule->{active} ? 'active' : 'inactive'; + my $dir = $direction->{$rule->{direction}}; + + print "Found RULE $rule->{id} (prio: $rule->{priority}, $dir, $active): $rule->{name}\n"; my ($from, $to, $when, $what, $action) = $ruledb->load_groups($rule);