[BUG] beacons.save does not save beacons defined in pillar data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
According to the documentation here, beacons defined in pillars are delivered to the minion in memory, but can be saved to the filesystem using beacons.save.
I have a simple diskusage beacon applied in pillar data, but it is not persisted when using beacons.save.
Setup
# Salt master config
> cat /etc/salt/master.d/pillar.conf
pillar_roots:
sandbox:
- /srv/pillar/sandbox
# Pillar file
> cat /srv/pillar/sandbox/beacons/init.sls
beacons:
diskusage:
- /: 11%
- interval: 60
# Top file
> cat /srv/pillar/sandbox/top.sls
sandbox:
'diskusage_beacon_sandbox':
- beacons
With that configured, I apply my pillars and validate, then use beacons.save to persist it -- the output from beacons.save would indicate that the beacon persisted, but the file it creates is empty.
# Apply pillars
> salt -L diskusage_beacon_sandbox saltutil.pillar_refresh
diskusage_beacon_sandbox:
True
# Validate
> salt -L diskusage_beacon_sandbox beacons.list
diskusage_beacon_sandbox:
beacons:
diskusage:
- /: 11%
- interval: 60
# Save beacons
> salt -L diskusage_beacon_sandbox beacons.save
diskusage_beacon_sandbox:
----------
comment:
Beacons saved to /etc/salt/minion.d/beacons.conf.
result:
True
# Check beacons.conf on the minion -- the file is created but it is empty
> salt -L diskusage_beacon_sandbox file.read /etc/salt/minion.d/beacons.conf
diskusage_beacon_sandbox:
# File size shows 0 bytes
> salt -L diskusage_beacon_sandbox cmd.run 'ls -lh /etc/salt/minion.d/beacons.conf'
diskusage_beacon_sandbox:
-rw-r--r--. 1 root root 0 Jun 2 18:42 /etc/salt/minion.d/beacons.conf
I am testing this using a RHEL8 EC2 instance that I provisioned with salt-cloud.
Expected behavior
I would expect the beacon data to be persisted in /etc/salt/minion.d/beacons.conf. Note that manually deploying the beacon by landing a .conf file in /etc/salt/minion.d works as does using beacons.add.
Versions Report
salt --versions-report
Salt Version:
Salt: 3006.9
Python Version:
Python: 3.10.14 (main, Jun 26 2024, 11:44:37) [GCC 11.2.0]
Dependency Versions:
cffi: 1.17.1
cherrypy: unknown
cryptography: 42.0.5
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: 1.7.2
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: 1.14.1
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.17.0
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: rhel 8.10 Ootpa
locale: utf-8
machine: x86_64
release: 4.18.0-553.16.1.el8_10.x86_64
system: Linux
version: Red Hat Enterprise Linux 8.10 Ootpa
My minion is also running salt-minion-3006.9.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the beacons.save entry point and the pillar-provided beacon path, then inspect how they produce /etc/salt/minion.d/beacons.conf. Compare this with the working beacons.add behavior. Done means a beacon defined in pillar data is written to beacons.conf and remains available after the minion restarts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100