Update summary in apt-ostree repos
When ostree changes a repository it requires a summary update for the changes to be seen by clients of this remote repository. This commit adds summary update call after every change in the repo. Test Plan: PASS: Deploy a host after a deploy start to apply PASS: Undeploy a host after a deploy start to remove PASS: Undeploy a host after an abort Story: 2010676 Task: 51017 Change-Id: I276fd823b81db8c66cb0c83f8ab19f963d182bf0 Signed-off-by: Lindley Vieira <lindley.vieira@windriver.com>
This commit is contained in:
parent
140aef0201
commit
fe0404eae9
@ -148,7 +148,10 @@ class Bootstrap:
|
||||
if r.returncode != 0:
|
||||
self.logging.info(f"Failed to commit {self.state.branch} to "
|
||||
f"{self.state.repo}.")
|
||||
self.logging.info(f"Commited {self.state.repo} to {self.state.repo}.")
|
||||
else:
|
||||
self.logging.info(f"Commited {self.state.branch} to "
|
||||
f"{self.state.repo}.")
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
|
||||
def create_ostree(self, rootdir):
|
||||
"""Create an ostree branch from a rootfs."""
|
||||
|
@ -46,6 +46,8 @@ class Compose:
|
||||
self.logging.info(f"Rollback back to {commit}.")
|
||||
self.ostree.ostree_rollback(commit)
|
||||
|
||||
self.ostree.ostree_summary_update()
|
||||
|
||||
def backup(self, export_dir):
|
||||
"""Export branch to a new ostree repo."""
|
||||
export_dir = pathlib.Path(export_dir)
|
||||
@ -58,6 +60,8 @@ class Compose:
|
||||
f"Pulling from {self.state.branch} to {export_dir}.")
|
||||
self.ostree.ostree_pull(export_dir)
|
||||
|
||||
self.ostree.ostree_summary_update(export_dir)
|
||||
|
||||
def restore(self, import_dir):
|
||||
"""Import a branch into a repostiory."""
|
||||
import_dir = pathlib.Path(import_dir)
|
||||
@ -70,6 +74,8 @@ class Compose:
|
||||
f"Pulling from {self.state.branch} to {import_dir}.")
|
||||
self.ostree.ostree_pull(import_dir)
|
||||
|
||||
self.ostree.ostree_summary_update(import_dir)
|
||||
|
||||
def enablerepo(self):
|
||||
"""Enable Debian package feed."""
|
||||
try:
|
||||
@ -112,6 +118,7 @@ class Compose:
|
||||
|
||||
self.logging.info(f"Successfully commited {self.state.branch}"
|
||||
f"({rev[:10]}) from {parent}.")
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
self.logging.info("Cleaning up.")
|
||||
try:
|
||||
shutil.rmtree(self.rootfs)
|
||||
|
@ -193,6 +193,14 @@ class Ostree:
|
||||
|
||||
return refspec
|
||||
|
||||
def ostree_summary_update(self, repo=None):
|
||||
"""Update the summary"""
|
||||
if not repo:
|
||||
repo = self.state.repo
|
||||
return run_command(
|
||||
["ostree", "summary", "-u", f"--repo={repo}"],
|
||||
check=True)
|
||||
|
||||
def remotes_list(self):
|
||||
"""Fetch list of remote hosts."""
|
||||
try:
|
||||
|
@ -80,6 +80,7 @@ class Packages:
|
||||
subject="New packages",
|
||||
msg=commit,
|
||||
)
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
|
||||
# Step 7 - Cleanup
|
||||
self.deploy.cleanup(rootfs)
|
||||
@ -142,6 +143,7 @@ class Packages:
|
||||
subject="Package Upgrade",
|
||||
msg=commit,
|
||||
)
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
|
||||
# Step 7 - Cleanup
|
||||
self.deploy.cleanup(rootfs)
|
||||
@ -184,6 +186,7 @@ class Packages:
|
||||
subject="Uninstall packages",
|
||||
msg=commit,
|
||||
)
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
|
||||
# Step 7 - Cleanup
|
||||
self.deploy.cleanup(rootfs)
|
||||
|
@ -120,6 +120,7 @@ class Rebase:
|
||||
subject=subject,
|
||||
msg=commit
|
||||
)
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
|
||||
self.deploy.cleanup(rootfs)
|
||||
|
||||
@ -130,8 +131,9 @@ class Rebase:
|
||||
if refs != "origin"]
|
||||
|
||||
def _fetch(self, remote, branch):
|
||||
"""Wrapper around ostree fertch."""
|
||||
"""Wrapper around ostree fetch."""
|
||||
self.ostree.fetch(remote, branch)
|
||||
self.ostree.ostree_summary_update()
|
||||
|
||||
def get_current_packages(self, branch, ref):
|
||||
"""Steps to prepare the systeem before a rebase."""
|
||||
|
@ -169,6 +169,8 @@ class Repo:
|
||||
)
|
||||
if r.returncode != 0:
|
||||
self.logging.error("Failed to commit to repository.")
|
||||
else:
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
self.deploy.cleanup(str(rootfs))
|
||||
|
||||
def add_repo(self):
|
||||
@ -205,4 +207,6 @@ class Repo:
|
||||
)
|
||||
if r.returncode != 0:
|
||||
self.logging.error("Failed to commit to repository")
|
||||
else:
|
||||
self.ostree.ostree_summary_update(self.state.repo)
|
||||
self.deploy.cleanup(str(rootfs))
|
||||
|
Loading…
x
Reference in New Issue
Block a user