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

Fix dev reload issues when Vmdb::Settings.reload! is called. #10988

Merged
merged 1 commit into from Sep 2, 2016

Conversation

Projects
None yet
4 participants
@Fryguy
Member

Fryguy commented Sep 2, 2016

When the global Vmdb::Settings object is created it maintains references
to instances of Vmdb::Settings::DatabaseSource. In the recent changes
in #10886 the calls to dynamically load MiqServer.my_server were moved
into the DatabaseSource class. Unfortunately, since we maintain a
reference to that class, when the my_server method is called after a
code reload, it tries to find the missing constant for SettingsChange.
As it walks the tree to find it, it starts at
Vmdb::Settings::DatabaseSource, which now is in the "bad" state, and
giving the error:

[ArgumentError] A copy of Vmdb::Settings::DatabaseSource has been removed from the module tree but is still active!

The fix in this commit prefixes those calls with ::, bypassing that
lookup at the Vmdb::Settings::DatabaseSource level, and making it start
at the top-level namespace.

In console, a failing recipe is

reload! && Settings.reload!

Fixes #10978

Fix dev reload issues when Vmdb::Settings.reload! is called.
When the global Vmdb::Settings object is created it maintains references
to instances of Vmdb::Settings::DatabaseSource.  In the recent changes
in #10886 the calls to dynamically load MiqServer.my_server were moved
into the DatabaseSource class.  Unfortunately, since we maintain a
reference to that class, when the my_server method is called after a
code reload, it tries to find the missing constant for SettingsChange.
As it walks the tree to find it, it starts at
Vmdb::Settings::DatabaseSource, which now is in the "bad" state, and
giving the error:

    [ArgumentError] A copy of Vmdb::Settings::DatabaseSource has been removed from the module tree but is still active!

The fix in this commit prefixes those calls with `::`, bypassing that
lookup at the Vmdb::Settings::DatabaseSource level, and making it start
at the top-level namespace.

In console, a failing recipe is

    reload! && Settings.reload!

Fixes #10978
@Fryguy

This comment has been minimized.

Show comment
Hide comment
@Fryguy

Fryguy Sep 2, 2016

Member

@jrafanie or @chrisarcand Please review.

Member

Fryguy commented Sep 2, 2016

@jrafanie or @chrisarcand Please review.

@miq-bot

This comment has been minimized.

Show comment
Hide comment
@miq-bot

miq-bot Sep 2, 2016

Member

Checked commit Fryguy@1a30bc9 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
1 file checked, 0 offenses detected
Everything looks good. 👍

Member

miq-bot commented Sep 2, 2016

Checked commit Fryguy@1a30bc9 with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
1 file checked, 0 offenses detected
Everything looks good. 👍

@jrafanie

This comment has been minimized.

Show comment
Hide comment
@jrafanie

jrafanie Sep 2, 2016

Member

LGTM, makes sense

Member

jrafanie commented Sep 2, 2016

LGTM, makes sense

@kbrock kbrock merged commit 5b1d2ef into ManageIQ:master Sep 2, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.0008%) to 36.62%
Details

@Fryguy Fryguy deleted the Fryguy:fix_dev_reload_from_vmdb_settings branch Sep 2, 2016

@kbrock kbrock added this to the Sprint 46 Ending Sep 12, 2016 milestone Sep 2, 2016

@kbrock kbrock assigned kbrock and unassigned jrafanie Sep 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment