postinst: move dir creation to helper

and guard it to only run on ceph-using systems (the regular 'inited' check
doesn't work as a guard for this, because it checks for new-style inits
including the dir existing).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-04-11 14:45:44 +02:00
parent 85c14e2826
commit b76dc13ba5
2 changed files with 8 additions and 5 deletions

View File

@ -66,6 +66,14 @@ sub main {
exit 0;
}
my $ceph_cfg_path = PVE::Ceph::Tools::get_config('pve_ceph_cfgpath');
if (PVE::Ceph::Tools::check_ceph_installed('ceph_mon', 1) && -f $ceph_cfg_path) {
my $pve_ceph_cfgdir = PVE::Ceph::Tools::get_config('pve_ceph_cfgdir');
if (! -d $pve_ceph_cfgdir) {
File::Path::make_path($pve_ceph_cfgdir);
}
}
eval {
PVE::Ceph::Tools::check_ceph_inited();
};

5
debian/postinst vendored
View File

@ -81,13 +81,8 @@ EOF
}
update_ceph_conf() {
CEPH_CONF_DIR='/etc/pve/ceph'
UNIT='ceph-crash.service'
if test ! -d "${CEPH_CONF_DIR}"; then
mkdir -p "${CEPH_CONF_DIR}"
fi
# Don't fail in case user has "exotic" configuration where RADOS
# isn't available on all nodes for some reason
/usr/share/pve-manager/helpers/pve-init-ceph-crash || true