OpenSIPS / opensips-cli

OpenSIPS CLI tool - an interactive command line tool that can be used to control and monitor OpenSIPS servers.
GNU General Public License v3.0
85 stars 48 forks source link

opensips-cli add acc failed #38

Closed bibace closed 4 years ago

bibace commented 4 years ago

opensips-cli -x database create

opensips-cli -x database add acc

both failed.

Error:

opensips-cli -x database add acc

Please provide us the URL of the database: mysql://opensips:opensipsrw@mysql ERROR: Error closing cursor Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1333, in _safe_close_cursor cursor.close() File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/cursors.py", line 85, in close while self.nextset(): File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/cursors.py", line 178, in nextset self._warning_check() File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/cursors.py", line 149, in _warning_check warnings = db.show_warnings() File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/connections.py", line 382, in show_warnings self.query("SHOW WARNINGS") File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/connections.py", line 280, in query _mysql.connection.query(self, query) _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") ERROR: Error closing cursor Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1333, in _safe_close_cursor cursor.close() File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/cursors.py", line 85, in close while self.nextset(): File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/cursors.py", line 178, in nextset self._warning_check() File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/cursors.py", line 149, in _warning_check warnings = db.show_warnings() File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/connections.py", line 382, in show_warnings self.query("SHOW WARNINGS") File "/usr/local/lib/python3.7/dist-packages/mysqlclient-1.3.14-py3.7-linux-x86_64.egg/MySQLdb/connections.py", line 280, in query _mysql.connection.query(self, query) _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 761, in _commit_impl self.engine.dialect.do_commit(self.connection) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/dialects/mysql/base.py", line 2215, in do_commit dbapi_connection.commit() _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now")

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/bin/opensips-cli", line 4, in import('pkg_resources').run_script('opensipscli==0.1.0', 'opensips-cli') File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 666, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 1446, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/EGG-INFO/scripts/opensips-cli", line 9, in run_console() File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/EGG-INFO/scripts/opensips-cli", line 6, in run_console main.main() File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/opensipscli/main.py", line 78, in main sys.exit(shell.cmdloop()) File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/opensipscli/cli.py", line 225, in cmdloop ret = self.run_command(self.command[0], command, params) File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/opensipscli/cli.py", line 331, in run_command return mod[0].invoke(cmd, params) File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/opensipscli/module.py", line 36, in invoke return f(params) File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/opensipscli/modules/database.py", line 284, in do_add db.create_module(module_file_path) File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/opensipscli/db.py", line 206, in create_module self.exec_sql_file(import_file) File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.1.0-py3.7.egg/opensipscli/db.py", line 332, in exec_sql_file self.__conn.execute(sql) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 982, in execute return self._executetext(object, multiparams, params) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1155, in _execute_text parameters, File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1272, in _execute_context self._root._commit_impl(autocommit=True) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 763, in _commit_impl self._handle_dbapi_exception(e, None, None, None, None) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception
util.raise_from_cause(sqlalchemy_exception, exc_info) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/util/compat.py", line 383, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/util/compat.py", line 128, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 761, in _commit_impl self.engine.dialect.do_commit(self.connection) File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/dialects/mysql/base.py", line 2215, in do_commit dbapi_connection.commit() sqlalchemy.exc.ProgrammingError: (_mysql_exceptions.ProgrammingError) (2014, "Commands out of sync; you can't run this command now") (Background on this error at: http://sqlalche.me/e/f405)

================================== Environment debian 10 Python 3.7.3

pip3 freeze asn1crypto==0.24.0 cffi==1.13.2
cryptography==2.8
entrypoints==0.3
keyring==17.1.1
keyrings.alt==3.1.1 mysqlclient==1.4.6 opensipscli==0.1.0 pycparser==2.19
pycrypto==2.6.1
PyGObject==3.30.4
pyOpenSSL==19.1.0
pyxdg==0.25 SecretStorage==2.3.1 six==1.12.0 SQLAlchemy==1.3.12 SQLAlchemy-Utils==0.36.1

bibace commented 4 years ago

looks there's some compatible issue with Mysql 8.0.

Works fine on Mysql 5.7

liviuchircu commented 4 years ago

On CentOS 7, with default mariadb-server (5.5.64):

[root@localhost opensips-cli]# opensips-cli -x database add acc
Please provide us the URL of the database: mysql://root:@localhost
INFO: Module acc has been successfully added!

Let me try to get an 8.0 installed instead and I'll get back to you.

liviuchircu commented 4 years ago

Success! Really curious to get to the bottom of this one:

[root@localhost opensips-cli]# opensips-cli -x database create
Create [a]ll tables or just the [c]urrently configured ones? (Default value is a): a
Creating all tables ...
Running standard-create.sql...
Running tracer-create.sql...
ERROR: Error closing cursor
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/SQLAlchemy-1.3.3-py3.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1333, in _safe_close_cursor
    cursor.close()
  File "/usr/local/lib/python3.6/site-packages/mysqlclient-1.3.14-py3.6-linux-x86_64.egg/MySQLdb/cursors.py", line 85, in close
    while self.nextset():
  File "/usr/local/lib/python3.6/site-packages/mysqlclient-1.3.14-py3.6-linux-x86_64.egg/MySQLdb/cursors.py", line 178, in nextset
    self._warning_check()
  File "/usr/local/lib/python3.6/site-packages/mysqlclient-1.3.14-py3.6-linux-x86_64.egg/MySQLdb/cursors.py", line 149, in _warning_check
    warnings = db.show_warnings()
  File "/usr/local/lib/python3.6/site-packages/mysqlclient-1.3.14-py3.6-linux-x86_64.egg/MySQLdb/connections.py", line 382, in show_warnings
    self.query("SHOW WARNINGS")
  File "/usr/local/lib/python3.6/site-packages/mysqlclient-1.3.14-py3.6-linux-x86_64.egg/MySQLdb/connections.py", line 280, in query
    _mysql.connection.query(self, query)
_mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now")
ERROR: Error closing cursor