salt
salt copied to clipboard
[BUG] config.items and config.get do not properly handle fields with datetime values
Description
function config.items internally returns datetime objects that are not properly handled by outputters and/or salt-api.
Setup just a master and a minion.
- [ ] on-prem machine
- [X] VM (Virtualbox)
- [ ] 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
Issue command config.get schedule
also for config.items, but that one has much more unrelated output
Expected behavior
time-related fields are properly reported.
notably fields: schedule.__mine_interval._next_fire_time, schedule.__mine_interval._next_scheduled_fire_time and schedule.__mine_interval._last_run
observed behaviour:
- with
salt --out jsonthe fields are reported as strings, e.g.datetime.datetime(2022, 9, 17, 16, 20, 9, 840987) - with
salt --out yamlthe fields are reported as strings, e.g.2022-09-17 15:04:42.239934 - with
salt --out nested(which is also the default) the fields are reported as empty values - with salt-api
the server crashes on the handling of this api call and only a "500 internal error" is reported
this is of course the most important observation, as it makes
config.itemscompletely unusable in this context.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3004.2
Dependency Versions:
cffi: Not Installed
cherrypy: unknown
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.3
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.0
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.9.7
pygit2: Not Installed
Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: debian 11 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-15-amd64
system: Linux
version: Debian GNU/Linux 11 bullseye
Additional there might be other apis that have a similar behaviour