Skip to content

OCPBUGS-60583: Unblock cluster installation when dependent systemd unit fails #9845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions data/data/agent/files/usr/local/bin/wait-for-service-active.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

systemd_service="$1"

echo "Waiting for $systemd_service to be ready"

until systemctl is-active --quiet $systemd_service; do
printf '.'
sleep 5
done
4 changes: 2 additions & 2 deletions data/data/agent/systemd/units/apply-host-config.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Unit]
Description=Service that applies host-specific configuration
Wants=network-online.target
Requires=agent-register-infraenv.service
Wants=network-online.target agent-register-infraenv.service
PartOf=assisted-service-pod.service
After=network-online.target agent-register-infraenv.service
ConditionPathExists=/etc/assisted/node0
Expand All @@ -15,6 +14,7 @@ EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStartPre=/bin/mkdir -p %t/agent-installer /etc/assisted/hostconfig
ExecStartPre=/usr/local/bin/wait-for-assisted-service.sh
ExecStartPre=/usr/local/bin/wait-for-service-active.sh agent-register-infraenv.service
ExecStart=podman run --net host --cidfile=%t/%n.ctr-id --cgroups=no-conmon --log-driver=journald --restart=on-failure:10 --pod-id-file=%t/assisted-service-pod.pod-id --replace --name=apply-host-config -v /etc/assisted/hostconfig:/etc/assisted/hostconfig -v %t/agent-installer:/var/run/agent-installer:z --env SERVICE_BASE_URL --env INFRA_ENV_ID --env WORKFLOW_TYPE --env USER_AUTH_TOKEN $SERVICE_IMAGE /usr/local/bin/agent-installer-client configure
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[Unit]
Description=Service that starts cluster installation
Wants=network-online.target
Requires=apply-host-config.service
Wants=network-online.target apply-host-config.service
Conflicts=agent-add-node.service
PartOf=assisted-service-pod.service
After=network-online.target apply-host-config.service
Expand All @@ -12,6 +11,7 @@ ConditionPathExists=!/etc/assisted/add-nodes.env
EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env
EnvironmentFile=/usr/local/share/start-cluster/start-cluster.env
EnvironmentFile=/etc/assisted/rendezvous-host.env
ExecStartPre=/usr/local/bin/wait-for-service-active.sh apply-host-config.service
ExecStartPre=/usr/local/bin/wait-for-assisted-service.sh
ExecStart=/usr/local/bin/start-cluster-installation.sh

Expand Down