use base qw(PVE::CLIHandler);
-$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
+my $cmddef;
+my $nodename = PVE::INotify::nodename();
+
+sub prepare {
+ $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
-initlog ('pveceph');
+ initlog ('pveceph');
-die "please run as root\n" if $> != 0;
+ die "please run as root\n" if $> != 0;
-PVE::INotify::inotify_init();
+ PVE::INotify::inotify_init();
-my $rpcenv = PVE::RPCEnvironment->init('cli');
+ my $rpcenv = PVE::RPCEnvironment->init('cli');
-$rpcenv->init_request();
-$rpcenv->set_language($ENV{LANG});
-$rpcenv->set_user('root@pam');
+ $rpcenv->init_request();
+ $rpcenv->set_language($ENV{LANG});
+ $rpcenv->set_user('root@pam');
+}
my $upid_exit = sub {
my $upid = shift;
exit($status eq 'OK' ? 0 : -1);
};
-my $nodename = PVE::INotify::nodename();
-
__PACKAGE__->register_method ({
name => 'purge',
path => 'purge',
my $cmd = shift;
-PVE::CLIHandler::handle_cmd($cmddef, "pveceph", $cmd, \@ARGV, undef, $0);
+PVE::CLIHandler::handle_cmd($cmddef, "pveceph", $cmd, \@ARGV, undef, $0, \&prepare);
exit 0;