feat(acls): simplify updating rules

This commit is contained in:
Adrien Raffin 2022-02-03 20:00:41 +01:00 committed by Adrien Raffin-Caboisse
parent e482dfeed4
commit e9949b4c70
No known key found for this signature in database
GPG key ID: 7FB60532DEBEAD6A
2 changed files with 6 additions and 5 deletions

View file

@ -69,14 +69,16 @@ func (h *Headscale) LoadACLPolicy(path string) error {
}
h.aclPolicy = &policy
return h.UpdateACLRules()
}
func (h *Headscale) UpdateACLRules() error {
rules, err := h.generateACLRules()
if err != nil {
return err
}
h.aclRules = rules
log.Trace().Interface("ACL", rules).Msg("ACL rules generated")
h.aclRules = rules
return nil
}

View file

@ -204,9 +204,8 @@ func (s *Suite) TestGetACLFilteredPeers(c *check.C) {
Tests: []ACLTest{},
}
rules, err := app.generateACLRules()
err = app.UpdateACLRules()
c.Assert(err, check.IsNil)
app.aclRules = rules
adminMachine, err := app.GetMachineByID(1)
c.Logf("Machine(%v), namespace: %v", adminMachine.Name, adminMachine.Namespace)