Merge pull request #3909 from hashicorp/b-node-attributes-concurrent-access

Fingerprinters accessing node information should be thread safe
This commit is contained in:
Chelsea Komlo 2018-03-06 11:57:46 -05:00 committed by GitHub
commit bd88877249
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -100,7 +100,12 @@ func (fm *FingerprintManager) setupDrivers(drivers []string) error {
func (fm *FingerprintManager) fingerprint(name string, f fingerprint.Fingerprint) (bool, error) { func (fm *FingerprintManager) fingerprint(name string, f fingerprint.Fingerprint) (bool, error) {
request := &cstructs.FingerprintRequest{Config: fm.getConfig(), Node: fm.node} request := &cstructs.FingerprintRequest{Config: fm.getConfig(), Node: fm.node}
var response cstructs.FingerprintResponse var response cstructs.FingerprintResponse
if err := f.Fingerprint(request, &response); err != nil {
fm.nodeLock.Lock()
err := f.Fingerprint(request, &response)
fm.nodeLock.Unlock()
if err != nil {
return false, err return false, err
} }