my $keyfd;
if (!open($keyfd, '<', $encryption_key_file)) {
- return undef if $! == ENOENT;
+ if ($! == ENOENT) {
+ my $encryption_fp = $scfg->{'encryption-key'};
+ die "encryption configured ('$encryption_fp') but no encryption key file found!\n"
+ if $encryption_fp;
+ return undef;
+ }
die "failed to open encryption key: $encryption_key_file: $!\n";
}
my $keyfd;
if (!open($keyfd, '<', $master_pubkey_file)) {
- return undef if $! == ENOENT;
+ if ($! == ENOENT) {
+ die "master public key configured but no key file found!\n"
+ if $scfg->{'master-pubkey'};
+ return undef;
+ }
die "failed to open master public key: $master_pubkey_file: $!\n";
}
my $param = {};
$param->{'backup-id'} = "$vmid" if defined($vmid);
+ $param->{'ns'} = "$scfg->{namespace}" if defined($scfg->{namespace});
my $data = eval { $conn->get("/api2/json/admin/datastore/$datastore/snapshots", $param); };
die "error listing snapshots - $@" if $@;