Skip to content

Commit

Permalink
mxproxmox: init credentials and api only as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Dec 7, 2022
1 parent aa24bed commit 641f2ac
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mxproxmox/mxproxmox
Original file line number Diff line number Diff line change
Expand Up @@ -264,26 +264,32 @@ sub cmd_tclient {
sys(@cmd);
}

read_cred_file();
init_ua();

@ARGV >= 1 or die USAGE;
my ($cmd,@rest) = shift;
if ($cmd eq 'api') {
@ARGV==1 or die USAGE;
read_cred_file();
init_ua();
cmd_api(@ARGV);
} elsif ($cmd eq 'local-backups') {
@ARGV==0 or die USAGE;
read_cred_file();
init_ua();
cmd_local_backups(@ARGV);
} elsif ($cmd eq 'backup') {
@ARGV==2 or die USAGE;
read_cred_file();
cmd_backup(@ARGV);
} elsif ($cmd eq 'client') {
read_cred_file();
cmd_client(@ARGV);
} elsif ($cmd eq 'tclient') {
read_cred_file();
cmd_tclient(@ARGV);
} elsif ($cmd eq 'active-jobs') {
@ARGV==0 or die USAGE;
read_cred_file();
init_ua();
cmd_active_jobs(@ARGV);
} else {
die USAGE;
Expand Down

0 comments on commit 641f2ac

Please sign in to comment.