]> git.proxmox.com Git - pve-storage.git/commit
plugin: simplify and fix create-base-path vs mkdir logic
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 5 Jun 2023 09:17:27 +0000 (11:17 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 5 Jun 2023 09:17:27 +0000 (11:17 +0200)
commitd81a9aea7b50556741699d2fcb5ab3e463f1b175
treef7ed5604c733e55c55fbcf2aaa1e6cfe91427199
parent7c242295c9d8ba24ddd3de8e98f453af04ee5da1
plugin: simplify and fix create-base-path vs mkdir logic

In the previous code, if `create-base-path` was explicitly
set to false, it would be treated the same as if it was
undef, falling through to whatever 'mkdir' was.

Instead, the new options should always be preferred, and the
logic can be simplified to a single line.

Here's the table showing the difference, 'u' being 'undef':

config: mkdir:  u 0 1 u 0 1 u 0 1
        create: u u u 0 0 0 1 1 1
        =========================
mkpath: old:    1 0 1 0 0 1 1 1 1
        new:    1 0 1 0 0 0 1 1 1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/Storage/Plugin.pm