Skip to content

Commit

Permalink
Memstore: fall back to using given name if no SMD results
Browse files Browse the repository at this point in the history
This is the case when no xname can be found for the given MAC address,
in which case we consider the possibility that the input isn't a MAC
address at all, and use it as directly as a datastore key.
  • Loading branch information
LRitzdorf committed Jul 9, 2024
1 parent efc4b0d commit 08c1e9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/memstore/ciMemStore.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (m MemStore) Get(name string, sm *smdclient.SMDClient) (citypes.CI, error)
id, err := sm.IDfromMAC(name)
if err != nil {
log.Print(err)
id = name // Fall back to using the given name as an ID
} else {
log.Printf("xname %s with mac %s found\n", id, name)
}
Expand All @@ -81,7 +82,7 @@ func (m MemStore) Get(name string, sm *smdclient.SMDClient) (citypes.CI, error)
}
}
} else {
log.Printf("ID %s is not a member of any groups\n", name)
log.Printf("ID %s is not a member of any groups\n", id)
}

if val, ok := m.list[id]; ok {
Expand Down

0 comments on commit 08c1e9f

Please # to comment.