Project

General

Profile

Actions

Bug #12326

closed

Loading issues with custom host statuses

Added by Marek Hulán over 8 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Plugin integration
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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.

Actions #1

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 ()
Actions #2

Updated by Dominic Cleal over 8 years ago

  • translation missing: en.field_release changed from 63 to 104
Actions #3

Updated by Dominic Cleal over 8 years ago

  • translation missing: en.field_release deleted (104)
Actions #4

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.

Actions #5

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.

Actions #6

Updated by Anonymous about 7 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF