1

Topic: iredadmin internal server error: connect() and unexpected 'port' arg

I'm guessing something that changed in RHEL6's python packages?

What's in the ssl_error_log file:

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/web/application.py", line 235, in process
    return p(lambda: process(processors))
  File "/usr/lib/python2.6/site-packages/web/session.py", line 82, in _processor
    self._cleanup()
  File "/usr/lib/python2.6/site-packages/web/session.py", line 168, in _cleanup
    self.store.cleanup(timeout)
  File "/usr/lib/python2.6/site-packages/web/session.py", line 315, in cleanup
    self.db.delete(self.table, where="$last_allowed_time > atime", vars=locals())
  File "/usr/lib/python2.6/site-packages/web/db.py", line 906, in delete
    db_cursor = self._db_cursor()
  File "/usr/lib/python2.6/site-packages/web/db.py", line 566, in _db_cursor
    return self.ctx.db.cursor()
  File "/usr/lib/python2.6/site-packages/web/db.py", line 507, in _getctx
    self._load_context(self._ctx)
  File "/usr/lib/python2.6/site-packages/web/db.py", line 518, in _load_context
    ctx.db = self._connect(self.keywords)
  File "/usr/lib/python2.6/site-packages/web/db.py", line 960, in _connect
    conn = DB._connect(self, keywords)
  File "/usr/lib/python2.6/site-packages/web/db.py", line 546, in _connect
    return self.db_module.connect(**keywords)
TypeError: connect() got an unexpected keyword argument 'port'

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.4
- Linux/BSD distribution name and version: RHEL6/64
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? Y
- Related log if you're reporting an issue: see above
====

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iredadmin internal server error: connect() and unexpected 'port' arg

I can reproduce this error from the iredadmin upgrade script:

[root@envoy tools]# python delete_sessions.py
* [2016-04-22 14:07:08] Delete all existing sessions, admins are forced to re-login to iRedAdmin.
Traceback (most recent call last):
  File "delete_sessions.py", line 22, in <module>
    conn.query('DELETE FROM sessions')
  File "/usr/lib/python2.6/site-packages/web/db.py", line 643, in query
    db_cursor = self._db_cursor()
  File "/usr/lib/python2.6/site-packages/web/db.py", line 566, in _db_cursor
    return self.ctx.db.cursor()
  File "/usr/lib/python2.6/site-packages/web/db.py", line 507, in _getctx
    self._load_context(self._ctx)
  File "/usr/lib/python2.6/site-packages/web/db.py", line 518, in _load_context
    ctx.db = self._connect(self.keywords)
  File "/usr/lib/python2.6/site-packages/web/db.py", line 960, in _connect
    conn = DB._connect(self, keywords)
  File "/usr/lib/python2.6/site-packages/web/db.py", line 546, in _connect
    return self.db_module.connect(**keywords)
TypeError: connect() got an unexpected keyword argument 'port'

3

Re: iredadmin internal server error: connect() and unexpected 'port' arg

I was able to fix the upgrade script by editing ira_tool_lib.py to say:

    try:
        host_string=settings.__dict__[db + '_db_host']
        port=int(settings.__dict__[db + '_db_port'])
        host_string += ':'
        host_string += str(port)
        print 'Host string is ' + host_string
        conn = web.database(dbn=sql_dbn,
                            host=host_string,
                            db=settings.__dict__[db + '_db_name'],
                            user=settings.__dict__[db + '_db_user'],
                            pw=settings.__dict__[db + '_db_password'])

4

Re: iredadmin internal server error: connect() and unexpected 'port' arg

Which version of web.py are you running? Could you please show me output of command below?

python -c "import web; print web.__version__"

5

Re: iredadmin internal server error: connect() and unexpected 'port' arg

Hi.

[dwb7@package ~]$ python -c "import web; print web.__version__"
0.36

The documentation in the postgres driver module mentions using:

URLs are of the form `postgres://user:password@host:port/dbname[?key=value&key=value...]`.

python-sqlalchemy-0.5.5-3.el6_2.noarch

6

Re: iredadmin internal server error: connect() and unexpected 'port' arg

Please upgrade web.py to the latest 0.37, restart Apache and try again.

# easy_install -U web.py

7

Re: iredadmin internal server error: connect() and unexpected 'port' arg

ZhangHuangbin wrote:

Please upgrade web.py to the latest 0.37, restart Apache and try again.

# easy_install -U web.py

Hrm... my pyweb is coming from the iredmail yum repo:

http://iredmail.org/yum/rpms/6/

8

Re: iredadmin internal server error: connect() and unexpected 'port' arg

If you have EPEL repo enabled, it offers 0.37:
https://dl.fedoraproject.org/pub/epel/6 … webpy.html

9

Re: iredadmin internal server error: connect() and unexpected 'port' arg

ZhangHuangbin wrote:

If you have EPEL repo enabled, it offers 0.37:
https://dl.fedoraproject.org/pub/epel/6 … webpy.html

I do, however, I have your repo at a higher priority specifically so that other repos can't overrule your repo smile

Are you no longer maintaining the pkgs in your repo?

thanks.

10

Re: iredadmin internal server error: connect() and unexpected 'port' arg

dwbotsch wrote:

Are you no longer maintaining the pkgs in your repo?

If there's same packages in EPEL, we will use EPEL so that we can reduce our workload and all iRedMail users get stable upgrading from EPEL. smile

11

Re: iredadmin internal server error: connect() and unexpected 'port' arg

ZhangHuangbin wrote:
dwbotsch wrote:

Are you no longer maintaining the pkgs in your repo?

If there's same packages in EPEL, we will use EPEL so that we can reduce our workload and all iRedMail users get stable upgrading from EPEL. smile

Good to know.. I'll re-jigger my repo priorities so that EPEL can override iredmail, then.

12

Re: iredadmin internal server error: connect() and unexpected 'port' arg

Let me know whether or not upgrading web.py fixes your issue.

13

Re: iredadmin internal server error: connect() and unexpected 'port' arg

So it looks like allowing EPEL to override iredmail would update the following RPMs to:

GeoIP.x86_64                     1.6.5-1.el6                epel               
arj.x86_64                       3.10.22-22.el6             epel               
awstats.noarch                   7.0-3.el6                  epel               
cabextract.x86_64                1.5-1.el6                  epel               
clamav.x86_64                    0.99.1-1.el6               epel               
clamav-db.x86_64                 0.99.1-1.el6               epel               
clamd.x86_64                     0.99.1-1.el6               epel               
fail2ban.noarch                  0.9.3-1.el6.1              epel               
libmspack.x86_64                 0.5-0.1.alpha.el6          epel               
p7zip.x86_64                     15.09-9.el6                epel               
perl-Convert-UUlib.x86_64        2:1.5-1.el6                epel               
perl-Mail-SPF.noarch             2.8.0-2.el6                epel               
perl-Net-Server.noarch           2.007-2.el6                epel               
python-webpy.noarch              0.37-2.el6                 epel               

Thoughts?

14

Re: iredadmin internal server error: connect() and unexpected 'port' arg

It's fine. but clamav is the only one you should care about, it may use a new daemon user/group name and cause permission error.

15

Re: iredadmin internal server error: connect() and unexpected 'port' arg

So, with the latest iredadmin pro, I'm still running into this on RHEL6. Even though I upgraded to WebPy 0.37 .

The problem appears to be in the python-sqlalchemy package, which on RHEL6, is python-sqlalchemy-0.5.5-3.el6_2.noarch (a base RedHat, Inc package).

In addition to modding the ira_tool_lib.py script as mentioned above, I had to edit:

libs/sqllib/__init__.py
libs/amavisd/core.py
libs/sqllib/__init__.py
libs/iredbase.py
libs/iredapd/__init__.py

and making the same change in each one. Essentially deleting, in the connection, the port= line and changing the host= line to something like:

host=settings.vmail_db_host + ':' + str(int(settings.vmail_db_port)),

as I mentioned before, this is per the python sql documentation.

So, are you using a different version of python sql?

thanks.

16

Re: iredadmin internal server error: connect() and unexpected 'port' arg

How about upgrade python-sqlalchemy instead of modifying iRedAdmin?

17

Re: iredadmin internal server error: connect() and unexpected 'port' arg

ZhangHuangbin wrote:

How about upgrade python-sqlalchemy instead of modifying iRedAdmin?

I looked at that, but it would appear that there is not a newer one available as a base package.

EPEL appears to have newer packages available that would install alongside the base RedHat package, but I would guess you would specifically have to load the newer module version?

18

Re: iredadmin internal server error: connect() and unexpected 'port' arg

CentOS 6 ships python-sqlalchemy-0.5.5-3, EPEL offers 0.8.2.