sysutils/py-salt: fix commands like "service salt_minion status"

When py-processtitle is installed, the master and minion daemons will
change their process titles in a way that breaks commands like "service
salt_minion status".  status, stop, restart, etc are all broken.  Fix
this bug by:

* Always installing py-processtitle unconditionally,
* Fixing utils/process.py to not insert an extra space in the title
* Adjusting the RC scripts accordingly

A downside is that many service subcommands will now print this harmless
warning message:
```
/usr/local/etc/rc.d/salt_minion: WARNING: cannot read shebang line from
MultiMinionProcessManager
```

Approved by:	krion (maintainer)
Sponsored by:	ConnectWise
PR:		285053
This commit is contained in:
Alan Somers 2025-02-27 17:40:20 +00:00
parent 845495b7e8
commit ce4c8c4921
4 changed files with 17 additions and 1 deletions

View file

@ -1,6 +1,6 @@
PORTNAME= salt
PORTVERSION= 3006.9
PORTREVISION= 3
PORTREVISION= 4
PORTEPOCH= 1
CATEGORIES= sysutils python
MASTER_SITES= PYPI

View file

@ -0,0 +1,14 @@
--- salt/utils/process.py.orig 2024-07-29 07:51:58 UTC
+++ salt/utils/process.py
@@ -59,7 +59,10 @@ def appendproctitle(name):
current = setproctitle.getproctitle()
if current.strip().endswith("MainProcess"):
current, _ = current.rsplit("MainProcess", 1)
- setproctitle.setproctitle(f"{current.rstrip()} {name}")
+ if len(current) > 0:
+ setproctitle.setproctitle(f"{current.rstrip()} {name}")
+ else:
+ setproctitle.setproctitle(name)
def daemonize(redirect_out=True):

View file

@ -34,6 +34,7 @@ command_interpreter="%%PYTHON_CMD%%"
required_files=${salt_master_configdir}
pidfile=${salt_master_pidfile}
command_args="-c ${required_files} --pid-file=${pidfile} -d"
procname="MainProcess"
export PATH="${salt_master_paths}"
export PYTHON_EGG_CACHE="${salt_master_eggcache}"

View file

@ -34,6 +34,7 @@ command_interpreter="%%PYTHON_CMD%%"
required_files=${salt_minion_configdir}
pidfile=${salt_minion_pidfile}
command_args="-c ${required_files} --pid-file=${pidfile} -d"
procname="MultiMinionProcessManager"
export PATH="${salt_minion_paths}"
export PYTHON_EGG_CACHE="${salt_minion_eggcache}"