salt icon indicating copy to clipboard operation
salt copied to clipboard

(Minor) Feature: Move salt.utils.cloud.fire_event into salt.utils.event

Open tkent-xetus opened this issue 11 years ago • 6 comments

salt.utils.cloud.fire_event is a perfect little utility method for firing off reactor events in a runner module and seems to have nearly nothing cloud specific in there. It would be great if it was moved (and slightly modified) to be part of salt.utils.event. This would make it easier to find and probably encourage it's use.

tkent-xetus avatar May 19 '15 03:05 tkent-xetus

I think that makes sense @tkent-xetus. Thanks!

rallytime avatar May 19 '15 16:05 rallytime

@tkent-xetus, that function was originally a wrapper that was used at a time when the event system was in transition. I think we can safely remove pre-0.17.x references from it now.

It's also poorly done (says the guy that wrote it). It needs to be replaced with something that doesn't reinitialize the event class every time it's called.

techhat avatar May 19 '15 18:05 techhat

I think the right thing to do here is to initialize the event class inside each cloud driver, and pass a reference to it each time a function is called inside salt.utils.cloud that uses it. This is probably the best way to handle it in a runner too.

techhat avatar May 19 '15 18:05 techhat

@techhat ah, I see. It would be nice to have a utility for the purposes of firing an event that maintained some very simple interface, but it seems like salt.utils.cloud.fire_event is not the answer.

I'll keep with using custom code in our runners for now and I guess this can be closed.

tkent-xetus avatar May 19 '15 18:05 tkent-xetus

TBH, I think I would rather keep this open for the moment. It really would be helpful elsewhere, it just needs to be done right.

techhat avatar May 19 '15 18:05 techhat

I thought of some ideas, but when it came down to it, it always felt better to just initialize the event class once, and then use it afterwards. When it comes down to it, we're only saving a couple of lines of code, at a bigger expense of performance.

techhat avatar May 19 '15 20:05 techhat