nautobot-app-golden-config icon indicating copy to clipboard operation
nautobot-app-golden-config copied to clipboard

Duplicate GC entries for devices when platform changes

Open matt852 opened this issue 1 year ago • 4 comments

Environment

  • Python version: 3.9.6
  • Nautobot version: 1.3.7 and 1.4.2
  • nautobot-golden-config version: 1.1.3 and 1.2.0

Steps to Reproduce

  1. Set up Nautobot with 2 platforms: IOS and IOS-XE
  2. Set up at least 1 Golden Config features and rules for both platforms.
  3. Create a device using platform IOS
  4. Run all 3 Golden Config jobs for the device (backup, intended, compliance)
  5. In Nautobot, go to Golden Config --> Configuration Compliance. Select the device.
  6. At the top of the page, note the red/green boxes showing "compliant/non-compliant" for each feature. There should be one box for each IOS feature configured.
  7. Change the assigned platform to the device from IOS to IOS-XE
  8. Rerun all 3 Golden Config jobs (from step 4)
  9. Go back to the Configuration Compliance page, and select the same device again
  10. At the top of the page, you will now see twice as many red/green boxes. One box for each IOS feature, and another box for each IOS-XE feature.

Expected Behavior

After changing the platform on a device (like from IOS to IOS-XE), all of the golden config objects should be dropped from the old platform.

Observed Behavior

The data from the original platform remains, and is only removed when I delete the config compliance data from a device and rerun the compliance job.

This causes duplicate features to be reported for a device that has changed platforms (until it can be manually deleted and the compliance job reran).

This also skews the Compliance Reporting numbers, where each device with double-platform data shows double numbers in the report.

matt852 avatar Sep 26 '22 12:09 matt852

Can you confirm:

  • This is not a dynamic group issue
  • This is not a caching issue

e.g. if you go to dynamic group after you make such a change, do you see the same issues? If so, can you open an issue with Core.

itdependsnetworks avatar Sep 26 '22 18:09 itdependsnetworks

Notice DNS is twice (as well as other features) image

itdependsnetworks avatar Oct 05 '22 13:10 itdependsnetworks

Will have to fix it here: https://github.com/nautobot/nautobot-plugin-golden-config/blob/fa4c7c2407187a6eac79855e90ef736fc4e4968c/nautobot_golden_config/models.py#L321

itdependsnetworks avatar Oct 05 '22 13:10 itdependsnetworks

Can you confirm:

  • This is not a dynamic group issue
  • This is not a caching issue

e.g. if you go to dynamic group after you make such a change, do you see the same issues? If so, can you open an issue with Core.

I don't believe this has anything to do with Dynamic Groups. I am seeing this on devices setup when no dynamic groups are configured in Nautobot.

I also don't believe it's a caching issue, as it occurs even in a new/incognito browser. As for it being a CacheOps issue, usually those go away when a modification is made to the relevant database table (see Nautobot issue #1627 for details). So I don't believe it's cacheops related, but am not certain.

matt852 avatar Oct 05 '22 14:10 matt852