pvesm: pass-through 'autogen' special value for encryption key

so that the on-update hook can handle its creation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2020-07-14 13:57:55 +02:00
parent b3b63fc27d
commit 0ca8eb4f9d

View File

@ -37,10 +37,21 @@ sub param_mapping {
},
});
my $enc_key_map = {
name => 'encryption-key',
desc => 'a file containing an encryption key, or the special value "autogen"',
func => sub {
my ($value) = @_;
return $value if $value eq 'autogen';
return PVE::Tools::file_get_contents($value);
}
};
my $mapping = {
'cifsscan' => [ $password_map ],
'create' => [ $password_map, 'encryption-key' ],
'update' => [ $password_map, 'encryption-key' ],
'create' => [ $password_map, $enc_key_map ],
'update' => [ $password_map, $enc_key_map ],
};
return $mapping->{$name};
}