opened
brandonforster
Fixes #2358 
Fixes #2388 

This PR will address the two outstanding bugs above. It ensures that after a provision watcher is updated, the ID returned by the database is propagated back into the provision watcher object before its `notify` method is called. It also ensures that during a provision watcher update, IDs are actually checked and not allow a provision watcher with the same name to be inserted into the database.

As part of this work, code was cleaned up and linter issues were addressed.
Fix provision watcher bugs around updating
issue
created
brandonforster
@hahattan please verify this fixes your issue.
comment
created
hahattan
Yes it fixed the issue .
comment
created
tingyuz
This PR does fix the bug mentioned in the original issue ticket. However when considering a bigger picture of device provisioning some form of security mechanism is needed. The details are captured in a newly create issue here: https://github.com/edgexfoundry/edgex-go/issues/2415
comment
Kudos, SonarCloud Quality Gate passed!

[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug.png' alt='Bug' width='16' height='16' />](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=BUG) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=BUG)  
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability.png' alt='Vulnerability' width='16' height='16' />](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=VULNERABILITY) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=VULNERABILITY) (and [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot.png' alt='Security Hotspot' width='16' height='16' />](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=SECURITY_HOTSPOT) to review)  
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell.png' alt='Code Smell' width='16' height='16' />](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=CODE_SMELL) [<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A.png' alt='A' width='16' height='16' />](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=edgexfoundry_edgex-go&pullRequest=2389&resolved=false&types=CODE_SMELL)

[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo.png' alt='No Coverage information' width='16' height='16' />](https://sonarcloud.io/component_measures?id=edgexfoundry_edgex-go&pullRequest=2389) No Coverage information  
[<img src='https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/5.png' alt='3.2%' width='16' height='16' />](https://sonarcloud.io/component_measures?id=edgexfoundry_edgex-go&pullRequest=2389&metric=new_duplicated_lines_density&view=list) [3.2% Duplication](https://sonarcloud.io/component_measures?id=edgexfoundry_edgex-go&pullRequest=2389&metric=new_duplicated_lines_density&view=list)
This message directly preceded comment from bot *sonarcloud[bot]* by author *hahattan*:
Yes it fixed the issue .
This message directly preceded comment from bot *sonarcloud[bot]* by author *hahattan*:
Yes it fixed the issue .