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

database creation fails with 'OpenSIPSCLIShell' object has no attribute 'do_database' #37

Closed sstef93 closed 4 years ago

sstef93 commented 4 years ago

Hello, i'm runnig centos 7 with python3.6.8 whenever i try to create the database using opensips-cli with database create cmd, i get the following error:

Creating all tables ... Running standard-create.sql... Running tracer-create.sql...

ERROR: Error closing cursor
Traceback (most recent call last):
  File "/usr/lib64/python3.6/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'OpenSIPSCLIShell' object has no attribute 'do_database'

During handling of the above exception, another exception occurred:

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
Traceback (most recent call last):
  File "/usr/lib64/python3.6/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'OpenSIPSCLIShell' object has no attribute 'do_database'

During handling of the above exception, another exception occurred:

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")
Traceback (most recent call last):
  File "/usr/lib64/python3.6/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'OpenSIPSCLIShell' object has no attribute 'do_database'

During handling of the above exception, another exception occurred:

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 761, in _commit_impl
    self.engine.dialect.do_commit(self.connection)
  File "/usr/local/lib/python3.6/site-packages/SQLAlchemy-1.3.3-py3.6-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 <module>
    __import__('pkg_resources').run_script('opensipscli==0.1', 'opensips-cli')
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 654, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1434, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/EGG-INFO/scripts/opensips-cli", line 9, in <module>
    run_console()
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/EGG-INFO/scripts/opensips-cli", line 6, in run_console
    main.main()
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/main.py", line 78, in main
    sys.exit(shell.cmdloop())
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/cli.py", line 232, in cmdloop
    super(OpenSIPSCLIShell, self).cmdloop(intro='')
  File "/usr/lib64/python3.6/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib64/python3.6/cmd.py", line 216, in onecmd
    return self.default(line)
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/cli.py", line 342, in default
    self.run_command(module, cmd, params)
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/cli.py", line 331, in run_command
    return mod[0].__invoke__(cmd, params)
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/module.py", line 36, in __invoke__
    return f(params)
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/modules/database.py", line 376, in do_create
    if self.create_tables(db_name, db_url=db_url) < 0:
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/modules/database.py", line 515, in create_tables
    db.create_module(table_file)
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/db.py", line 204, in create_module
    self.exec_sql_file(import_file)
  File "/usr/local/lib/python3.6/site-packages/opensipscli-0.1-py3.6.egg/opensipscli/db.py", line 325, in exec_sql_file
    self.__conn.execute(sql)
  File "/usr/local/lib/python3.6/site-packages/SQLAlchemy-1.3.3-py3.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 982, in execute
    return self._execute_text(object_, multiparams, params)
  File "/usr/local/lib/python3.6/site-packages/SQLAlchemy-1.3.3-py3.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1155, in _execute_text
    parameters,
  File "/usr/local/lib/python3.6/site-packages/SQLAlchemy-1.3.3-py3.6-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1272, in _execute_context
    self._root._commit_impl(autocommit=True)
  File "/usr/local/lib/python3.6/site-packages/SQLAlchemy-1.3.3-py3.6-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.6/site-packages/SQLAlchemy-1.3.3-py3.6-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.6/site-packages/SQLAlchemy-1.3.3-py3.6-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.6/site-packages/SQLAlchemy-1.3.3-py3.6-linux-x86_64.egg/sqlalchemy/util/compat.py", line 128, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/SQLAlchemy-1.3.3-py3.6-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.6/site-packages/SQLAlchemy-1.3.3-py3.6-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)
razvancrainea commented 4 years ago

Does this happen every time you try to create the tables?

sstef93 commented 4 years ago

When i execute the cmd "database create" on opensips-cli . I managed to set it up by importing the .sql files manually tho.

razvancrainea commented 4 years ago

I've just committed a fix for this - could you please test again and let us know if it works this time?

bibace commented 4 years ago

I've just committed a fix for this - could you please test again and let us know if it works this time?

I got the same issue on 3.0 latest nightly version

liviuchircu commented 4 years ago

@bibace @sstef93 , I'm having a hard time reproducing this. Find below my environment:

[root@localhost opensips-cli]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@localhost opensips-cli]# cat ~/.opensips-cli.cfg 
[default]
log_level: INFO
prompt_name: opensips-cli
prompt_intro: Welcome to OpenSIPS Command Line Interface!
prompt_emptyline_repeat_cmd: False
history_file: ~/.opensips-cli.history
history_file_size: 1000
output_type: pretty-print

communication_type: fifo
fifo_file: /tmp/opensips_fifo

template_url: mysql://root:@localhost
database_user_url: mysql://root:@localhost
database_path: /root/src/opensips-3.0/scripts
[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...
Running emergency-create.sql...
Running b2b-create.sql...
Running closeddial-create.sql...
Running imc-create.sql...
Running usrloc-create.sql...
Running registrant-create.sql...
Running alias_db-create.sql...
Running rls-create.sql...
Running drouting-create.sql...
Running msilo-create.sql...
Running dialog-create.sql...
Running avpops-create.sql...
Running presence-create.sql...
Running carrierroute-create.sql...
Running userblacklist-create.sql...
Running rtpengine-create.sql...
Running freeswitch_scripting-create.sql...
Running cachedb_sql-create.sql...
Running clusterer-create.sql...
Running acc-create.sql...
Running group-create.sql...
Running b2b_sca-create.sql...
Running permissions-create.sql...
Running domainpolicy-create.sql...
Running dispatcher-create.sql...
Running speeddial-create.sql...
Running domain-create.sql...
Running tls_mgm-create.sql...
Running smpp-create.sql...
Running fraud_detection-create.sql...
Running dialplan-create.sql...
Running cpl-create.sql...
Running load_balancer-create.sql...
Running auth_db-create.sql...
Running rtpproxy-create.sql...
Running call_center-create.sql...
INFO: database tables have been successfully created.

My opensips-cli was installed according to the Install Guide. Any hints are appreciated until I understand more about this exception. Thanks!

bibace commented 4 years ago

@bibace @sstef93 , I'm having a hard time reproducing this. Find below my environment:

[root@localhost opensips-cli]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@localhost opensips-cli]# cat ~/.opensips-cli.cfg 
[default]
log_level: INFO
prompt_name: opensips-cli
prompt_intro: Welcome to OpenSIPS Command Line Interface!
prompt_emptyline_repeat_cmd: False
history_file: ~/.opensips-cli.history
history_file_size: 1000
output_type: pretty-print

communication_type: fifo
fifo_file: /tmp/opensips_fifo

template_url: mysql://root:@localhost
database_user_url: mysql://root:@localhost
database_path: /root/src/opensips-3.0/scripts
[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...
Running emergency-create.sql...
Running b2b-create.sql...
Running closeddial-create.sql...
Running imc-create.sql...
Running usrloc-create.sql...
Running registrant-create.sql...
Running alias_db-create.sql...
Running rls-create.sql...
Running drouting-create.sql...
Running msilo-create.sql...
Running dialog-create.sql...
Running avpops-create.sql...
Running presence-create.sql...
Running carrierroute-create.sql...
Running userblacklist-create.sql...
Running rtpengine-create.sql...
Running freeswitch_scripting-create.sql...
Running cachedb_sql-create.sql...
Running clusterer-create.sql...
Running acc-create.sql...
Running group-create.sql...
Running b2b_sca-create.sql...
Running permissions-create.sql...
Running domainpolicy-create.sql...
Running dispatcher-create.sql...
Running speeddial-create.sql...
Running domain-create.sql...
Running tls_mgm-create.sql...
Running smpp-create.sql...
Running fraud_detection-create.sql...
Running dialplan-create.sql...
Running cpl-create.sql...
Running load_balancer-create.sql...
Running auth_db-create.sql...
Running rtpproxy-create.sql...
Running call_center-create.sql...
INFO: database tables have been successfully created.

My opensips-cli was installed according to the Install Guide. Any hints are appreciated until I understand more about this exception. Thanks!

The issue may due to some of python libs/code that opensips-cli using are not compatible with mysql 8.

greenbea commented 4 years ago

I am experiencing the same issue with trying database create with postgres this is my traceback


Please provide the URL of the SQL database: postgres://opensips:password@127.0.0.1
ERROR: cannot connect to DB server: (psycopg2.OperationalError) FATAL:  database "opensips" does not exist

(Background on this error at: http://sqlalche.me/e/e3q8)!
Traceback (most recent call last):
  File "/usr/lib/python3.7/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'OpenSIPSCLIShell' object has no attribute 'do_database'

During handling of the above exception, another exception occurred:

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 2262, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 303, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 760, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 492, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 139, in _do_get
    self._dec_overflow()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/util/compat.py", line 129, in reraise
    raise value
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 136, in _do_get
    return self._create_connection()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 308, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 437, in __init__
    self.__connect(first_connect_check=True)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 639, in __connect
    connection = pool._invoke_creator(self)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/strategies.py", line 114, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/default.py", line 453, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.7/dist-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  database "opensips" does not exist

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

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/opensipscli/db.py", line 112, in __init__
    self.__conn = self.__engine.connect().\
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2193, in connect
    return self._connection_cls(self, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 103, in __init__
    else engine.raw_connection()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2293, in raw_connection
    self.pool.unique_connection, _connection
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 2266, in _wrap_pool_connect
    e, dialect, self
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1536, in _handle_dbapi_exception_noconnection
    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 2262, in _wrap_pool_connect
    return fn()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 303, in unique_connection
    return _ConnectionFairy._checkout(self)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 760, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 492, in checkout
    rec = pool._do_get()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 139, in _do_get
    self._dec_overflow()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/util/langhelpers.py", line 68, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/util/compat.py", line 129, in reraise
    raise value
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/impl.py", line 136, in _do_get
    return self._create_connection()
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 308, in _create_connection
    return _ConnectionRecord(self)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 437, in __init__
    self.__connect(first_connect_check=True)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/pool/base.py", line 639, in __connect
    connection = pool._invoke_creator(self)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/strategies.py", line 114, in connect
    return dialect.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.7/dist-packages/SQLAlchemy-1.3.3-py3.7-linux-x86_64.egg/sqlalchemy/engine/default.py", line 453, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/usr/local/lib/python3.7/dist-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL:  database "opensips" does not exist

(Background on this error at: http://sqlalche.me/e/e3q8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/opensips-cli", line 9, in <module>
    run_console()
  File "/usr/bin/opensips-cli", line 6, in run_console
    main.main()
  File "/usr/lib/python3/dist-packages/opensipscli/main.py", line 78, in main
    sys.exit(shell.cmdloop())
  File "/usr/lib/python3/dist-packages/opensipscli/cli.py", line 232, in cmdloop
    super(OpenSIPSCLIShell, self).cmdloop(intro='')
  File "/usr/lib/python3.7/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/lib/python3.7/cmd.py", line 216, in onecmd
    return self.default(line)
  File "/usr/lib/python3/dist-packages/opensipscli/cli.py", line 342, in default
    self.run_command(module, cmd, params)
  File "/usr/lib/python3/dist-packages/opensipscli/cli.py", line 331, in run_command
    return mod[0].__invoke__(cmd, params)
  File "/usr/lib/python3/dist-packages/opensipscli/module.py", line 36, in __invoke__
    return f(params)
  File "/usr/lib/python3/dist-packages/opensipscli/modules/database.py", line 374, in do_create
    if self._do_create_db([db_name], db_url) < 0:
  File "/usr/lib/python3/dist-packages/opensipscli/modules/database.py", line 406, in _do_create_db
    db = self.get_db(db_url, db_name)
  File "/usr/lib/python3/dist-packages/opensipscli/modules/database.py", line 834, in get_db
    return osdb(db_url, db_name)
  File "/usr/lib/python3/dist-packages/opensipscli/db.py", line 120, in __init__
    raise osdbError("unable to connect to the database")
opensipscli.db.osdbError: unable to connect to the database```
greenbea commented 4 years ago

Installing the latest master worked fine, but works only with a config file