Fix deploy abort fails to get release id
During software deploy abort it fails to get the release id. This commit changes how the release id is set. Test Plan: PASS: deploy abort stx10 to stx8 PASS: pkg-build and build-image PASS: host-install\unlock Story: 2010676 Task: 50733 Change-Id: I41ee240e07d91619f23465d46376981212014748 Signed-off-by: Luis Eduardo Bonatti <LuizEduardo.Bonatti@windriver.com>
This commit is contained in:
@@ -89,6 +89,8 @@ SEMANTIC_ACTIONS = [SEMANTIC_PREAPPLY, SEMANTIC_PREREMOVE]
|
||||
|
||||
CHECKOUT_FOLDER = "checked_out_commit"
|
||||
|
||||
COMMIT_DEFAULT_VALUE = "xxxBASECOMMITxxx"
|
||||
|
||||
FEED_DIR = "/var/www/pages/feed/"
|
||||
UPGRADE_FEED_DIR = FEED_DIR
|
||||
TMP_DIR = "/tmp"
|
||||
|
||||
@@ -296,6 +296,14 @@ class SWReleaseCollection(object):
|
||||
return sw_release
|
||||
return None
|
||||
|
||||
def get_release_id_by_sw_release(self, sw_release):
|
||||
sorted_list = sorted(self._sw_releases)
|
||||
for rel_id in sorted_list:
|
||||
rel_data = self._sw_releases[rel_id]
|
||||
if rel_data.sw_release == sw_release:
|
||||
return rel_data.id
|
||||
return None
|
||||
|
||||
def iterate_releases_by_state(self, state):
|
||||
'''return iteration of releases matching specified state.
|
||||
sorted by id in ascending order
|
||||
|
||||
@@ -3104,8 +3104,8 @@ class PatchController(PatchService):
|
||||
deploy = self.db_api_instance.get_current_deploy()
|
||||
from_release = deploy.get("from_release")
|
||||
to_release = deploy.get("to_release")
|
||||
from_release_deployment = constants.RELEASE_GA_NAME % from_release
|
||||
to_release_deployment = constants.RELEASE_GA_NAME % to_release
|
||||
from_release_deployment = self.release_collection.get_release_id_by_sw_release(from_release)
|
||||
to_release_deployment = self.release_collection.get_release_id_by_sw_release(to_release)
|
||||
|
||||
try:
|
||||
is_major_release = ReleaseState(release_state=states.DEPLOYING).is_major_release_deployment()
|
||||
@@ -3121,7 +3121,7 @@ class PatchController(PatchService):
|
||||
commit_id = deploy_release.commit_id
|
||||
|
||||
# TODO(lbonatti): remove this condition when commit-id is built into GA metadata.
|
||||
if commit_id is None:
|
||||
if commit_id in [constants.COMMIT_DEFAULT_VALUE, None]:
|
||||
commit_id = ostree_utils.get_feed_latest_commit(deploy_release.sw_version)
|
||||
|
||||
# Update the deployment
|
||||
|
||||
Reference in New Issue
Block a user