Jackie Huang 84415fdcd7 fm-rest-api: Modify access privilege and ownership of fm config
Modify access privilege and ownership of fm config
according to upstream change:

```````````````````````````````````````````````
commit 454aa613265e6e31138112a424d4f0fa130f315f
Author: Yuxing Jiang <yuxing.jiang@windriver.com>
Date:   Fri Jul 17 13:43:06 2020 -0400

    Modify access privilege and ownership of fm config

    This commit modifies the ownership and access privilege of the
    fault manager config file to the fm user only.

    Verified the ownership and permission of /etc/fm/fm.conf after
    successfully installed and unlocked a controller. No extra error
    message is produced in fm-manager.log and fm-event.log. And fm
    commands are functional.

    Closes-Bug: 1887444
    Signed-off-by: Yuxing Jiang <yuxing.jiang@windriver.com>
```````````````````````````````````````````````

Story: 2008952
Task: 42576

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: If59ddf7be37374903f6d58da95bce49c997bfb52
2021-07-23 15:24:45 +08:00

50 lines
1.3 KiB
BlitzBasic

inherit setuptools
require fault-common.inc
SUBPATH0 = "fm-rest-api/fm"
LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2"
do_install_append() {
install -d -m 755 ${D}/${systemd_system_unitdir}
install -p -D -m 644 scripts/fm-api.service ${D}/${systemd_system_unitdir}
install -p -D -m 755 scripts/fm-api ${D}/${sysconfdir}/init.d/fm-api
install -p -D -m 644 fm-api-pmond.conf ${D}/${sysconfdir}/pmon.d/fm-api.conf
# fix the path for init scripts
sed -i -e 's|rc.d/||' ${D}/${systemd_system_unitdir}/*.service
}
inherit systemd
SYSTEMD_PACKAGES += "fm-rest-api"
SYSTEMD_SERVICE_${PN} = "fm-api.service"
SYSTEMD_AUTO_ENABLE_${PN} = "disable"
DISTRO_FEATURES_BACKFILL_CONSIDERED_remove = "sysvinit"
# For fm.conf
RDEPENDS_${PN} += " python-oslo.config"
pkg_postinst_ontarget_${PN}() {
cat > /etc/fm/config-generator.conf << EOF
[DEFAULT]
output_file = fm.conf.sample
wrap_width = 79
namespace = fm.api.conf
namespace = keystonemiddleware.auth_token
namespace = oslo.middleware
namespace = oslo.log
namespace = oslo.policy
namespace = oslo.db
EOF
oslo-config-generator --config-file /etc/fm/config-generator.conf --output-file /etc/fm/fm.conf.sample
mv /etc/fm/fm.conf.sample /etc/fm/fm.conf
chmod 600 /etc/fm/fm.conf
chown fm:fm /etc/fm/fm.conf
rm /etc/fm/config-generator.conf
}