Skip to content

Commit 8c792a9

Browse files
committed
Prevent conflicting services starting
We either want to import a cluster and add a node, or register a cluster and start installation. Never both. Record this in the systemd units.
1 parent c37fc74 commit 8c792a9

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

data/data/agent/systemd/units/agent-add-node.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
Description=Adds the current node to an already existing cluster
33
Wants=network-online.target
44
Requires=apply-host-config.service
5+
Conflicts=start-cluster-installation.service
56
PartOf=assisted-service-pod.service
67
After=network-online.target apply-host-config.service
78
ConditionPathExists=/etc/assisted/node0
9+
ConditionPathExists=/etc/assisted/add-nodes.env
810

911
[Service]
1012
EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env

data/data/agent/systemd/units/agent-import-cluster.service.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[Unit]
22
Description=Imports an already existing cluster
33
Wants=network-online.target assisted-service.service
4+
Conflicts=agent-register-cluster.service
45
PartOf=assisted-service-pod.service
56
After=network-online.target assisted-service.service
67
ConditionPathExists=/etc/assisted/node0
8+
ConditionPathExists=/etc/assisted/add-nodes.env
79

810
[Service]
911
Environment=PODMAN_SYSTEMD_UNIT=%n

data/data/agent/systemd/units/agent-register-cluster.service.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[Unit]
22
Description=Service that registers the cluster
33
Wants=network-online.target assisted-service.service
4+
Conflicts=agent-import-cluster.service
45
PartOf=assisted-service-pod.service
56
After=network-online.target assisted-service.service
67
ConditionPathExists=/etc/assisted/node0
8+
ConditionPathExists=!/etc/assisted/add-nodes.env
79

810
[Service]
911
Environment=PODMAN_SYSTEMD_UNIT=%n

data/data/agent/systemd/units/start-cluster-installation.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
Description=Service that starts cluster installation
33
Wants=network-online.target
44
Requires=apply-host-config.service
5+
Conflicts=agent-add-node.service
56
PartOf=assisted-service-pod.service
67
After=network-online.target apply-host-config.service
78
ConditionPathExists=/etc/assisted/node0
9+
ConditionPathExists=!/etc/assisted/add-nodes.env
810

911
[Service]
1012
EnvironmentFile=/usr/local/share/assisted-service/assisted-service.env

0 commit comments

Comments
 (0)