Skip to content
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

move plugin initializer code into Vmdb::Plugins #13941

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ class Application < Rails::Application
# on the top to bottom order of initializer calls in the file.
# Because this is easy to mess up, keep your initializers in order.
# register plugins even before loading settings, as plugins can bring their own settings
initializer :register_vmdb_plugins, :before => :load_vmdb_settings do
Rails.application.railties.each do |railtie|
next unless railtie.class.name.start_with?("ManageIQ::Providers::") || railtie.try(:vmdb_plugin?)
Vmdb::Plugins.instance.register_vmdb_plugin(railtie)
end
end

initializer :load_vmdb_settings, :before => :load_config_initializers do
Vmdb::Settings.init
Vmdb::Loggers.apply_config(::Settings.log)
Expand Down
5 changes: 5 additions & 0 deletions lib/vmdb/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ class Plugins
def initialize
@registered_automate_domains = []
@vmdb_plugins = []

Rails.application.railties.each do |railtie|
next unless railtie.class.name.start_with?("ManageIQ::Providers::") || railtie.try(:vmdb_plugin?)
register_vmdb_plugin(railtie)
end
Copy link
Member

Choose a reason for hiding this comment

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

If reload! is reinstantiating this class, then won't it reregister things like settings paths, automate domains and such? This seems dangerous.

Copy link
Member Author

@durandom durandom Feb 17, 2017

Choose a reason for hiding this comment

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

it doesnt? I thought thats whats done in register_vmdb_plugin ?!

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, sorry, I mis-read your comment.

Indeed it would add the engine root again to DescendantLoader.instance.descendants_paths here - I can fix that by making it a proper method that does not allow double entries. But it makes does no real harm for now...

register_automate_domain only adds new AutomateDomain to a newly created array @registered_automate_domains

end

def register_vmdb_plugin(engine)
Expand Down