Open gg17 opened 2 years ago
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!
@gg17 thanks for the report! that definitely looks like a problem. I'm not sure if we're just not using a custom JSONEncoder for the api like we are within Salt, but for whoever picks this up, that would be a good place to start looking.
Either we should be encoding the datetime as a repr string, i.e. it should be the string "datetime.datetime(...)", or we should be converting the timestamp to the ISO8601 version. Depends on how the API is passing/expecting information back.
Description When the kubernetes.show_namespace function is called through the salt-api it returns an "500 Internal Server Error". Calling the same function through the salt commandline does work.
In the raw output from the commandline it can be observed that a
'creation_timestamp': datetime.datetime(2021, 12, 15, 12, 48, 40),
object is returned, which likely corresponds with the error of the serverTypeError: Object of type datetime is not JSON serializable
.Setup
Our salt-minion is running on-prem directly on the kubernetes host. Our salt-master is running in a container, together with the salt-api in a different kubernetes cluster. The salt-minion connects to the service IP of the salt-master container.
Steps to Reproduce the behavior Call the salt-api with:
curl -i --insecure -X POST https://localhost:8001 -H 'Content-type: application/json' -H 'X-Auth-Token:<auth-token>' -d '{"client":"local","tgt":"<minion-id>","fun":"kubernetes.show_namespace","arg":["<namespace-to-show>"]}'
on a salt-minion running on a kubernetes host and query for a specific, existing namespace.Expected behavior The return should be similar to the cmdline output:
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ``` root@salt-master-55d7dc7477-vwdmz:/# salt-run --versions-report Salt Version: Salt: 3003.3 Dependency Versions: cffi: Not Installed cherrypy: 18.6.1 dateutil: 2.7.3 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.10 libgit2: 0.27.7 M2Crypto: Not Installed Mako: Not Installed msgpack: 0.5.6 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.19 pycrypto: Not Installed pycryptodome: 3.6.1 pygit2: 0.27.4 Python: 3.7.3 (default, Jan 22 2021, 20:04:44) python-gnupg: Not Installed PyYAML: 3.13 PyZMQ: 17.1.2 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.3.1 System Versions: dist: debian 10 buster locale: utf-8 machine: x86_64 release: 5.4.109+ system: Linux version: Debian GNU/Linux 10 buster ```Additional context Add any other context about the problem here.