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
I've setup an external mysql pillar and I'm having trouble using the as_json option introduced in 3005 (#59777). It returns an error when trying to merge.
ERROR:
[ERROR ] Exception caught loading ext_pillar 'mysql':
File "salt/pillar/__init__.py", line 1188, in ext_pillar
ext = self._external_pillar_data(pillar, val, key)
File "salt/pillar/__init__.py", line 1108, in _external_pillar_data
ext = self.ext_pillars[key](self.minion_id, pillar, **val)
File "salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/opt/saltstack/salt/run/salt/pillar/mysql.py", line 146, in ext_pillar
return MySQLExtPillar().fetch(minion_id, pillar, *args, **kwargs)
File "salt/pillar/sql_base.py", line 482, in fetch
self.process_results(cursor.fetchall())
File "salt/pillar/sql_base.py", line 354, in process_results
crd = update(crd, ret[0], merge_lists=self.as_list)
File "salt/utils/dictupdate.py", line 38, in update
raise TypeError("Cannot update using non-dict types in dictupdate.update()")
Setup
ext_pillar:
- mysql:
mypillar:
query: "SELECT json_pillar FROM minions WHERE minion_id = %s"as_json: True
mysql> show variables like "%_database";
+------------------------+--------------------+
| Variable_name | Value |
+------------------------+--------------------+
| character_set_database | utf8mb4 |
| collation_database | utf8mb4_unicode_ci |
+------------------------+--------------------+
mysql> show full columns from minions;
+-------------+--------------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+-------------+--------------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| id | mediumint unsigned | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| minion_id | varchar(200) | utf8mb4_unicode_ci | NO | | NULL | | select,insert,update,references | |
| json_pillar | json | NULL | YES | | NULL | | select,insert,update,references | |
+-------------+--------------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
mysql> select * from minions;
+----+-----------+--------------------+
| id | minion_id | json_pillar |
+----+-----------+--------------------+
| 1 | localhost | {"key": "myvalue"} |
+----+-----------+--------------------+
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 salt localhost pillar.items
Expected behavior
I expect the mysql ext_pillar to merge without error.
Versions Report
salt --versions-report
Salt Version:
Salt: 3005.1Dependency Versions:
cffi: 1.14.6cherrypy: unknowndateutil: 2.8.2docker-py: 5.0.3gitdb: Not Installedgitpython: Not InstalledJinja2: 3.1.0libgit2: 1.5.0M2Crypto: Not InstalledMako: Not Installedmsgpack: 1.0.2msgpack-pure: Not Installedmysql-python: Not Installedpycparser: 2.21pycrypto: Not Installedpycryptodome: 3.9.8pygit2: 1.10.1Python: 3.9.14 (main, Oct 3 2022, 21:22:21)python-gnupg: 0.4.8PyYAML: 5.4.1PyZMQ: 23.2.0smmap: Not Installedtimelib: 0.2.4Tornado: 4.5.3ZMQ: 4.3.4System Versions:
dist: ubuntu 22.04 jammylocale: utf-8machine: x86_64release: 5.15.0-58-genericsystem: Linuxversion: Ubuntu 22.04 jammy
root@ubuntu22:~# dpkg -l |grep python3-mysqldb
ii python3-mysqldb 1.4.6-1build1
Description
I've setup an external mysql pillar and I'm having trouble using the
as_json
option introduced in 3005 (#59777). It returns an error when trying to merge.ERROR:
Setup
Please be as specific as possible and give set-up details.
Steps to Reproduce the behavior
salt localhost pillar.items
Expected behavior
I expect the mysql ext_pillar to merge without error.
Versions Report
salt --versions-report
Additional context
I've tested the same query on a json column in a postgres database without any issue.
The text was updated successfully, but these errors were encountered: