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)