cfengine / design-center

CFEngine community-contributed content
http://cfengine.com/
Other
80 stars 68 forks source link

RFC sketch to manage tmux sessions #210

Open nickanderson opened 11 years ago

nickanderson commented 11 years ago

If you have a moment, take a look. I have been playing with defaults recently, they are used in the sketch, probably wont ever be triggered if your using cf-sketch to configure the sketch.

https://github.com/nickanderson/design-center/blob/feature/tmux_sessionManager/sketches/utilities/tmux/sessionManager/main.cf

Anyway this sketch manages the existence (or non existence) of a named tmux session. You can give it config options and a command. I use something similar to make sure that my irssi client is up on my server.

1) I'm not convinced about variable names or sketch names 2) I'm not sure about the meta entry for vars[tmux_config][type]" string => "SLIST"; I dont think SLIST is a valid type. Needs to be a string that gets split inside the sketch? 3) its not namespaced yet.

tzz commented 11 years ago
nickanderson commented 11 years ago

On 01/11/2013 03:28 PM, Ted Zlatanov wrote:

*

SLIST should be LIST(NON_EMPTY_STRING) and on the sketch side you'll
get an slist. Don't give it a default.

*

namespacing is hard the first few times, let me know if you need that

I've done it before, its not too bad, just tends to be the last thing I do.

From interactive mode with cf-sketch I don’t see a way to generate a param.json file. Did I miss it or does it not exist?

markburgess commented 11 years ago

I can't help but feel that the sketch framework is too complex and over-engineered. The use of defaults looks fine, given the reason for needing them, but all the multi-dimensional arrays and wrapping make the actual CFEngine promises quite opaque. I would prefer a way to put the validation in an editing tool, or cf-sketch itself rather than cluttering a documentation language with technicalities.

I'm working on a simpler approach to see if we can use the base language more respectfully. In the mean time, it is fantastic that you are contributing to the cases., Nick.

On 11/01/13 22:08, Nick Anderson wrote:

If you have a moment, take a look. I have been playing with defaults recently, they are used in the sketch, probably wont ever be triggered if your using cf-sketch to configure the sketch.

https://github.com/nickanderson/design-center/blob/feature/tmux_sessionManager/sketches/utilities/tmux/sessionManager/main.cf

Anyway this sketch manages the existence (or non existence) of a named tmux session. You can give it config options and a command. I use something similar to make sure that my irssi client is up on my server.

1) I'm not convinced about variable names or sketch names 2) I'm not sure about the meta entry for vars[tmux_config][type]" string => "SLIST"; I dont think SLIST is a valid type. Needs to be a string that gets split inside the sketch? 3) its not namespaced yet.

— Reply to this email directly or view it on GitHub https://github.com/cfengine/design-center/issues/210.

CTO and Founder CFEngine

http://www.cfengine.com http://www.markburgess.org Twitter: @markburgess_osl, @CFEngine_news

tzz commented 11 years ago

Hi Mark,

I think Nick wanted a review of how the sketch he wrote fits the current DC language. I think we should start a separate discussion, in an issue here or on the mailing list or in private, about how the DC language may change in the future according to your vision.

tzz commented 11 years ago

Assigning to Diego to answer the question about saving the JSON parameters.

tzz commented 11 years ago

Nick, you can submit a pull request for this sketch if you like.

nickanderson commented 11 years ago

I'm not done testing it ;)

Ted Zlatanov notifications@github.com wrote:

Nick, you can submit a pull request for this sketch if you like.


Reply to this email directly or view it on GitHub: https://github.com/cfengine/design-center/issues/210#issuecomment-12245531

Sent from Kaiten Mail. Please excuse my brevity.

zzamboni commented 11 years ago

From interactive mode with cf-sketch I don’t see a way to generate a param.json file. Did I miss it or does it not exist?

Doesn't exist, but sounds like a useful feature. Could you please open a separate issue for this so I don't forget?