Error while executing mysql_query.run_file

93 views
Skip to first unread message

varun bhatnagar

unread,
Oct 10, 2017, 7:40:27 AM10/10/17
to Salt-users
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

Daniel Wallace

unread,
Oct 10, 2017, 10:00:15 AM10/10/17
to Salt-users
That is fixed here, https://github.com/saltstack/salt/pull/43625 which should be in 2017.7.3 when it comes out.

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/e2b66be0-314c-485e-a509-e0d0767f0dfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages