Skip to content

Commit cfe6290

Browse files
Add D-Bus installation to restarter logic
Signed-off-by: Kate Goldenring <[email protected]>
1 parent 272c73d commit cfe6290

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

cmd/node-installer/install.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,6 @@ func RunInstall(config Config, rootFs, hostFs afero.Fs, restarter containerd.Res
116116
return nil
117117
}
118118

119-
// Ensure D-Bus is installed and running if using systemd
120-
if containerd.UsesSystemd() {
121-
err = containerd.InstallDbus()
122-
if err != nil {
123-
return fmt.Errorf("failed to install D-Bus: %w", err)
124-
}
125-
}
126-
127119
slog.Info("restarting containerd")
128120
err = containerdConfig.RestartRuntime()
129121
if err != nil {

internal/containerd/install_dbus.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func InstallDbus() error {
2929
slog.Info("D-Bus is already installed and running")
3030
return nil
3131
}
32-
slog.Info("Installing D-Bus")
32+
slog.Info("installing D-Bus")
3333
whichApt := nsenterCmd("which", "apt-get")
3434
whichYum := nsenterCmd("which", "yum")
3535
whichDnf := nsenterCmd("which", "dnf")
@@ -63,7 +63,7 @@ func InstallDbus() error {
6363
return nil
6464
}
6565

66-
slog.Info("Restarting D-Bus")
66+
slog.Info("restarting D-Bus")
6767
cmd = nsenterCmd("systemctl", "restart", "dbus")
6868
if err := cmd.Run(); err != nil {
6969
return fmt.Errorf("failed to restart D-Bus: %w", err)

internal/containerd/restart_unix.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ func NewRestarter() Restarter {
3636
}
3737

3838
func (c restarter) Restart() error {
39+
// To make sure any runtime options are applied, ensure D-Bus is
40+
// installed and running if using systemd
41+
if UsesSystemd() {
42+
err := InstallDbus()
43+
if err != nil {
44+
return fmt.Errorf("failed to install D-Bus: %w", err)
45+
}
46+
}
47+
3948
pid, err := getPid()
4049
if err != nil {
4150
return err

0 commit comments

Comments
 (0)