mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
sanity, systemd: SELinux bits have moved to sandbox/selinux
SELinux related APIs were moved from release to the sandbox/selinux package. Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
This commit is contained in:
@@ -34,7 +34,6 @@ import (
|
||||
"github.com/snapcore/snapd/logger"
|
||||
"github.com/snapcore/snapd/osutil"
|
||||
"github.com/snapcore/snapd/osutil/squashfs"
|
||||
"github.com/snapcore/snapd/release"
|
||||
"github.com/snapcore/snapd/sandbox/selinux"
|
||||
)
|
||||
|
||||
@@ -114,7 +113,7 @@ func checkSquashfsMount() error {
|
||||
return err
|
||||
}
|
||||
options := []string{"-t", fstype}
|
||||
if release.SELinuxLevel() != release.NoSELinux {
|
||||
if selinux.ProbedLevel() != selinux.Unsupported {
|
||||
if ctx := selinux.SnapMountContext(); ctx != "" {
|
||||
options = append(options, "-o", "context="+ctx)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import (
|
||||
. "gopkg.in/check.v1"
|
||||
|
||||
"github.com/snapcore/snapd/osutil/squashfs"
|
||||
"github.com/snapcore/snapd/release"
|
||||
"github.com/snapcore/snapd/sandbox/selinux"
|
||||
"github.com/snapcore/snapd/sanity"
|
||||
"github.com/snapcore/snapd/testutil"
|
||||
)
|
||||
@@ -105,7 +105,7 @@ func (s *sanitySuite) TestCheckSquashfsMountSELinuxContext(c *C) {
|
||||
mockUmount := testutil.MockCommand(c, "umount", "")
|
||||
defer mockUmount.Restore()
|
||||
|
||||
mockSELinux := release.MockSELinuxIsEnabled(func() (bool, error) { return true, nil })
|
||||
mockSELinux := selinux.MockIsEnabled(func() (bool, error) { return true, nil })
|
||||
defer mockSELinux()
|
||||
|
||||
err := sanity.CheckSquashfsMount()
|
||||
|
||||
@@ -38,7 +38,6 @@ import (
|
||||
"github.com/snapcore/snapd/dirs"
|
||||
"github.com/snapcore/snapd/osutil"
|
||||
"github.com/snapcore/snapd/osutil/squashfs"
|
||||
"github.com/snapcore/snapd/release"
|
||||
"github.com/snapcore/snapd/sandbox/selinux"
|
||||
)
|
||||
|
||||
@@ -654,7 +653,7 @@ func (s *systemd) AddMountUnitFile(snapName, revision, what, where, fstype strin
|
||||
}
|
||||
options = append(options, newOptions...)
|
||||
fstype = newFsType
|
||||
if release.SELinuxLevel() != release.NoSELinux {
|
||||
if selinux.ProbedLevel() != selinux.Unsupported {
|
||||
if mountCtx := selinux.SnapMountContext(); mountCtx != "" {
|
||||
options = append(options, "context="+mountCtx)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
"github.com/snapcore/snapd/dirs"
|
||||
"github.com/snapcore/snapd/osutil"
|
||||
"github.com/snapcore/snapd/osutil/squashfs"
|
||||
"github.com/snapcore/snapd/release"
|
||||
"github.com/snapcore/snapd/sandbox/selinux"
|
||||
"github.com/snapcore/snapd/testutil"
|
||||
|
||||
. "github.com/snapcore/snapd/systemd"
|
||||
@@ -99,7 +99,7 @@ func (s *SystemdTestSuite) SetUpTest(c *C) {
|
||||
|
||||
s.rep = new(testreporter)
|
||||
|
||||
s.restoreSELinux = release.MockSELinuxIsEnabled(func() (bool, error) { return false, nil })
|
||||
s.restoreSELinux = selinux.MockIsEnabled(func() (bool, error) { return false, nil })
|
||||
}
|
||||
|
||||
func (s *SystemdTestSuite) TearDownTest(c *C) {
|
||||
@@ -572,7 +572,7 @@ WantedBy=multi-user.target
|
||||
}
|
||||
|
||||
func (s *SystemdTestSuite) TestWriteSELinuxMountUnit(c *C) {
|
||||
restore := release.MockSELinuxIsEnabled(func() (bool, error) { return true, nil })
|
||||
restore := selinux.MockIsEnabled(func() (bool, error) { return true, nil })
|
||||
defer restore()
|
||||
restore = squashfs.MockNeedsFuse(false)
|
||||
defer restore()
|
||||
|
||||
Reference in New Issue
Block a user