feat(aa): ensure the template does not append useless space.

This commit is contained in:
Alexandre Pujol 2023-09-29 20:17:38 +01:00
parent eb98d2b49f
commit cb441733c0
Failed to generate hash of commit

View file

@ -33,20 +33,20 @@
{{- end }}
{{ end -}}
{{- "profile " -}}
{{- "profile" -}}
{{- with .Name -}}
{{ . }}{{ " " }}
{{ " " }}{{ . }}
{{- end -}}
{{- with .Attachments -}}
{{ join . }}{{ " " }}
{{ " " }}{{ join . }}
{{- end -}}
{{- with .Attributes -}}
{{ "xattrs=(" }}{{ join . }}{{ ") " }}
{{ " xattrs=(" }}{{ join . }}{{ ")" }}
{{- end -}}
{{- with .Flags -}}
{{ "flags=(" }}{{ join . }}{{ ") " }}
{{ " flags=(" }}{{ join . }}{{ ")" }}
{{- end -}}
{{ "{\n" }}
{{ " {\n" }}
{{- $oldtype := "" -}}
{{- range .Rules -}}
@ -77,81 +77,78 @@
{{- end -}}
{{- if eq $type "Network" -}}
{{- if eq .AccessType "deny" -}}
{{ "deny " }}
{{- end -}}
{{ "network " }}
{{ "network" }}
{{- with .Domain -}}
{{ . }}{{ " " }}
{{ " " }}{{ . }}
{{- end -}}
{{- with .Type -}}
{{ . }}
{{ " " }}{{ . }}
{{- else -}}
{{- with .Protocol -}}
{{ . }}
{{ " " }}{{ . }}
{{- end -}}
{{- end -}}
{{- "," -}}
{{- end -}}
{{- if eq $type "Mount" -}}
{{- "mount " -}}
{{- "mount" -}}
{{- with .FsType -}}
{{ "fstype=" }}{{ . }}{{ " " }}
{{ " fstype=" }}{{ . }}
{{- end -}}
{{- with .Options -}}
{{ "options=(" }}{{ join . }}{{ ") " }}
{{ " options=(" }}{{ join . }}{{ ")" }}
{{- end -}}
{{- with .Source -}}
{{ . }}{{ " " }}
{{ " " }}{{ . }}
{{- end -}}
{{- with .MountPoint -}}
{{ "-> " }}{{ . }}
{{ " -> " }}{{ . }}
{{- end -}}
{{- "," -}}
{{- end -}}
{{- if eq $type "Umount" -}}
{{- "umount " -}}
{{- "umount" -}}
{{- with .FsType -}}
{{ "fstype=" }}{{ . }}{{ " " }}
{{ " fstype=" }}{{ . }}
{{- end -}}
{{- with .Options -}}
{{ "options=(" }}{{ join . }}{{ ") " }}
{{ " options=(" }}{{ join . }}{{ ")" }}
{{- end -}}
{{- with .MountPoint -}}
{{ . }}
{{ " " }}{{ . }}
{{- end -}}
{{- "," -}}
{{- end -}}
{{- if eq $type "Remount" -}}
{{- "remount " -}}
{{- "remount" -}}
{{- with .FsType -}}
{{ "fstype=" }}{{ . }}{{ " " }}
{{ " fstype=" }}{{ . }}
{{- end -}}
{{- with .Options -}}
{{ "options=(" }}{{ join . }}{{ ") " }}
{{ " options=(" }}{{ join . }}{{ ")" }}
{{- end -}}
{{- with .Remount -}}
{{ . }}
{{ " " }}{{ . }}
{{- end -}}
{{- "," -}}
{{- end -}}
{{- if eq $type "Unix" -}}
{{- "unix " -}}
{{- "unix" -}}
{{- with .Access -}}
{{ "(" }}{{ . }}{{ ") " }}
{{ " (" }}{{ . }}{{ ")" }}
{{- end -}}
{{- with .Type -}}
{{ "type=" }}{{ . }}{{ " " }}
{{ " type=" }}{{ . }}
{{- end -}}
{{- with .Address -}}
{{ "addr=" }}{{ . }}{{ " " }}
{{ " addr=" }}{{ . }}
{{- end -}}
{{- if .Peer -}}
{{ "peer=(label=" }}{{ .Peer }}
{{ " peer=(label=" }}{{ .Peer }}
{{- with .PeerAddr -}}
{{ ", addr="}}{{ . }}
{{- end -}}
@ -161,36 +158,43 @@
{{- end -}}
{{- if eq $type "Ptrace" -}}
{{- "ptrace " -}}
{{- "ptrace" -}}
{{- with .Access -}}
{{ "(" }}{{ . }}{{ ") " }}
{{ " (" }}{{ . }}{{ ")" }}
{{- end -}}
{{- with .Peer -}}
{{ "peer=" }}{{ . }}
{{ " peer=" }}{{ . }}
{{- end -}}
{{- "," -}}
{{- end -}}
{{- if eq $type "Signal" -}}
{{- "signal " -}}
{{- "signal" -}}
{{- with .Access -}}
{{ "(" }}{{ . }}{{ ") " }}
{{ " (" }}{{ . }}{{ ")" }}
{{- end -}}
{{- with .Set -}}
{{ "set=(" }}{{ . }}{{ ") " }}
{{ " set=(" }}{{ . }}{{ ")" }}
{{- end -}}
{{- with .Peer -}}
{{ "peer=" }}{{ . }}
{{ " peer=" }}{{ . }}
{{- end -}}
{{- "," -}}
{{- end -}}
{{- if eq $type "Dbus" -}}
{{- "dbus " -}}
{{- "dbus" -}}
{{- if eq .Access "bind" -}}
bind bus={{ .Bus }} name={{ .Name }}
{{ " bind bus=" }}{{ .Bus }}{{ " name=" }}{{ .Name }}
{{- else -}}
{{ .Access }} bus={{ .Bus }} path={{ .Path }}{{ "\n" }}
{{ " " }}{{ .Access }}
{{- with .Bus -}}
{{ " bus=" }}{{ . }}
{{- end -}}
{{- with .Path -}}
{{ " path=" }}{{ . }}
{{- end -}}
{{ "\n" }}
{{- with .Interface -}}
{{ overindent "interface=" }}{{ . }}{{ "\n" }}
{{- end -}}