8000 Avoid possible override of existing values during migration of collections to 3.3.0 by meaksh · Pull Request #3299 · cobbler/cobbler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Avoid possible override of existing values during migration of collections to 3.3.0 #3299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 21, 2022

Conversation

meaksh
Copy link
Member
@meaksh meaksh commented Dec 16, 2022

Description

This PR fixes an issue found when running the migration of collections from 2.8.5 to 3.3.0. This can lead into profiles not being available in PXE menu after the migration.

The mechanism for adding predefined new items to collections (or renaming them) is not taking into consideration that those items may be existing already and may have different values than the default ones to add.

We have detected this happening in distros where boot_loaders attribute was already existing because of any reason (i.a. retriggering the migration), where boot_loaders is set to <<inherit>>, then after the migration runs the boot_loaders will end up wrongly with default value "grub", instead of preserving the existing value. This makes then profiles for this distro to not being available in the generated PXE menus.

Behaviour changes

Old:

Given a collection with boot_loaders: <<inherit>>, after the migration is done for this collection, value would be boot_loaders: ['grub'] -> profiles are not shown in the PXE menu

New:

Given a collection with boot_loaders: <<inherit>>, after the migration is done for this collection, the value will be preserved -> profiles are still shown in the PXE menu.

Category

This is related to a:

  • Bugfix
  • Feature
  • Packaging
  • Docs
  • Code Quality
  • Refactoring
  • Miscellaneous

Tests

  • Unit-Tests were created
  • System-Tests were created
  • Code is already covered by Unit-Tests
  • Code is already covered by System-Tests
  • No tests required

@codecov
Copy link
codecov bot commented Dec 16, 2022

Codecov Report

Base: 65.51% // Head: 65.43% // Decreases project coverage by -0.08% ⚠️

Coverage data is based on head (01ed8cf) compared to base (3da0a32).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3299      +/-   ##
==========================================
- Coverage   65.51%   65.43%   -0.09%     
==========================================
  Files         113      113              
  Lines       15151    15155       +4     
==========================================
- Hits         9926     9916      -10     
- Misses       5225     5239      +14     
Impacted Files Coverage Δ
cobbler/settings/migrations/V3_0_0.py 55.20% <0.00%> (-3.31%) ⬇️
cobbler/settings/migrations/V3_3_0.py 44.44% <0.00%> (-0.92%) ⬇️
cobbler/settings/migrations/V3_1_0.py 80.00% <0.00%> (-13.34%) ⬇️
cobbler/settings/migrations/V3_1_2.py 82.35% <0.00%> (-11.77%) ⬇️
cobbler/settings/migrations/V3_3_1.py 85.00% <0.00%> (-10.00%) ⬇️
cobbler/settings/migrations/V3_2_1.py 85.71% <0.00%> (-5.72%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@meaksh meaksh force-pushed the main-avoid-overriding-values-during-v2-migration branch from c4bd185 to 57419c1 Compare December 16, 2022 12:01
@SchoolGuy SchoolGuy added this to the v3.4.0 milestone Dec 17, 2022
@SchoolGuy SchoolGuy self-requested a review December 17, 2022 21:41
@SchoolGuy
Copy link
Member

@meaksh Thanks for submitting this PR. I know little time is available but can we maybe add an isolated test case that shows that this is successfully mitigated now?

@meaksh meaksh force-pushed the main-avoid-overriding-values-during-v2-migration branch from 57419c1 to 8bdcc32 Compare December 21, 2022 13:11
@github-actions github-actions bot added the tests label Dec 21, 2022
@meaksh meaksh changed the title Avoid possible override of existing values during migration of collections to 3.0.0 Avoid possible override of existing values during migration of collections to 3.3.0 Dec 21, 2022
When running the migration of collections from older Cobbler 2
collections to newer to 3.3.0, the mechanism for adding new items
to collections (or renaming them) is not taking into consideration
that those items may be existing already and may have different values
than the default ones to add.

We have detected this happening in distros where "boot_loaders" attribute
was already existing because of any reason (i.a. retriggering migration),
with "boot_loaders" set to "<<inherit>>", then after the migration runs
the "boot_loaders" will end up with default value "grub", instead of
preserving the existing value. This makes then profiles for this distro
to not being available in the generated PXE menus.
@meaksh meaksh force-pushed the main-avoid-overriding-values-during-v2-migration branch from 8bdcc32 to 01ed8cf Compare December 21, 2022 15:17
Copy link
Member
@SchoolGuy SchoolGuy left a comment

Choose a reason for hiding this comment

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

LGTM

@SchoolGuy SchoolGuy merged commit 487fc96 into main Dec 21, 2022
@SchoolGuy SchoolGuy deleted the main-avoid-overriding-values-during-v2-migration branch December 21, 2022 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
0