movetopublicfolder.py error No module named 'ConfigParser'



  • I want to move emails which are sent to an inactive account to a public folder. I am trying to use movetopublic.py for this purpose as described here: https://documentation.kopano.io/kopanocore_administrator_manual/special_kc_configurations.html#move-to-public

    I have setup a ruleset in /etc/kopano/movetopublic.cfg:
    rule1_recipient = officemail
    rule1_destination_folder = Office

    Folder and account exist. The mail gets sent to inactive account officemail@example.com but not moved to the public folder “Office”.

    I get the following errors:
    Jan 12 14:35:03 office kopano-dagent[1055]: !-- failed to load: /var/lib/kopano/dagent/plugins/movetopublic.py
    Jan 12 14:35:03 office kopano-dagent[1055]: !-- error: No module named ‘ConfigParser’

    I suspect I has something to do with different python versions (Python 3, Python 2.7)?

    I am on Debian 9 and using Kopano-Version 8.7.80.465-Debian_9.0-amd64. Users and Mailaccounts are imported via LDAP from ActiveDirectory.

    Any help appreciated. Thanks in advance.
    Chris


  • Kopano

    ah, so the ‘ConfigParser’ module was renamed to ‘configparser’ with python3. I made an internal PR to fix this, and some other python3 issues… we will update here once it’s tested and merged.



  • ok, thank you. I have tried to import “configparser” in zconfig.py, but it then throws different exceptions … Looking forward for the updated version … Thanks



  • Just for your information:
    I have merged your changes from: https://github.com/Kopano-dev/kopano-core/commit/33841d2aaaf09403d1d8442ef124738b1c3d767f
    to /usr/share/kopano-dagent/python/zconfig.py and /usr/share/kopano-spooler/python/zconfig.py
    and now I am getting another exception:

    Jan 15 13:32:06 office kopano-dagent[11105]: !-- error: in method ‘IMAPIFolder_CreateFolder’, argument 3 of type ‘LPTSTR’
    Jan 15 13:32:06 office kopano-dagent[11105]: !- Plugin ‘MoveToPublic.PreDelivery’ call ignored please check the plugin



  • Any news here? Many things are broken at my site due to this …


  • Kopano

    Hi @mahescho,
    this has already been fixed by above pr for master.



  • What do I have to do to get this now and not with the next release? I’ve tried to use the movetopublic.py and zconfig.py from https://github.com/Kopano-dev/kopano-core/tree/master/spooler/python but I still get:

    Feb 2 21:44:08 kopano kopano-dagent[26857]: WARNING: setrlimit(RLIMIT_NOFILE, 8192) failed: Operation not permitted. You will only be able to connect up to 4096 sockets. Either start the process as root, or increase user limits for open file descriptors.
    Feb 2 21:44:09 kopano kopano-dagent[26857]: !-- error: name ‘long’ is not defined
    Feb 2 21:44:09 kopano kopano-dagent[26857]: !- Plugin ‘MoveToPublic.PreDelivery’ call ignored please check the plugin
    Feb 2 21:44:09 kopano kopano-dagent[26857]: !-- error: initial_value must be str or None, not bytes
    Feb 2 21:44:09 kopano kopano-dagent[26857]: !- Plugin ‘RewriteGALAddressesToSMTP.PreDelivery’ call ignored please check the plugin


  • Kopano

    @mahescho what is the exact version you are using at the moment?



  • WebApp: 3.5.1.2106+86.1
    Kopano Core: 8.6.9
    Z-Push: 2.4.5+0-0


  • Kopano

    @mahescho are you really sure about the 8.6.9? all these python3 things should be exclusive to 8.7.x.



  • Hmmm … interesting … “Settings” in the desktop client report: 8.6.9 but “dpkg” reports: 8.7.0.0-0+1.1

    A fix would be nice …

    After a reload of the destop app I get:

    WebApp: 3.5.1.2106+86.1
    Kopano Core: 8.7.0
    Z-Push: 2.4.5+0-0



  • Still not working.

    Even not with the master packages.



  • @CE said in movetopublicfolder.py error No module named 'ConfigParser':

    ls which are sent to an inactive account to a public folde

    i suggest install : apt install python-metaconfig and python3-metaconfig

    if that does not fix it then this is an option.

    kopano-admin --list-orphans
    and
    kopano-admin --copyto-public

    This error… WARNING: setrlimit(RLIMIT_NOFILE, 8192)
    i fixed that with : systemctl edit kopano-dagent

    # /etc/systemd/system/kopano-dagent.service.d/override.conf
    [Unit]
    After=kopano-server.service
    Wants=kopano-server.service
    
    [Service]
    LimitNOFILE=8192:16384
    User=kopano
    Group=kopano
    


  • This didn’t help. I still get:

    Feb 6 11:11:47 kopano kopano-dagent[7207]: WARNING: setrlimit(RLIMIT_NOFILE, 8192) failed: Operation not permitted. You will only be able to connect up to 4096 sockets. Either start the process as root, or increase user limits for open file descriptors.
    Feb 6 11:11:47 kopano kopano-dagent[7207]: !-- error: in method ‘IMAPIFolder_CreateFolder’, argument 3 of type ‘LPTSTR’
    Feb 6 11:11:47 kopano kopano-dagent[7207]: !- Plugin ‘MoveToPublic.PreDelivery’ call ignored please check the plugin
    Feb 6 11:11:47 kopano kopano-dagent[7207]: !-- error: initial_value must be str or None, not bytes
    Feb 6 11:11:47 kopano kopano-dagent[7207]: !- Plugin ‘RewriteGALAddressesToSMTP.PreDelivery’ call ignored please check the plugin


  • Kopano

    @mahescho yes, I was also in serious doubt about that. We already have a ticket internally to fix this dagent plugin. keep an eye on https://jira.kopano.io/browse/KC-1405.



  • @mahescho said in movetopublicfolder.py error No module named 'ConfigParser':

    Either start the process as root, or increase user limits for open file descriptors.

    That works fine here.

    I am on Debian 9 and using Kopano-Version8.7.80.569.f0345abbe-0+88.1-Debian_9.0-amd64.
    Users and Mailaccounts are imported via LDAP from Samba4 ActiveDirectory.

    root@mail1:/etc/kopano# systemctl status kopano-dagent
    ● kopano-dagent.service - Kopano Groupware Core Delivery Agent
       Loaded: loaded (/lib/systemd/system/kopano-dagent.service; enabled; vendor preset: enabled)
      Drop-In: /etc/systemd/system/kopano-dagent.service.d
               └─override.conf
       Active: active (running) since Wed 2019-02-06 11:21:12 CET; 2min 55s ago
         Docs: man:kopano-dagent(8)
               man:kopano-dagent.cfg(5)
     Main PID: 18206 (kopano-dagent)
        Tasks: 1 (limit: 4915)
       CGroup: /system.slice/kopano-dagent.service
               └─18206 /usr/sbin/kopano-dagent -l
    
    Feb 06 11:21:12 mail1 systemd[1]: Started Kopano Groupware Core Delivery Agent.
    Feb 06 11:21:12 mail1 kopano-dagent[18206]: Starting kopano-dagent version 8.7.80 (pid 18206 uid 999) (LMTP mode)
    root@mail1:/etc/kopano# systemctl cat kopano-dagent
    # /lib/systemd/system/kopano-dagent.service
    [Unit]
    Description=Kopano Groupware Core Delivery Agent
    Documentation=man:kopano-dagent(8) man:kopano-dagent.cfg(5)
    
    [Service]
    Type=simple
    ExecStart=/usr/sbin/kopano-dagent -l
    ExecReload=/bin/kill -HUP $MAINPID
    
    [Install]
    WantedBy=multi-user.target
    
    # /etc/systemd/system/kopano-dagent.service.d/override.conf
    [Unit]
    After=kopano-server.service
    Wants=kopano-server.service
    
    [Service]
    LimitNOFILE=8192:16384
    User=kopano
    Group=kopano
    

    And i did not touch any system files.
    So whats changed here or this server is not up2date/missing a reboot.

    you can try to change this file to :
    /etc/systemd/system.conf :DefaultLimitNOFILE=65536
    and
    /etc/systemd/user.conf :DefaultLimitNOFILE=65536

    As workaround.



  • @fbartels … well a first step … “medium” for a bug that breaks core functionalities ? When will there be a fix?


  • Kopano

    @mahescho said in movetopublicfolder.py error No module named 'ConfigParser':

    When will there be a fix?

    Please be aware that this is a community forum. If you want to priorities something I recommend to open up a support call instead.



  • @mahescho

    if its really a thing for you.
    add the in /etc/aliasses

    emailadres:  "|/usr/bin/kopano-dagent -C -P 'FolderNAME' kopanoadmin"
    

    Change foldername and kopanoadmin to you needs, and if you want subfolders use ‘SUBFOLDER\\FolderNAME’



  • Personaly, what i would do here.

    create a ldap filter, move the disabled account to a separated OU and use the filter to redirect these to and other mail folder, for example.

    query_filter = (&(objectClass=contact)(mail=%s))
    result_attribute = displayName
    

    Lookup email adres %s, and forward it to displayName.

    here i did put in the displayName the value “|/usr/bin/kopano-dagent -C -P ‘FolderNAME’ kopanoadmin”
    and this way you can do it all from AD.

    You can (ab)use any field in AD which isnt used already.


Log in to reply