ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
493 stars 579 forks source link

nfsserver: fix "server scope" to live with additional drop-in files #1842

Closed zzhou1 closed 1 year ago

zzhou1 commented 1 year ago

Symptom:

The distro may have additional drop-in files to override ExecStart=, eg. openSUSE. In that case, the result drop-in file is messed up with several ExecStart= generated. For example,

cat /run/systemd/system/nfs-server.service.d/51-resource-agents-unshare-uts.conf

[Service] EnvironmentFile=/run/sysconfig/nfs-server-scope

ExecStart= ExecStart=/usr/bin/unshare --uts /bin/sh -c 'hostname ${NFS_SERVER_SCOPE}; exec "$@"' -- /usr/sbin/rpc.nfsd ExecStart=/usr/bin/unshare --uts /bin/sh -c 'hostname ${NFS_SERVER_SCOPE}; exec "$@"' -- ExecStart=-/usr/bin/unshare --uts /bin/sh -c 'hostname ${NFS_SERVER_SCOPE}; exec "$@"' -- /usr/sbin/rpc.nfsd $NFSD_OPTIONS

Indeed, only the last ExecStart= is needed.

knet-ci-bot commented 1 year ago

Can one of the admins verify this patch?

zzhou1 commented 1 year ago

@lge

oalbrigt commented 1 year ago

The added / might cause issues if there are anyone not using full path in their ExecStart=.

zzhou1 commented 1 year ago

The added / might cause issues if there are anyone not using full path in their ExecStart=.

hmm, you are right. Let me change "/" prefix to "." ;)

oalbrigt commented 1 year ago

You can remove the .. It already does .*, which covers it.

zzhou1 commented 1 year ago

Though remove it is fine, I'm thinking to leave that "." to reinforce at least one character to filter out the empty one.

oalbrigt commented 1 year ago

You should use .+ for that (you might have to use .\+).

oalbrigt commented 1 year ago

ok to test

oalbrigt commented 1 year ago

Thanks.