Skip to content

fix(importer): import correct mgm_id in changelog_rule#4416

Merged
Y4nnikH merged 5 commits intodevelopfrom
fix/import-changelog
Mar 23, 2026
Merged

fix(importer): import correct mgm_id in changelog_rule#4416
Y4nnikH merged 5 commits intodevelopfrom
fix/import-changelog

Conversation

@Y4nnikH
Copy link
Collaborator

@Y4nnikH Y4nnikH commented Mar 22, 2026

closes #4394

@Y4nnikH Y4nnikH requested a review from Imat00 March 22, 2026 10:47
@Y4nnikH Y4nnikH self-assigned this Mar 22, 2026
Copilot AI review requested due to automatic review settings March 22, 2026 10:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts changelog mgm_id handling during imports (notably for FortiManager sub-management scenarios) so changelog entries align with the management context used for imported rules/objects/services/users, and includes a DB upgrade step to correct existing inconsistent rows.

Changes:

  • Use current_mgm_id (instead of mgm_id) when building changelog insert objects in the importer.
  • Add a DB upgrade script section to reconcile changelog_*.mgm_id values with their referenced entities’ mgm_id.
  • Add a unit test asserting write_changelog_rules() uses current_mgm_id.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
roles/importer/files/importer/test/test_fwconfig_import_rule.py Adds a test ensuring rule changelog writes use current_mgm_id.
roles/importer/files/importer/fwo_log.py Switches changelog object creation to use current_mgm_id.
roles/database/files/upgrade/9.0.15.sql Adds data-fix updates to align changelog table mgm_id with referenced entity mgm_id.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tpurschke tpurschke self-requested a review March 23, 2026 12:29
Copy link
Contributor

@tpurschke tpurschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing as substitution for Chris (absence)

@tpurschke
Copy link
Contributor

Please Update branch

@sonarqubecloud
Copy link

@Y4nnikH Y4nnikH merged commit 6b703b8 into develop Mar 23, 2026
6 checks passed
@Y4nnikH Y4nnikH deleted the fix/import-changelog branch March 23, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants