mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-01-30 23:05:11 +01:00
feat(aa-log): an empty profile now return empty string.
This commit is contained in:
parent
48b39fa816
commit
1bc63becaf
2 changed files with 19 additions and 17 deletions
|
@ -37,9 +37,7 @@ func TestAppArmorProfile_String(t *testing.T) {
|
|||
{
|
||||
name: "empty",
|
||||
p: &AppArmorProfile{},
|
||||
want: `profile {
|
||||
}
|
||||
`,
|
||||
want: ``,
|
||||
},
|
||||
{
|
||||
name: "foo",
|
||||
|
|
|
@ -22,20 +22,22 @@
|
|||
{{ "@{" }}{{ .Name }}{{ "} = " }}{{ join .Values }}
|
||||
{{ end -}}
|
||||
|
||||
{{- "profile" -}}
|
||||
{{- with .Name -}}
|
||||
{{ " " }}{{ . }}
|
||||
{{- if or .Name .Attachments .Attributes .Flags -}}
|
||||
{{- "profile" -}}
|
||||
{{- with .Name -}}
|
||||
{{ " " }}{{ . }}
|
||||
{{- end -}}
|
||||
{{- with .Attachments -}}
|
||||
{{ " " }}{{ join . }}
|
||||
{{- end -}}
|
||||
{{- with .Attributes -}}
|
||||
{{ " xattrs=(" }}{{ join . }}{{ ")" }}
|
||||
{{- end -}}
|
||||
{{- with .Flags -}}
|
||||
{{ " flags=(" }}{{ join . }}{{ ")" }}
|
||||
{{- end -}}
|
||||
{{ " {\n" }}
|
||||
{{- end -}}
|
||||
{{- with .Attachments -}}
|
||||
{{ " " }}{{ join . }}
|
||||
{{- end -}}
|
||||
{{- with .Attributes -}}
|
||||
{{ " xattrs=(" }}{{ join . }}{{ ")" }}
|
||||
{{- end -}}
|
||||
{{- with .Flags -}}
|
||||
{{ " flags=(" }}{{ join . }}{{ ")" }}
|
||||
{{- end -}}
|
||||
{{ " {\n" }}
|
||||
|
||||
{{- $oldtype := "" -}}
|
||||
{{- range .Rules -}}
|
||||
|
@ -288,4 +290,6 @@
|
|||
{{- $oldtype = $type -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- "}\n" -}}
|
||||
{{- if or .Name .Attachments .Attributes .Flags -}}
|
||||
{{- "}\n" -}}
|
||||
{{- end -}}
|
||||
|
|
Loading…
Reference in a new issue