Univention Bugzilla – Bug 46454
create policy/mailquota removal script
Last modified: 2018-06-06 16:16:26 CEST
+++ This bug was initially created as a clone of Bug #46102 +++ Write a script and deliver it with univention-mail-postfix, so that it will be available on all installations. The script should search for policies/mailquota and delete them. It should by default do a dry-run and only if executed with "--force" actually delete.
I pushed the WIP into branch dtroeder/46454_mailquota_removal.
Contains code to workaround Bug #16966.
The script removes quote policies, references to them and the UDM module itself. It the module itself cannot be found, direct LDAP modifications are used. ------------------------------------------------------------------------------- # /usr/share/univention-mail-postfix/remove_mail_quota_policy -h usage: remove_mail_quota_policy [-h] [-m] [-v] Remove Cyrus mail quota policy references and objects from LDAP. optional arguments: -h, --help show this help message and exit -m, --modify Commit changes to LDAP [default: False (dry run)]. -v, --verbose Enable debugging output on the console [default: False]. All output (incl. debugging statements) is written to logfile '/var/log/univention/remove_mail_quota_policy.log'. ------------------------------------------------------------------------------- [4.3-0] 150d7335d0 Bug #46454: WIP policy/mailquota removal script [4.3-0] 389f01a435 Bug #46454: mailquota removal script [4.3-0] afb0687051 Bug #46454: changelog [4.3-0] d7fe37790a Bug #46454: actually install script [4.3-0] 71e77d0ecb Bug #46454: changelog [4.3-0] a99044d11e Bug #46454: advisory univention-mail-postfix (12.0.0-19)
--- mirror/ftp/4.3/unmaintained/4.3-0/source/univention-mail-postfix_12.0.0-17A~4.3.0.201803010914.dsc +++ apt/ucs_4.3-0-errata4.3-0/source/univention-mail-postfix_12.0.0-19A~4.3.0.201803271143.dsc @@ -1,6 +1,14 @@ -12.0.0-17A~4.3.0.201803010914 [Thu, 01 Mar 2018 09:14:58 +0100] Univention builddaemon <buildd@univention.de>: +12.0.0-19A~4.3.0.201803271143 [Tue, 27 Mar 2018 11:43:43 +0200] Univention builddaemon <buildd@univention.de>: * UCS auto build. No patches were applied to the original source package + +12.0.0-19 [Tue, 27 Mar 2018 11:42:57 +0200] Daniel Troeder <troeder@univention.de>: + + * Bug #46454: actually install script + +12.0.0-18 [Tue, 27 Mar 2018 11:35:30 +0200] Daniel Troeder <troeder@univention.de>: + + * Bug #46454: add mailquota policy removal script 12.0.0-17 [Thu, 01 Mar 2018 08:59:47 +0100] Daniel Troeder <troeder@univention.de>:
root@master41:~# ./remove_mail_quota_policy -m Searching Cyrus mail quota objects in LDAP. UsersContainerQuota Quota: 1234 DN: 'cn=UsersContainerQuota,cn=mail,cn=policies,dc=nstx,dc=local' referenced by 'cn=users,dc=nstx,dc=local'. referenced by 'uid=user5,cn=users,dc=nstx,dc=local'. User1Quota Quota: 123 DN: 'cn=User1Quota,cn=mail,cn=policies,dc=nstx,dc=local' referenced by 'uid=user1,cn=users,dc=nstx,dc=local'. referenced by 'uid=user4,cn=users,dc=nstx,dc=local'. * UsersContainerQuota: removing policy references. removing policy reference from 'cn=users,dc=nstx,dc=local'. done. removing policy reference from 'uid=user5,cn=users,dc=nstx,dc=local'. Traceback (most recent call last): File "./remove_mail_quota_policy", line 210, in <module> qr.remove_policies() File "./remove_mail_quota_policy", line 151, in remove_policies obj.modify() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 1673, in modify return super(object, self).modify(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 524, in modify self.ready() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 303, in ready raise univention.admin.uexceptions.insufficientInformation(_('The following properties are missing:\n%s') % ('\n'.join(missing),)) univention.admin.uexceptions.insufficientInformation: The following properties are missing: primaryGroup root@master41:~# lsb_release -r Release: 4.3-0 errata0 root@master41:~#
After obj = mod.lookup(None, self.lo, filter_s, base=base)[0] no obj.open() is performed. Therefore not all attributes are initialized to be able to perform a proper obj.modify(). Fixed in 97b9fd835b Bug #46454: fix traceback due to "un-open-ed" UDM object 7f50282401 Bug #46454: update advisory Package: univention-mail-postfix Version: 12.0.0-20A~4.3.0.201806052141 Branch: ucs_4.3-0 Scope: errata4.3-0 OK: code change OK: functional test (4.3) OK: remove with existing UDM module OK: remove w/o existing UDM modules (removed users/user, container/cn, policies/mailquota for this test) OK: changelog OK: advisory
<http://errata.software-univention.de/ucs/4.3/99.html>