]> git.proxmox.com Git - pve-storage.git/commitdiff
pvesm: pass-through 'autogen' special value for encryption key
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 14 Jul 2020 11:57:55 +0000 (13:57 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 14 Jul 2020 11:57:57 +0000 (13:57 +0200)
so that the on-update hook can handle its creation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
PVE/CLI/pvesm.pm

index f1e7ef4b12c036d85a3f0cee7d9ec2826ca71048..3e3d39158c3f7fb55f1b5077a38cff40668c25bb 100755 (executable)
@@ -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};
 }