mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
remove attributes from periodic fingerprints when state changes
write test for client periodic fingerprinters
This commit is contained in:
@@ -210,6 +210,17 @@ func (f *FingerprintResponse) AddAttribute(name, value string) {
|
||||
f.attributes[name] = value
|
||||
}
|
||||
|
||||
// RemoveAttribute sets the given attribute to empty, which will later remove
|
||||
// it entirely from the node
|
||||
func (f *FingerprintResponse) RemoveAttribute(name string) {
|
||||
// initialize attributes if it has not been already
|
||||
if f.attributes == nil {
|
||||
f.attributes = make(map[string]string, 0)
|
||||
}
|
||||
|
||||
f.attributes[name] = ""
|
||||
}
|
||||
|
||||
// GetAttributes fetches the attributes for the fingerprint response
|
||||
func (f *FingerprintResponse) GetAttributes() map[string]string {
|
||||
// initialize attributes if it has not been already
|
||||
@@ -230,6 +241,17 @@ func (f *FingerprintResponse) AddLink(name, value string) {
|
||||
f.links[name] = value
|
||||
}
|
||||
|
||||
// RemoveLink removes a link entry from the fingerprint response. This will
|
||||
// later remove it entirely from the node
|
||||
func (f *FingerprintResponse) RemoveLink(name string) {
|
||||
// initialize links if it has not been already
|
||||
if f.links == nil {
|
||||
f.links = make(map[string]string, 0)
|
||||
}
|
||||
|
||||
f.links[name] = ""
|
||||
}
|
||||
|
||||
// GetLinks returns the links for the fingerprint response
|
||||
func (f *FingerprintResponse) GetLinks() map[string]string {
|
||||
// initialize links if it has not been already
|
||||
|
||||
Reference in New Issue
Block a user