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

Allow Vmdb::Plugins to work through code reloads in development. #15057

Merged
merged 3 commits into from
May 10, 2017

Conversation

hayesr
Copy link
Contributor

@hayesr hayesr commented May 10, 2017

Currently plugins are registered with Vmdb::Plugins at boot. This is fine for production but in development a file change will cause a code reload which clears out plugin information.

This change still loads plugin info in an initializer, but reloads it if it has been cleared.

@Fryguy
Copy link
Member

Fryguy commented May 10, 2017

This looks good to me. @bdunne did you have reservations with this?

@vmdb_plugins.empty? ? register_from_railties : @vmdb_plugins
end

def register_from_railties
Copy link
Member

Choose a reason for hiding this comment

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

Minor, but I think I'd prefer the method to be called register_vmdb_plugins.

  • The name matches the initializer name
  • The name mirrors the singular method register_vmdb_plugin, so you know it's registering all of them
  • that the plugins are found via railties now is an implementation detail and is subject to possibly change.

@Fryguy
Copy link
Member

Fryguy commented May 10, 2017

@hayesr What clears out the @vmdb_plugins cache on a code reload?

@hayesr
Copy link
Contributor Author

hayesr commented May 10, 2017

@Fryguy The data is only loaded in an initializer now, so I think when the constant/singleton is reloaded that step is skipped (ie application.rb is not reevaluated) and nothing is triggering the reload of data.

@miq-bot
Copy link
Member

miq-bot commented May 10, 2017

Checked commits hayesr/manageiq@587eb0f~...81b44aa with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

Copy link
Member

@bdunne bdunne left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@bdunne bdunne merged commit 8bef42a into ManageIQ:master May 10, 2017
@bdunne bdunne added this to the Sprint 61 Ending May 22, 2017 milestone May 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants