]>
git.proxmox.com Git - pmg-api.git/blob - PMG/CLI/proxdb.pm
ee4d64c031e993aee5e50b54b841ad217d1f6c94
1 package PMG
::CLI
::proxdb
;
8 use PVE
::Tools
qw(extract_param);
13 use base
qw(PVE::CLIHandler);
15 my $nodename = PVE
::INotify
::nodename
();
17 __PACKAGE__-
>register_method ({
21 description
=> "Print the PMG rule database.",
23 additionalProperties
=> 0,
25 returns
=> { type
=> 'null'},
35 __PACKAGE__-
>register_method ({
39 description
=> "Delete PMG rule database.",
41 additionalProperties
=> 0,
43 returns
=> { type
=> 'null'},
47 my $list = PMG
::DBTools
::database_list
();
49 my $dbname = "Proxmox_ruledb";
51 die "Database '$dbname' does not exist\n" if !$list->{$dbname};
53 syslog
('info', "delete rule database");
55 PMG
::DBTools
::delete_ruledb
($dbname);
61 __PACKAGE__-
>register_method ({
65 description
=> "Update or initialize PMG rule database.",
67 additionalProperties
=> 0,
71 description
=> "Delete existing database.",
77 description
=> "Update/initialize statistic database (this is done by default).",
83 returns
=> { type
=> 'null'},
87 my $list = PMG
::DBTools
::database_list
();
89 my $dbname = "Proxmox_ruledb";
91 if (!$list->{$dbname} || $param->{force
}) {
93 if ($list->{$dbname}) {
94 print "Destroy existing rule database\n";
95 PMG
::DBTools
::delete_ruledb
($dbname);
98 print "Initialize rule database\n";
100 my $dbh = PMG
::DBTools
::create_ruledb
($dbname);
101 #$ruledb = Proxmox::RuleDB->new ($dbh);
102 #Proxmox::Utils::init_ruledb ($ruledb);
108 my $dbh = PMG
::DBTools
::open_ruledb
("Proxmox_ruledb");
109 #$ruledb = Proxmox::RuleDB->new ($dbh);
111 #print "Analyzing/Upgrading existing Databases...";
112 #Proxmox::Utils::upgradedb ($ruledb);
115 # reset and update statistic databases
116 if ($param->{statistics
}) {
117 print "Generating Proxmox Statistic Databases... ";
118 #Proxmox::Statistic::clear_stats($dbh);
119 #Proxmox::Statistic::update_stats($dbh, $cinfo);
131 'dump' => [ __PACKAGE__
, 'dump', []],
132 delete => [ __PACKAGE__
, 'delete', []],
133 update
=> [ __PACKAGE__
, 'update', []],