After a change in how apps are being upgraded during a platform
upgrade, from CLI commands (considered 'manual') to automatic
operations done by the app framework, the 'pre_update' method is
not being called due to the hook being considered of a different
type (APP_LIFECYCLE_MODE_AUTO instead of APP_LIFECYCLE_MODE_MANUAL).
This change use a different condition to decided when to call the
'pre_update' method to account for the change in the app framework:
- We will use the lifecycle type 'resource' for both 'auto' and
'manual' modes, instead of 'check' only with 'manual' mode.
The 'check' is constantly called at runtime for auto updates,
and we only want to execute the 'pre_update' if the update is
indeed in progress (after the check stage).
- Due to this change, we need to make another change in the
clean up method, it needs to use the operation type 'apply'
instead of 'update', otherwise the 'pre_update' method will be
called again and we will end in a loop.
Also include changes to account for rollback:
- We don't want reevaluate the Post-upgrade override if it's
already filled, otherwise we will consider the temporary override
to disable the webhook as a permanent one;
- Since a rollback can still be done after the platform upgrade
deploy is in the completed stage (but sysinv start processing
updates for the apps again in this stage), don't clean up the
the temporary overrides until the upgrade deploy is deleted
(platform upgrade ends properly after it).
Test plan:
PASS: Perform upgrade (AIO-SX).
PASS: Perform upgrade activation rollback (AIO-SX).
PASS: App install (system application-upload/apply).
PASS: App upversion (system application-update).
Story: 2011357
Task: 52710
Change-Id: I96898bcc556272d9b50fcccb65b5fa304da02d7f
Signed-off-by: Marcelo de Castro Loebens <Marcelo.DeCastroLoebens@windriver.com>