Merge "Enhance way to check if host is updated"
This commit is contained in:
@@ -194,11 +194,11 @@ def get_all_feed_commits(patch_sw_version):
|
|||||||
|
|
||||||
def get_latest_deployment_commit():
|
def get_latest_deployment_commit():
|
||||||
"""
|
"""
|
||||||
Get the active deployment commit ID
|
Get the latest deployment commit ID (pending or active)
|
||||||
:return: The commit ID associated with the active commit
|
:return: The commit ID associated with the latest commit or None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Sample command and output that is parsed to get the active commit
|
# Sample command and output that is parsed to get the latest commit
|
||||||
# associated with the deployment
|
# associated with the deployment
|
||||||
#
|
#
|
||||||
# Command: ostree admin status
|
# Command: ostree admin status
|
||||||
@@ -208,7 +208,6 @@ def get_latest_deployment_commit():
|
|||||||
# debian 0658a62854647b89caf5c0e9ed6ff62a6c98363ada13701d0395991569248d7e.0 (pending)
|
# debian 0658a62854647b89caf5c0e9ed6ff62a6c98363ada13701d0395991569248d7e.0 (pending)
|
||||||
# origin refspec: starlingx
|
# origin refspec: starlingx
|
||||||
# * debian a5d8f8ca9bbafa85161083e9ca2259ff21e5392b7595a67f3bc7e7ab8cb583d9.0
|
# * debian a5d8f8ca9bbafa85161083e9ca2259ff21e5392b7595a67f3bc7e7ab8cb583d9.0
|
||||||
# Unlocked: hotfix
|
|
||||||
# origin refspec: starlingx
|
# origin refspec: starlingx
|
||||||
|
|
||||||
cmd = "ostree admin status"
|
cmd = "ostree admin status"
|
||||||
@@ -225,12 +224,10 @@ def get_latest_deployment_commit():
|
|||||||
# Store the output of the above command in a string
|
# Store the output of the above command in a string
|
||||||
output_string = output.stdout.decode('utf-8')
|
output_string = output.stdout.decode('utf-8')
|
||||||
|
|
||||||
# Parse the string to get the active commit on this deployment
|
match = re.search(r'\b(\w+)\.\d+\b', output_string)
|
||||||
# Trim everything before * as * represents the active deployment commit
|
if match:
|
||||||
trimmed_output_string = output_string[output_string.index("*"):]
|
return match.group(1)
|
||||||
split_output_string = trimmed_output_string.split()
|
return None
|
||||||
active_deployment_commit = split_output_string[2]
|
|
||||||
return active_deployment_commit
|
|
||||||
|
|
||||||
|
|
||||||
def update_repo_summary_file(repo_path):
|
def update_repo_summary_file(repo_path):
|
||||||
|
@@ -554,6 +554,16 @@ class PatchAgent(PatchService):
|
|||||||
active_sysroot_commit, self.latest_feed_commit)
|
active_sysroot_commit, self.latest_feed_commit)
|
||||||
self.changes = True
|
self.changes = True
|
||||||
|
|
||||||
|
latest_deployment_commit = ostree_utils.get_latest_deployment_commit()
|
||||||
|
if latest_deployment_commit:
|
||||||
|
if latest_deployment_commit != self.latest_feed_commit:
|
||||||
|
LOG.info("Latest deployment Commit:%s does not match "
|
||||||
|
"active controller's Feed Repo Commit: %s",
|
||||||
|
latest_deployment_commit, self.latest_feed_commit)
|
||||||
|
self.changes = True
|
||||||
|
else:
|
||||||
|
self.changes = False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def handle_install(self,
|
def handle_install(self,
|
||||||
|
Reference in New Issue
Block a user