libcompose icon indicating copy to clipboard operation
libcompose copied to clipboard

flexing up libcompose to call other pluggable elements?

Open jainvipin opened this issue 9 years ago • 2 comments

@vdemeester and other matinainers - just wanted to run by you if there is any interest in taking a PR that does following: https://github.com/jainvipin/libcompose/tree/deploy/deploy

It provides a very simple hook along the following lines https://github.com/jainvipin/libcompose/blob/deploy/cli/app/app.go#L42

Feel free to close the issue if this looks like a hack/noise...

jainvipin avatar Apr 25 '16 02:04 jainvipin

I might not completely understand your use case, but I think something equivalent can be accomplished without the hooks. You can create custom commands while reusing the existing command definitions from cli/command/command.go. Then you can swap out the command action with whatever you'd like while leaving the rest of the command the same. In your case, you could create a new action that does the following.

  1. Runs any pre-hook functions
  2. Runs the existing action
  3. Runs any post-hook functions

joshwget avatar Apr 25 '16 06:04 joshwget

@joshwget - thanks, few follow-ups:

  • The intent of the command itself is same (up/stop/scale/etc.) but the network policy creation is automated alongside running the application composition. Thus keeping the same Ux is a desire because that semantics doesn't change when composition is run/stopped/scaled/etc.
  • Modifying the command in cli/command/command.go would require that project/services/etc isderived again in the pre/post function. I was hoping to leverage all that with project hook, for example as in https://github.com/jainvipin/libcompose/blob/deploy/deploy/nethooks/policy.go

jainvipin avatar Apr 26 '16 08:04 jainvipin