[BUG] config.items and config.get do not properly handle fields with datetime values
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
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
- 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 json
the fields are reported as strings, e.g.datetime.datetime(2022, 9, 17, 16, 20, 9, 840987) - with
salt --out yaml
the 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 makesconfig.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
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 by reproducing config.get schedule and config.items with the JSON, YAML, and nested outputters, then inspect the configuration handling, outputter serialization, and salt-api paths mentioned in the report. Trace how the datetime fields are converted at each boundary. Done means the listed schedule fields are represented correctly by all three outputters and the salt-api request no longer returns a 500 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100