]> git.proxmox.com Git - pmg-api.git/commitdiff
rename proxdb to pmgdb
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 2 Feb 2017 07:46:24 +0000 (08:46 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 2 Feb 2017 07:46:24 +0000 (08:46 +0100)
Makefile
PMG/CLI/pmgdb.pm [new file with mode: 0644]
PMG/CLI/proxdb.pm [deleted file]
bin/pmgdb [new file with mode: 0644]
bin/proxdb [deleted file]

index f444a499cfb4a64b0394070e99bc808f97a85df9..dff86c29f86855c95ab747a34edcf0b1b36cf91f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ BASHCOMPLDIR=${DESTDIR}/usr/share/bash-completion/completions/
 REPOID=`./repoid.pl .git`
 
 SERVICES = pmgdaemon pmgproxy
-CLITOOLS = proxdb
+CLITOOLS = pmgdb
 
 CLI_CLASSES = $(addprefix, 'PMG/API2/', $(addsuffix '.pm', ${CLITOOLS}))
 CLI_BINARIES = $(addprefix, 'bin/', ${CLITOOLS})
@@ -26,7 +26,7 @@ LIBSOURCES =                          \
        PMG/Ticket.pm                   \
        PMG/AccessControl.pm            \
        PMG/DBTools.pm                  \
-       PMG/CLI/proxdb.pm               \
+       PMG/CLI/pmgdb.pm                \
        ${CLI_CLASSES}                  \
        PMG/API2/Network.pm             \
        PMG/API2/Services.pm            \
diff --git a/PMG/CLI/pmgdb.pm b/PMG/CLI/pmgdb.pm
new file mode 100644 (file)
index 0000000..d6e35d6
--- /dev/null
@@ -0,0 +1,136 @@
+package PMG::CLI::pmgdb;
+
+use strict;
+use warnings;
+use Data::Dumper;
+
+use PVE::SafeSyslog;
+use PVE::Tools qw(extract_param);
+use PVE::INotify;
+
+use PMG::DBTools;
+
+use base qw(PVE::CLIHandler);
+
+my $nodename = PVE::INotify::nodename();
+
+__PACKAGE__->register_method ({
+    name => 'dump',
+    path => 'dump',
+    method => 'GET',
+    description => "Print the PMG rule database.",
+    parameters => {
+       additionalProperties => 0,
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       print "DUMP\n";
+
+       return undef;
+    }});
+
+
+__PACKAGE__->register_method ({
+    name => 'delete',
+    path => 'delete',
+    method => 'DELETE',
+    description => "Delete PMG rule database.",
+    parameters => {
+       additionalProperties => 0,
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       my $list = PMG::DBTools::database_list();
+
+       my $dbname = "Proxmox_ruledb";
+
+       die "Database '$dbname' does not exist\n" if !$list->{$dbname};
+
+       syslog('info', "delete rule database");
+
+       PMG::DBTools::delete_ruledb($dbname);
+
+       return undef;
+    }});
+
+
+__PACKAGE__->register_method ({
+    name => 'update',
+    path => 'update',
+    method => 'POST',
+    description => "Update or initialize PMG rule database.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           force => {
+               type => 'boolean',
+               description => "Delete existing database.",
+               optional => 1,
+               default => 0,
+           },
+           statistics => {
+               type => 'boolean',
+               description => "Update/initialize statistic database (this is done by default).",
+               optional => 1,
+               default => 1,
+           },
+       }
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       my $list = PMG::DBTools::database_list();
+
+       my $dbname = "Proxmox_ruledb";
+
+       if (!$list->{$dbname} || $param->{force}) {
+
+           if ($list->{$dbname}) {
+               print "Destroy existing rule database\n";
+               PMG::DBTools::delete_ruledb($dbname);
+           }
+
+           print "Initialize rule database\n";
+
+           my $dbh = PMG::DBTools::create_ruledb ($dbname);
+           #$ruledb = Proxmox::RuleDB->new ($dbh);
+           #Proxmox::Utils::init_ruledb ($ruledb);
+
+           $dbh->disconnect();
+
+       } else {
+
+           my $dbh = PMG::DBTools::open_ruledb("Proxmox_ruledb");
+           #$ruledb = Proxmox::RuleDB->new ($dbh);
+
+           #print "Analyzing/Upgrading existing Databases...";
+           #Proxmox::Utils::upgradedb ($ruledb);
+           #print "done\n";
+
+           # reset and update statistic databases
+           if ($param->{statistics}) {
+               print "Generating Proxmox Statistic Databases... ";
+               #Proxmox::Statistic::clear_stats($dbh);
+               #Proxmox::Statistic::update_stats($dbh, $cinfo);
+               print "done\n";
+           }
+
+           $dbh->disconnect();
+       }
+
+       return undef;
+    }});
+
+
+our $cmddef = {
+    'dump' => [ __PACKAGE__, 'dump', []],
+    delete => [ __PACKAGE__, 'delete', []],
+    update => [ __PACKAGE__, 'update', []],
+};
+
+1;
diff --git a/PMG/CLI/proxdb.pm b/PMG/CLI/proxdb.pm
deleted file mode 100644 (file)
index ee4d64c..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-package PMG::CLI::proxdb;
-
-use strict;
-use warnings;
-use Data::Dumper;
-
-use PVE::SafeSyslog;
-use PVE::Tools qw(extract_param);
-use PVE::INotify;
-
-use PMG::DBTools;
-
-use base qw(PVE::CLIHandler);
-
-my $nodename = PVE::INotify::nodename();
-
-__PACKAGE__->register_method ({
-    name => 'dump',
-    path => 'dump',
-    method => 'GET',
-    description => "Print the PMG rule database.",
-    parameters => {
-       additionalProperties => 0,
-    },
-    returns => { type => 'null'},
-    code => sub {
-       my ($param) = @_;
-
-       print "DUMP\n";
-
-       return undef;
-    }});
-
-
-__PACKAGE__->register_method ({
-    name => 'delete',
-    path => 'delete',
-    method => 'DELETE',
-    description => "Delete PMG rule database.",
-    parameters => {
-       additionalProperties => 0,
-    },
-    returns => { type => 'null'},
-    code => sub {
-       my ($param) = @_;
-
-       my $list = PMG::DBTools::database_list();
-
-       my $dbname = "Proxmox_ruledb";
-
-       die "Database '$dbname' does not exist\n" if !$list->{$dbname};
-
-       syslog('info', "delete rule database");
-
-       PMG::DBTools::delete_ruledb($dbname);
-
-       return undef;
-    }});
-
-
-__PACKAGE__->register_method ({
-    name => 'update',
-    path => 'update',
-    method => 'POST',
-    description => "Update or initialize PMG rule database.",
-    parameters => {
-       additionalProperties => 0,
-       properties => {
-           force => {
-               type => 'boolean',
-               description => "Delete existing database.",
-               optional => 1,
-               default => 0,
-           },
-           statistics => {
-               type => 'boolean',
-               description => "Update/initialize statistic database (this is done by default).",
-               optional => 1,
-               default => 1,
-           },
-       }
-    },
-    returns => { type => 'null'},
-    code => sub {
-       my ($param) = @_;
-
-       my $list = PMG::DBTools::database_list();
-
-       my $dbname = "Proxmox_ruledb";
-
-       if (!$list->{$dbname} || $param->{force}) {
-
-           if ($list->{$dbname}) {
-               print "Destroy existing rule database\n";
-               PMG::DBTools::delete_ruledb($dbname);
-           }
-
-           print "Initialize rule database\n";
-
-           my $dbh = PMG::DBTools::create_ruledb ($dbname);
-           #$ruledb = Proxmox::RuleDB->new ($dbh);
-           #Proxmox::Utils::init_ruledb ($ruledb);
-
-           $dbh->disconnect();
-
-       } else {
-
-           my $dbh = PMG::DBTools::open_ruledb("Proxmox_ruledb");
-           #$ruledb = Proxmox::RuleDB->new ($dbh);
-
-           #print "Analyzing/Upgrading existing Databases...";
-           #Proxmox::Utils::upgradedb ($ruledb);
-           #print "done\n";
-
-           # reset and update statistic databases
-           if ($param->{statistics}) {
-               print "Generating Proxmox Statistic Databases... ";
-               #Proxmox::Statistic::clear_stats($dbh);
-               #Proxmox::Statistic::update_stats($dbh, $cinfo);
-               print "done\n";
-           }
-
-           $dbh->disconnect();
-       }
-
-       return undef;
-    }});
-
-
-our $cmddef = {
-    'dump' => [ __PACKAGE__, 'dump', []],
-    delete => [ __PACKAGE__, 'delete', []],
-    update => [ __PACKAGE__, 'update', []],
-};
-
-1;
diff --git a/bin/pmgdb b/bin/pmgdb
new file mode 100644 (file)
index 0000000..e224a4e
--- /dev/null
+++ b/bin/pmgdb
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -T
+
+use strict;
+use warnings;
+
+use PMG::CLI::pmgdb;
+
+PMG::CLI::pmgdb->run_cli_handler();
diff --git a/bin/proxdb b/bin/proxdb
deleted file mode 100644 (file)
index 2d9462f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/perl -T
-
-use strict;
-use warnings;
-
-use PMG::CLI::proxdb;
-
-PMG::CLI::proxdb->run_cli_handler();