Hi,
I have recently updated my Salt installation and I have 2017.7.2 version installed with 1 master and 3 windows minions.
I am want to execute database queries using a file and just to test that I have created a dummy file (tmp.sql) with SELECT query as below:
SELECT * FROM customers;
and state file looks like this:
Executing file query:
mysql_query.run_file:
- name: test1
- database: mysql
- connection_db: mysql
- query_file: 'C:\Users\test_user\Desktop\tmp.sql'
- connection_host: '192.168.133.180'
- connection_user: 'root'
- connection_pass: 'rootroot'
- connection_port: 3306
When I am executing this file I get the below error:
----------
ID: Executing file query
Function: mysql_query.run_file
Name: test1
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "c:\salt\bin\lib\site-packages\salt\state.py", line 1843, in call
**cdata['kwargs'])
File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1795, in wrapper
return f(*args, **kwargs)
File "c:\salt\bin\lib\site-packages\salt\states\mysql_query.py", line 159, in run_file
query_result = __salt__['mysql.file_query'](database, query_file, **connection_args)
File "c:\salt\bin\lib\site-packages\salt\modules\mysql.py", line 731, in file_query
ret['columns'] += query_result['columns']
TypeError: unsupported operand type(s) for +=: 'int' and 'tuple'
Started: 13:09:31.283000
Duration: 15.0 ms
Changes:
Summary for 192.168.133.180
When I execute the query using mysql_query.run state it runs without errors but I have a lot of commands and I would like to use mysql_query.run_file.
Any suggestions on what I can do to get this successfully executed?
BR,
Varun