On 07/11/16 15:39, Stephen Benjamin wrote:
> The wiki says that public methods will be deprecated and given a chance
> to adjust our code in a reasonable time where possible:
> 
>     "Foreman will always strive to make no incompatible changes in a minor 
> release, but be prepared
>     to make updates on major releases. Where possible, deprecation warnings 
> will be added for old
>     public methods before their removal. Warnings will be issued for two 
> major releases and then the
>     old method removed in the third release, giving plenty of time to update 
> plugins."
> 
> I read that as being quasi-official to be able to do alias_method_chain on
> public methods

No, this means public methods should still be able to be called, not
redefined. There's no mention of support for redefining methods via
alias_method_chain (or others) in the plugin documentation.

There's little Foreman can do if a method is being redefined and is
later deprecated in favour of something else, since Foreman would no
longer call the deprecated method. The deprecation is only useful when
it's called, not modified.

> but very often - nearly always - they are not deprecated and
> the signature just changes or maybe the method is even removed. It constantly 
> breaks
> my plugin.

Be more defensive against signature changes by redefining the method
with a splat operator, e.g. def foo(*args) and passing *args to the
original method. If arguments with defaults are added, no change is
required to the redefined method.

> And the plugin API (which itself is a mess given it grows organically and ad 
> hoc instead
> of some team spending time to get it right) is pretty limited if you want
> to add on to Foreman objects.

Please expand it then, or at least ensure a ticket is filed in the
Plugins category in Foreman's issue tracker for the functionality you
require.

It's good that it's ad-hoc because those are the extensions points that
plugin authors have needed, and they can be specifically tested.

-- 
Dominic Cleal
domi...@cleal.org

-- 
You received this message because you are subscribed to the Google Groups 
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to foreman-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to