mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2025-02-07 10:45:09 +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",
|
name: "empty",
|
||||||
p: &AppArmorProfile{},
|
p: &AppArmorProfile{},
|
||||||
want: `profile {
|
want: ``,
|
||||||
}
|
|
||||||
`,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "foo",
|
name: "foo",
|
||||||
|
|
|
@ -22,20 +22,22 @@
|
||||||
{{ "@{" }}{{ .Name }}{{ "} = " }}{{ join .Values }}
|
{{ "@{" }}{{ .Name }}{{ "} = " }}{{ join .Values }}
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
|
||||||
{{- "profile" -}}
|
{{- if or .Name .Attachments .Attributes .Flags -}}
|
||||||
{{- with .Name -}}
|
{{- "profile" -}}
|
||||||
{{ " " }}{{ . }}
|
{{- with .Name -}}
|
||||||
|
{{ " " }}{{ . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Attachments -}}
|
||||||
|
{{ " " }}{{ join . }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Attributes -}}
|
||||||
|
{{ " xattrs=(" }}{{ join . }}{{ ")" }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with .Flags -}}
|
||||||
|
{{ " flags=(" }}{{ join . }}{{ ")" }}
|
||||||
|
{{- end -}}
|
||||||
|
{{ " {\n" }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .Attachments -}}
|
|
||||||
{{ " " }}{{ join . }}
|
|
||||||
{{- end -}}
|
|
||||||
{{- with .Attributes -}}
|
|
||||||
{{ " xattrs=(" }}{{ join . }}{{ ")" }}
|
|
||||||
{{- end -}}
|
|
||||||
{{- with .Flags -}}
|
|
||||||
{{ " flags=(" }}{{ join . }}{{ ")" }}
|
|
||||||
{{- end -}}
|
|
||||||
{{ " {\n" }}
|
|
||||||
|
|
||||||
{{- $oldtype := "" -}}
|
{{- $oldtype := "" -}}
|
||||||
{{- range .Rules -}}
|
{{- range .Rules -}}
|
||||||
|
@ -288,4 +290,6 @@
|
||||||
{{- $oldtype = $type -}}
|
{{- $oldtype = $type -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- "}\n" -}}
|
{{- if or .Name .Attachments .Attributes .Flags -}}
|
||||||
|
{{- "}\n" -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
Loading…
Reference in a new issue