diff --git a/central_auth_acl_handling.go b/central_auth_acl_handling.go index 8b2cc69..cae8efc 100644 --- a/central_auth_acl_handling.go +++ b/central_auth_acl_handling.go @@ -259,8 +259,18 @@ func (a *accessLists) generateACLsForAllNodes() error { // are defined for each individual host node. // Range this map, and generate a JSON representation of all // the ACL's each host. + fmt.Printf("\n --- DEBUG: IN GENERATE ACLsToConvert contains: %#v\n", a.schemaGenerated.ACLsToConvert) func() { + // If the map to generate from map is empty we want to also set the generatedACLsMap + // to empty so we can make sure that no more generated ACL's exists to be distributed. + if len(a.schemaGenerated.ACLsToConvert) == 0 { + fmt.Printf(" ****** MAP IS EMPTY\n") + a.schemaGenerated.GeneratedACLsMap = make(map[Node]HostACLsSerializedWithHash) + + } + for n, m := range a.schemaGenerated.ACLsToConvert { + fmt.Printf("\n ################ DEBUG: RANGE in generate: n=%v, m=%v\n", n, m) // cbor marshal the data of the ACL map to store for the host node. cb, err := cbor.Marshal(m) @@ -296,6 +306,7 @@ func (a *accessLists) generateACLsForAllNodes() error { } }() + fmt.Printf("\n --- DEBUG: IN GENERATE GeneratedACLsMap contains: %v\n", a.schemaGenerated.GeneratedACLsMap) return nil } diff --git a/requests-acl.go b/requests-acl.go index 7612bf3..e519f95 100644 --- a/requests-acl.go +++ b/requests-acl.go @@ -47,11 +47,11 @@ func (m methodREQAclAddCommand) handler(proc process, message Message, node stri // Just print out for testing. proc.centralAuth.accessLists.schemaMain.mu.Lock() - fmt.Printf("\n ---------- content of main acl map: %v-----------\n", proc.centralAuth.accessLists.schemaMain.ACLMap) + fmt.Printf("\n ########### content of main acl map: %v###########\n", proc.centralAuth.accessLists.schemaMain.ACLMap) proc.centralAuth.accessLists.schemaMain.mu.Unlock() proc.centralAuth.accessLists.schemaGenerated.mu.Lock() - fmt.Printf("\n ---------- content of generated acl map: %v-----------\n", proc.centralAuth.accessLists.schemaGenerated.GeneratedACLsMap) + fmt.Printf("\n ########### content of generated acl map: %v###########\n", proc.centralAuth.accessLists.schemaGenerated.GeneratedACLsMap) proc.centralAuth.accessLists.schemaGenerated.mu.Unlock() outString := fmt.Sprintf("acl added: host=%v, source=%v, command=%v\n", host, source, cmd) @@ -95,7 +95,7 @@ func (m methodREQAclDeleteCommand) getKind() Event { } func (m methodREQAclDeleteCommand) handler(proc process, message Message, node string) ([]byte, error) { - inf := fmt.Errorf("<--- methodREQAclAddAccessList received from: %v, containing: %v", message.FromNode, message.MethodArgs) + inf := fmt.Errorf("<--- methodREQAclDeleteCommand received from: %v, containing: %v", message.FromNode, message.MethodArgs) proc.errorKernel.logConsoleOnlyIfDebug(inf, proc.configuration) proc.processes.wg.Add(1) @@ -127,14 +127,14 @@ func (m methodREQAclDeleteCommand) handler(proc process, message Message, node s // Just print out for testing. proc.centralAuth.accessLists.schemaMain.mu.Lock() - fmt.Printf("\n ---------- content of main acl map: %v-----------\n", proc.centralAuth.accessLists.schemaMain.ACLMap) + fmt.Printf("\n ########### content of main acl map: %v###########\n", proc.centralAuth.accessLists.schemaMain.ACLMap) proc.centralAuth.accessLists.schemaMain.mu.Unlock() proc.centralAuth.accessLists.schemaGenerated.mu.Lock() - fmt.Printf("\n ---------- content of generated acl map: %v-----------\n", proc.centralAuth.accessLists.schemaGenerated.GeneratedACLsMap) + fmt.Printf("\n ########### content of generated acl map: %v###########\n", proc.centralAuth.accessLists.schemaGenerated.GeneratedACLsMap) proc.centralAuth.accessLists.schemaGenerated.mu.Unlock() - outString := fmt.Sprintf("acl added: host=%v, source=%v, command=%v\n", host, source, cmd) + outString := fmt.Sprintf("acl deleted: host=%v, source=%v, command=%v\n", host, source, cmd) out := []byte(outString) select {