Skip to content

Commit

Permalink
Merge pull request #3292 from sinnykumari/release-4.11
Browse files Browse the repository at this point in the history
OCPBUGS-197: daemon: Add a workaround for bug 2111817
  • Loading branch information
openshift-merge-robot authored Aug 18, 2022
2 parents 8a0ada1 + aef55a4 commit 54a105e
Showing 1 changed file with 29 additions and 0 deletions.
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

0 comments on commit 54a105e

Please sign in to comment.