Fuel plugin builder executes uninstall.sh upon upgrade
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Fuel for OpenStack |
Fix Released
|
High
|
Alexander Kislitsky |
Bug Description
It is possible to upgrade an installed Fuel plugin on place. In general it's just an RPM upgrade. Fuel plugins have quite basic RPM spec with no condition set for %preun hook.
%post hook runs post-install.sh script
%preun hook runs uninstall.sh script
The order of operations during an upgrade is the following:
1. Run the %pre section of the RPM being installed.
2. Install the files that the RPM provides.
3. Run the %post section of the RPM.
4. Run the %preun of the old package.
5. Delete any old files not overwritten by the newer version. (This step deletes files that the new package does not require.)
6. Run the %postun hook of the old package.
As you can see uninstall.sh is running after post-install.sh script during upgrade breaking plugin installation.
It makes sense to add condition to %preun hook:
%preun
if [ "$1" -lt 1 ]; then
${ uninstall_hook }
fi
so it is not executed upon upgrade.
Steps to reproduce:
1. Create plugin with post-install.sh creating and uninstall.sh removing some directory.
2. Install plugin version "A"
3. Bump plugin version in metadata.yaml
4. Update plugin to version "B"
fuel plugins --update <plugin-B>.rpm
Expected results:
Directory created by post-install.sh exists.
Actual result:
Directory created by post-install.sh is removed during update.
Workaround:
You can create anchor files in post-install.sh showing if it's the first time post-install.sh being executed. If they exist exit from uninstall.sh.
Impact:
all plugins built using fuel plugin builder with post-install.sh and uninstall.sh scripts. Plugin engine 3+ I believe.
tags: | added: area-plugins |
Changed in fuel: | |
importance: | Undecided → High |
status: | New → Confirmed |
milestone: | none → 9.0 |
assignee: | nobody → Fuel Python Team (fuel-python) |
tags: | added: area-python |
tags: | added: feature-plugins |
Changed in fuel: | |
assignee: | Fuel Python Team (fuel-python) → Alexander Kislitsky (akislitsky) |
tags: | added: on-verification |
Fix proposed to branch: master /review. openstack. org/302306
Review: https:/