Skip to content
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

OCPBUGS-197: daemon: Add a workaround for bug 2111817 #3292

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 29 additions & 0 deletions pkg/daemon/rpm-ostree.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -99,6 +100,30 @@ func (r *RpmOstreeClient) loadStatus() (*rpmOstreeState, error) {
return &rosState, nil
}

// See https://bugzilla.redhat.com/show_bug.cgi?id=2111817
func bug2111817Workaround() error {
targetUnit := "/run/systemd/system/rpm-ostreed.service.d/bug2111817.conf"
// Do nothing if the file exists
if _, err := os.Stat(targetUnit); err == nil {
return nil
}
err := os.MkdirAll(filepath.Dir(targetUnit), 0o755)
if err != nil {
return err
}
dropin := `[Service]
InaccessiblePaths=
`
if err := writeFileAtomicallyWithDefaults(targetUnit, []byte(dropin)); err != nil {
return err
}
if err := runCmdSync("systemctl", "daemon-reload"); err != nil {
return err
}
glog.Infof("Enabled workaround for bug 2111817")
return nil
}

func (r *RpmOstreeClient) Initialize() error {
// This replicates https://github.com/coreos/rpm-ostree/pull/2945
// and can be removed when we have a new enough rpm-ostree with
Expand Down Expand Up @@ -132,6 +157,10 @@ func (r *RpmOstreeClient) Initialize() error {
}
}

if err := bug2111817Workaround(); err != nil {
return err
}

return nil
}

Expand Down