Bug #12326
closedLoading issues with custom host statuses
Description
When adding custom host status that is namespaced under HostStatus module it's easy to get loading issues in test and production env if user defines his or her status like this
module HostStatus
class MyStatus < HostStatus::Status
end
end
Rails loads engine files first so it thinks that HostStatus is defined in custom status file and it fails to find HostStatus.status_registry.
A solution is to load HostStatus module in core initializer (downside is that it won't be auto reloaded but it shouldn't matter in this case), so all engines can rely on this module being loaded.
A workaround for plugins is to define their statuses like class HostStatus::MyStatus < HostStatus::Status
which would enforce the module loading.
To reproduce, either use production/test env or turn on config.cache_classes in config/environments/development.rb, define custom status from an engine and try starting server. Since host statuses were introduced in 1.10, setting this also as target version.
Updated by The Foreman Bot over 8 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2867 added
- Pull request deleted (
)
Updated by Dominic Cleal over 8 years ago
- translation missing: en.field_release changed from 63 to 104
Updated by Dominic Cleal over 8 years ago
- translation missing: en.field_release deleted (
104)
Updated by Marek Hulán about 8 years ago
- Status changed from Ready For Testing to Feedback
Will reopen when I get the reproducer outside of my env.
Updated by Marek Hulán about 8 years ago
FTR I retested on clean machine with the Dominic's reproducer and I was unable to reproduce. Not sure what caused it before then. Sorry for false alarm.