MCPcopy
hub / github.com/containerd/containerd / LoadDefaultProfile

Function LoadDefaultProfile

contrib/apparmor/apparmor.go:54–81  ·  view source on GitHub ↗

LoadDefaultProfile ensures the default profile to be loaded with the given name. Returns nil error if the profile is already loaded.

(name string)

Source from the content-addressed store, hash-verified

52// LoadDefaultProfile ensures the default profile to be loaded with the given name.
53// Returns nil error if the profile is already loaded.
54func LoadDefaultProfile(name string) error {
55 yes, err := isLoaded(name)
56 if err != nil {
57 return err
58 }
59 if yes {
60 return nil
61 }
62 p, err := loadData(name)
63 if err != nil {
64 return err
65 }
66 f, err := os.CreateTemp(os.Getenv("XDG_RUNTIME_DIR"), p.Name)
67 if err != nil {
68 return err
69 }
70 defer f.Close()
71 path := f.Name()
72 defer os.Remove(path)
73
74 if err := generate(p, f); err != nil {
75 return err
76 }
77 if err := load(path); err != nil {
78 return fmt.Errorf("load apparmor profile %s: %w", path, err)
79 }
80 return nil
81}
82
83// DumpDefaultProfile dumps the default profile with the given name.
84func DumpDefaultProfile(name string) (string, error) {

Callers 2

WithDefaultProfileFunction · 0.85
FuzzLoadDefaultProfileFunction · 0.85

Calls 7

isLoadedFunction · 0.85
loadDataFunction · 0.85
loadFunction · 0.85
generateFunction · 0.70
CloseMethod · 0.65
NameMethod · 0.65
RemoveMethod · 0.65

Tested by 1

FuzzLoadDefaultProfileFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…