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 <s.ivanov@proxmox.com>
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);