You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When exploring the usage of mysql with salt I found a problem where the presence detection does not work when enabling the mysql_cache. This is due to many factors as far as i was able to read the ls function is not returning the minion name its returning the etcd_key column value which is data in my case. I'd like to make a PR for this issue in the future.
def ls(bank):
"""
Return an iterable object containing all entries stored in the specified
bank.
"""
_init_client()
query = "SELECT etcd_key FROM {} WHERE bank=%s".format(
__context__["mysql_table_name"]
)
cur, _ = run_query(__context__.get("mysql_client"), query, args=(bank,))
out = [row[0] for row in cur.fetchall()]
cur.close()
return out
The code above is the source of mysql_cache list or also ls called here function. What it is supposed to return is minion name, this is not in the select of the sql statement, the minion name is in the bank column.
Setup
I am using a Proxmox hypervisor for testing with salt, nothing special about it.
Two minions are connected to the salt-master one is a linux desktop VM and the other is windows 11 VM.
Please be as specific as possible and give set-up details.
on-prem machine
VM (Virtualbox, KVM, etc. please specify)
VM running on a cloud service, please be explicit and add details
container (Kubernetes, Docker, containerd, etc. please specify)
or a combination, please be explicit
jails if it is FreeBSD
classic packaging
onedir packaging
used bootstrap to install
Steps to Reproduce the behavior
Enable mysql_cache and have presence_events turned on the master.
Now looking at the events you would be able to see this json:
I believe the proposed fix there to still be inadequate because - following the filesystem hierarchy analogy - it only lists "subdirectories" while skipping over "files" in the requested cache bank and lists subdirectories of subdirectories (it should only list direct children).
Thank you for the time invested, I will slimm down the changes.
I agree with what you have said. Then I will request a feat aswell for using both mysql_cache and mysql as a returner with seperate configs.
Description
When exploring the usage of mysql with salt I found a problem where the presence detection does not work when enabling the mysql_cache. This is due to many factors as far as i was able to read the ls function is not returning the minion name its returning the etcd_key column value which is data in my case. I'd like to make a PR for this issue in the future.
The code above is the source of mysql_cache list or also ls called here function. What it is supposed to return is minion name, this is not in the select of the sql statement, the minion name is in the bank column.
salt/presence/present {
"_stamp": "2024-10-17T12:25:05.694697",
"present": []
}
Setup
I am using a Proxmox hypervisor for testing with salt, nothing special about it.
Two minions are connected to the salt-master one is a linux desktop VM and the other is windows 11 VM.
Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
Enable mysql_cache and have presence_events turned on the master.
Now looking at the events you would be able to see this json:
Expected behavior
Expect a list of alived minions when running:
salt-run manage.alived
Versions Report
Salt Version:
Salt: 3007.1
Python Version:
Python: 3.10.14 (main, Apr 3 2024, 21:30:09) [GCC 11.2.0]
Dependency Versions:
cffi: 1.16.0
cherrypy: unknown
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.7
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 23.1
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.5.2
PyYAML: 6.0.1
PyZMQ: 25.1.2
relenv: 0.16.0
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.3.3
ZMQ: 4.3.4
Salt Package Information:
Package Type: onedir
System Versions:
dist: ubuntu 24.04.1 noble
locale: utf-8
machine: x86_64
release: 6.8.0-45-generic
system: Linux
version: Ubuntu 24.04.1 noble
The text was updated successfully, but these errors were encountered: