Change:
As mentioned the return value of is not being used any longer and the entire method can be removed. The usage of was removed in Now there is no need to have the function and store it's result at all. /sig node /kind cleanup /good-first-issue /help-wanted KEP xref:
This request has been marked as suitable for new contributors. Please ensure that the issue body includes answers to the following questions: Why are we solving this issue? To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points? Does this issue have zero to low barrier of entry? How can the assignee reach out to you for help? For more details on the requirements of such an issue, please see and ensure that they are met. If this request no longer meets these requirements, the label can be removed by commenting with the command. <detailsIn response to : As mentioned the return value of is not being used any longer and the entire method can be removed. /kind cleanup /good-first-issue /help-wanted Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/triage accepted
/assign
I am having issues submitting the pull request. I removed that portion of the code under however this is my first time contributing and would like some help submitting this new updated version..
/assign
/assign
/assign
/assign

Discussion:
package apparmor import ( <del> "bufio" </del> "errors" "fmt" <del> "os" "path" </del> "strings" "github.com/opencontainers/runc/libcontainer/apparmor"

podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/apis/core/validation" "k8s.io/kubernetes/pkg/features" <del> utilpath "k8s.io/utils/path" </del> ) // Whether AppArmor should be disabled by default.

if err := validateHost(); err != nil { return &validator{validateHostErr: err} } <del> appArmorFS, err := getAppArmorFS() if err != nil { return &validator{ validateHostErr: fmt.Errorf("error finding AppArmor FS: %v", err), } } return &validator{ appArmorFS: appArmorFS, } </del> <ins> return &validator{} </ins> } type validator struct { validateHostErr error <del> appArmorFS      string </del> } func (v *validator) Validate(pod *v1.Pod) error {

return nil } <del> func getAppArmorFS() (string, error) { mountsFile, err := os.Open("/proc/mounts") if err != nil { return "", fmt.Errorf("could not open /proc/mounts: %v", err) } defer mountsFile.Close() scanner := bufio.NewScanner(mountsFile) for scanner.Scan() { fields := strings.Fields(scanner.Text()) if len(fields) < 3 { // Unknown line format; skip it. continue } if fields[2] == "securityfs" { appArmorFS := path.Join(fields[1], "apparmor") if ok, err := utilpath.Exists(utilpath.CheckFollowSymlink, appArmorFS); !ok { msg := fmt.Sprintf("path %s does not exist", appArmorFS) if err != nil { return "", fmt.Errorf("%s: %v", msg, err) } return "", errors.New(msg) } return appArmorFS, nil } } if err := scanner.Err(); err != nil { return "", fmt.Errorf("error scanning mounts: %v", err) } return "", errors.New("securityfs not found") } </del>

"github.com/stretchr/testify/assert" ) <del> func TestGetAppArmorFS(t *testing.T) { // This test only passes on systems running AppArmor with the default configuration. // The test should be manually run if modifying the getAppArmorFS function. t.Skip() const expectedPath = "/sys/kernel/security/apparmor" actualPath, err := getAppArmorFS() assert.NoError(t, err) assert.Equal(t, expectedPath, actualPath) } func TestValidateHost(t *testing.T) { // This test only passes on systems running AppArmor with the default configuration. // The test should be manually run if modifying the getAppArmorFS function. t.Skip() assert.NoError(t, validateHost()) } </del> func TestValidateBadHost(t *testing.T) { hostErr := errors.New("expected host error") v := &validator{

} func TestValidateValidHost(t *testing.T) { <del> v := &validator{ appArmorFS: "./testdata/", } </del> <ins> v := &validator{} </ins> tests := []struct { profile     string