fix(build): add a simple check to ensure all resolved variables are defined.

This commit is contained in:
Alexandre Pujol 2024-04-11 00:15:08 +01:00
parent 4a27c92d53
commit 8b68132f0e
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC

View File

@ -105,7 +105,11 @@ func (p *AppArmorProfile) ResolveAttachments() {
for _, variable := range p.Variables {
if variable.Name == "exec_path" {
for _, value := range variable.Values {
p.Attachments = append(p.Attachments, p.resolve(value)...)
attachments := p.resolve(value)
if len(attachments) == 0 {
panic("Variable not defined in: " + value)
}
p.Attachments = append(p.Attachments, attachments...)
}
}
}