-
-
Notifications
You must be signed in to change notification settings - Fork 650
Skip wrong/inconsistent collections instead of crashing #3313
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
Conversation
This commit makes Cobbler service more tolerant to any unexpected issue when loading collections. Instead of making Cobbler to crash, this commit make it to skip collections that cannot be loaded and keep the service running. This way, we are not blocking other collections and particularly the entire Cobbler service to work in case of a problem with a particular collection.
Codecov ReportBase: 65.43% // Head: 65.41% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #3313 +/- ##
==========================================
- Coverage 65.43% 65.41% -0.02%
==========================================
Files 113 113
Lines 15155 15164 +9
==========================================
+ Hits 9916 9920 +4
- Misses 5239 5244 +5
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. |
Interesting take on the startup problems however, you need to solve the inheritance chain, so that depending collections are not being loaded as well. |
@SchoolGuy from the tests I did, I think the inheritance chain is somehow also skipped. Let say I have a distro and profile for this distro, properly loaded on Cobbler: # cobbler distro list
Leap_154_wrong:1:admin
# cobbler profile list
test-wrong-distro-profile Then I explicitely corrupt the distro collection file by placing some unexpected attributed. Once I restart Cobbler, having this distro collection which is wrong now, I see Cobbler skipping the distro and the profile during the startup and make them unavalable: # tail /var/log/cobbler/cobbler.log
...
[Daemon] 2023-01-10T11:58:12 - ERROR | Error while loading a collection: "The following keys supplied could not be set: ['foobar_attribute_corrupt']". Skipping this collection!
[Daemon] 2023-01-10T11:58:12 - ERROR | Error while loading a collection: distribution "Leap_154_wrong:1:admin" not found. Skipping this collection!
[Daemon] 2023-01-10T11:58:12 - INFO | Cobbler startup completed in 3.4226715564727783 seconds
# cobbler distro list
# cobbler profile list |
@meaksh Okay this PR is looking good. I wasn't expecting that this is already handled. Is this working equally with MongoDB? |
I haven't tested this on a deployment using MongoDB - will need to give it a try |
@SchoolGuy I've tested this PR using
# find /var/lib/cobbler/collections/
/var/lib/cobbler/collections/
/var/lib/cobbler/collections/distros
/var/lib/cobbler/collections/files
/var/lib/cobbler/collections/images
/var/lib/cobbler/collections/menus
/var/lib/cobbler/collections/mgmtclasses
/var/lib/cobbler/collections/packages
/var/lib/cobbler/collections/profiles
/var/lib/cobbler/collections/repos
/var/lib/cobbler/collections/systems
cobbler> db.distro.find()
[
{
_id: ObjectId("63dcdefa645b24ac92262f1c"),
parent: '',
depth: 0,
children: [],
ctime: 1675419386.7625694,
mtime: 1675419386.7625694,
uid: '0ca6b61ef04e40a99a1c55975981857d',
name: 'test-distro-gke',
comment: '',
kernel_options: {},
kernel_options_post: {},
autoinstall_meta: {},
fetchable_files: {},
boot_files: {},
template_files: {},
owners: '<<inherit>>',
mgmt_classes: [],
mgmt_parameters: {},
is_subobject: false,
tree_build_time: 0,
arch: 'x86_64',
boot_loaders: '<<inherit>>',
breed: '',
initrd: '/initrd',
kernel: '/linux',
os_version: '',
redhat_management_key: '<<inherit>>',
source_repos: [],
remote_boot_kernel: '',
remote_boot_initrd: ''
},
{
_id: ObjectId("63dce1524b3a428134d1a7c2"),
parent: '',
depth: 0,
children: [],
ctime: 1675419986.7887084,
mtime: 1675423149.2387583,
uid: 'c6f211cece014878a7bc96b67626fa6b',
name: 'test-distro2',
comment: 'hola',
kernel_options: {},
kernel_options_post: {},
autoinstall_meta: {},
fetchable_files: {},
boot_files: {},
template_files: {},
owners: '<<inherit>>',
mgmt_classes: [],
mgmt_parameters: {},
is_subobject: false,
tree_build_time: 0,
arch: 'x86_64',
boot_loaders: '<<inherit>>',
breed: '',
initrd: '/initrd2',
kernel: '/linux2',
os_version: '',
redhat_management_key: '<<inherit>>',
source_repos: [],
remote_boot_kernel: '',
remote_boot_initrd: ''
},
{
_id: ObjectId("63dce6c90bdaa2953a2a6f13"),
parent: '',
depth: 0,
children: [],
ctime: 1675421385.942577,
mtime: 1675421385.942577,
uid: '8c56ecdd206f4d63860f6c4960cdbcf6',
name: 'test-distro3',
comment: '',
kernel_options: {},
kernel_options_post: {},
autoinstall_meta: {},
fetchable_files: {},
boot_files: {},
template_files: {},
owners: '<<inherit>>',
mgmt_classes: [],
mgmt_parameters: {},
is_subobject: false,
tree_build_time: 0,
arch: 'x86_64',
boot_loaders: '<<inherit>>',
breed: '',
initrd: '/initrd',
kernel: '/linux',
os_version: '',
redhat_management_key: '<<inherit>>',
source_repos: [],
remote_boot_kernel: '',
remote_boot_initrd: ''
}
]
# cobblerd
INFO | Automigration NOT executed
INFO | python3-hivex not found. If you need Automatic Windows Installation support, please install.
INFO | 11 breeds and 131 OS versions read from the signature file
ERROR | Error while loading a collection: initrd not found. Skipping this collection!
ERROR | Error while loading a collection: initrd not found. Skipping this collection!
INFO | cobblerd started
# cobbler distro list
test-distro2 BTW, during these tests I found some bugs on the mongodb serializer that I'm fixing in an upcoming PR I'll create in a moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Description
Fixes #532
This PR makes Cobbler service more tolerant to any unexpected issue when loading collections.
Instead of making Cobbler to crash, this PR makes it to skip collections that cannot be loaded and keep the service running.
This way, we are not blocking other collections and particularly the entire Cobbler service to work in case of a problem with a particular collection.
Old:
New:
Category
This is related to a:
Tests