Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions scripts/image-builder/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ clean_osbuilder_services() {
fi

title "Stopping osbuild services"
sudo systemctl stop --now osbuild-composer.socket osbuild-composer.service
for n in $(seq 100) ; do
worker=osbuild-worker@${n}.service
if sudo systemctl status "${worker}" &>/dev/null ; then
sudo systemctl stop --now "osbuild-worker@${n}.service"
sudo systemctl stop "osbuild-worker@${n}.service"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we remove --now? Does it have no effect during stop?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--now is only meaningful for enable and disable and results in immediate start (enable) and stop (disable)

else
break
fi
done
# Don't stop the .socket as it can cause composer.service to fail
# stopping resulting in failed restarts which cause problem starting later.
sudo systemctl stop osbuild-composer.service
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment about stopping osbuild-composer.socket here?


title "Cleaning osbuild worker cache"
sleep 5
Expand All @@ -79,19 +81,12 @@ restart_osbuilder_services() {
return
fi

if ! systemctl is-active -q osbuild-composer.socket &>/dev/null ; then
if ! systemctl is-active -q osbuild-composer.service &>/dev/null ; then
title "Starting osbuild services"
sudo systemctl start osbuild-composer.socket
for try in $(seq 3); do
sleep 1 # Give composer some time to be ready for workers
if sudo systemctl start osbuild-worker@1.service; then
break
else
if [ "${try}" -eq 2 ]; then
return 1
fi
fi
done
sudo systemctl start osbuild-worker@1.service
# Thanks to osbuild-composer.socket, starting worker should be enough
# to start the composer, but left it just in case.
sudo systemctl start osbuild-composer.service
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the start order be inverted here as we're first stopping workers now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I found that we don't even need to start composer. Thanks to the socket, starting workers will cause composer to start but left it just in case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment about this?

fi
}

Expand Down