-
Notifications
You must be signed in to change notification settings - Fork 220
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
fixes #14618 - Introduced configurable initialization of modules and providers #390
Conversation
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine, selecting the appropriate project. More guidelines are available on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
Work in progress, although most functionality has been added. This adds functionality to customize/override configuration and initialization of plugins and providers.
Configuration/initialization logic has been moved to https://github.com/theforeman/smart-proxy/pull/390/files#diff-11cebac8a6625c7bb985371a365a48e3R163 and https://github.com/theforeman/smart-proxy/pull/390/files#diff-11cebac8a6625c7bb985371a365a48e3R196. Plugin dsl adds support for overriding the classes above, but also provides ability to individually override validator, dependency, dependency injection wirings loader classes. Some questions that need answers:
Deep dive, examples, and docs are coming. I'll be happy to do a code walk through to help with the review(s). @ekohl, @helge000, @GregSutcliffe, @domcleal: thoughts? |
It would help me if I saw what would change for me as a plugin author because it's hard for me to derive the changes from this diff. |
I will port #376 PR to highlight the changes. |
[test] |
I'm aware of build failures under 1.8.7 and am looking into them. |
attr_reader :plugin_name, :version, :after_activation_blk, :class_loader | ||
|
||
# Methods below define DSL for defining plugins | ||
def after_activation(&blk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method meant to be deprecated? There are references in the loading code that it's "legacy".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at the moment, although it can be deprecated if I add support for blocks as means of loading classes, specifying di wiring, etc, all of which require class(es) atm.
The wiki page would be a good start, provided it has a warning to say that this is >= 1.12 only. I'm also quite concerned to understand which APIs (if any) are changing behaviour in this patch, are being deprecated, or are being removed. |
The docs are in plans for the next week. I would suggest taking a look at #406 to see how plugins can use the new functionality (puppet_proxy_legacy module is probably one of the better examples). |
Done with the first pass at the docs: http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Smart-Proxy_Plugin |
@@ -1,5 +1,12 @@ | |||
module Proxy::Error | |||
class BadRequest < StandardError; end | |||
class Unauthorized < StandardError; end | |||
class HttpError < StandardError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related? I can't see where it's used.
Rebased, fixed the issues pointed out in the review. |
@@ -40,7 +39,7 @@ def test_isc_provider_initialization | |||
::Proxy::DhcpPlugin.load_test_settings(:server => 'a_server') | |||
::Proxy::DHCP::ISC::Plugin.load_test_settings(:config => 'config_file', :leases => 'leases_file', | |||
:omapi_port => '7777', :key_name => 'key_name', | |||
:key_secret => 'key_secret') | |||
:key_secret => 'key_secret', ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks the test on Ruby 1.8.7, but like the previous comment, I don't think this file needs any changes. Could you revert it to what's in develop please?
to allow for: - support for multiple simultaneous providers - programmatically defined settings - custom validators - ability to customize module loading Also includes support for constructor-based dependency injection
fixed the two issues above. |
Would you mind updating the wiki page again to reflect any recent changes (e.g. support for blocks)? |
Merged as 342eeda, thanks @witlessbird. |
Done. |
No description provided.