Bug 30596 - Removing extended attributes during uninstallation
Removing extended attributes during uninstallation
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: univention-lib
UCS 3.1
Other Linux
: P5 normal (vote)
: UCS 3.1-0-errata
Assigned To: Stefan Gohmann
Sönke Schwardt-Krummrich
:
: 30555 (view as bug list)
Depends on: 30555
Blocks: 31268 32999
  Show dependency treegraph
 
Reported: 2013-02-27 07:08 CET by Stefan Gohmann
Modified: 2013-10-29 10:29 CET (History)
2 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2013-02-27 07:08:05 CET
The apps don't remove the extended attributes during the uninstallation of the apps. univention-lib should provide an simple interface to remove these attributes.
Comment 1 Stefan Gohmann univentionstaff 2013-03-14 14:56:18 CET
The following functions have been added to the univention lib:
 - ucs_removeServiceFromLocalhost
 - ucs_removeServiceFromHost
 - ucs_isServiceUnused
 - ucs_registerLDAPSchema
 - call_unjoinscript

The function ucs_registerLDAPSchema copies the given schema to the directory /var/lib/univention-ldap/local-schema/. Thus it is possible to uninstall the package and the schema remains on the system. The slapd.conf UCR subtemplate 25univention-ldap-server_local-schema makes this possible.

To remove the Extended Attributes the App can provide an unjoin script, for example:
 /usr/lib/univention-uninstall/92univention-fetchmail.uninst

The App should by default register a service entry for the host. If the service entry is removed in the unjoin script, the unjoin script could also recognize that the extended attributes could be removed.

While the package is uninstalled this unjoin script could be called, for example:

From the prerm script:
if [ "$1" = "remove" ]; then
   cp /usr/lib/univention-uninstall/92univention-fetchmail.uninst /usr/lib/univention-install/
fi

From the postrm script:
if [ "$1" = "remove" ]; then
   . /usr/share/univention-lib/all.sh
   call_unjoinscript 92univention-fetchmail.uninst
fi


Currently we don't have any App which has on of the default master packages as part of the default packages. So we can change per converted App the support of the un-installation as we move the defaultmaster packages to the default packages.

The only case which will not work currently is, if you install OX on a DC Slave. In this case the UDM module packages will be installed on the DC Master and during the uninstallation on the DC Slave the UDM packages won't be removed.
But the Admin can uninstall the package manually and in a later app center version we can ask the Admin if the packages should be removed from DC Master.

The following packages do have DefaultMasterPackages and should be converted:

 - agorumcore-pro
 - asterisk4ucs_20130304
 - kolab
 - owncloud_20130313
 - oxseforucs
 - sugarcrm_20130103
 - ucc_20130218
 - zarafa_20130228
 - fetchmail
Comment 2 Stefan Gohmann univentionstaff 2013-03-14 14:56:23 CET
*** Bug 30555 has been marked as a duplicate of this bug. ***
Comment 3 Stefan Gohmann univentionstaff 2013-03-18 07:34:44 CET
(In reply to comment #1)
> To remove the Extended Attributes the App can provide an unjoin script, for
> example:
>  /usr/lib/univention-uninstall/92univention-fetchmail.uninst
> 
> The App should by default register a service entry for the host. If the service
> entry is removed in the unjoin script, the unjoin script could also recognize
> that the extended attributes could be removed.
> 
> While the package is uninstalled this unjoin script could be called, for
> example:
> 
> From the prerm script:
> if [ "$1" = "remove" ]; then
>    cp /usr/lib/univention-uninstall/92univention-fetchmail.uninst
> /usr/lib/univention-install/
> fi
> 
> From the postrm script:
> if [ "$1" = "remove" ]; then
>    . /usr/share/univention-lib/all.sh
>    call_unjoinscript 92univention-fetchmail.uninst
> fi
> 
> 

From preinst:
if [ "$1" = "configure" ]; then
        test -e /usr/lib/univention-install/92univention-fetchmail.uninst && rm /usr/lib/univention-install/92univention-fetchmail.uninst
fi
Comment 4 Stefan Gohmann univentionstaff 2013-03-22 09:47:16 CET
univention-fetchmail is the first app using this extension, available in the test app center:
 ucr set repository/app_center/server=appcenter.test.software-univention.d


The following scenarios have been tested successful with UCS 3.1-0 errata and UCS 3.1-1:

- Installation Master → Uninstallation Master → Extended attributes are not available

- Installation Master + Installation Backup → Uninstallation Master → Extended attributes are available

- Installation Member → Uninstallation Member → Extended attributes are not available

- Installation Member → Uninstallation Member → Installation Member → Running join scripts → Extended attributes are available

On a 3.1-0 errata system you have to run univention-run-join-scripts manually. On a 3.1-1 system you get a notice that scripts have to be executed. That is very nice.

The following things do not work currently:

- Installation of an app on a dc slave which uses UDM modules, for example OX. If the app was removed on the dc slave the UDM modules still on the dc master. Workaround: uninstall the integration package on the dc master via extended software management. 

YAML files for univention-ldap, univention-join and univention-lib have been added.
Comment 5 Sönke Schwardt-Krummrich univentionstaff 2013-03-22 17:56:54 CET
(In reply to comment #3)
> From preinst:
> if [ "$1" = "configure" ]; then
>       test -e /usr/lib/univention-install/92univention-fetchmail.uninst && \
>            rm /usr/lib/univention-install/92univention-fetchmail.uninst
> fi

For the record:
The comparison in the preinst should check for "install" and not for "configure". This has been committed to SVN correctly:
---[univention-fetchmail.preinst]---
if [ "$1" = "install" ]; then
  …
fi


(In reply to comment #4)
> univention-fetchmail is the first app using this extension, available in the
> test app center:
>  ucr set repository/app_center/server=appcenter.test.software-univention.de

→ OK

> The following scenarios have been tested successful with UCS 3.1-0 errata and
> UCS 3.1-1:

Test with 3.1-0 errata 57:
1) Install Master → ExtAttr available → Deinstall Master → ExtAttr not available

2) Install Backup → Install Slave → Install Member → run join scripts on all systems → ExtAttr available → Deinstall Backup → Deinstall Slave → run join scripts → ExtAttr available → Deinstall Member → run join scripts → ExtAttr not available

Test with 3.1-0 errata 75:
different setups with master/backup/slave/member mixed

Test with 3.1-1:
3) Install Member → Install Slave → join scripts → ExtAttr available → Deinstall Member → join scripts → ExtAttr available → Deinstall Slave → ExtAttr available → join scripts → Ext Attr unavailable

→ all tests have been successful

> On a 3.1-0 errata system you have to run univention-run-join-scripts manually.
→ OK
→ Hint: the UMC module "domain join" does not mention unexecuted "unjoin" 
        scripts!

> On a 3.1-1 system you get a notice that scripts have to be executed. That is
> very nice.

→ OK, all join and unjoin scripts are shown in UMC module "domain join"

> The following things do not work currently:
> 
> - Installation of an app on a dc slave which uses UDM modules, for example OX.
> If the app was removed on the dc slave the UDM modules still on the dc master.
> Workaround: uninstall the integration package on the dc master via extended
> software management. 
> 
> YAML files for univention-ldap, univention-join and univention-lib have been
> added.

→ YAML files are ok

Some minor glitches in the code have been documented in Bug #30882.