-
Notifications
You must be signed in to change notification settings - Fork 116
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
Would be nice to be able to execute code in target plans. #82
Comments
I'm planning to change the API in upcoming versions. |
would we be able to export tasks? I'd love to make a command and control application and use it like rundeck, where when X is detected, fire flight plan 1, when rest call Y is received, fire flight plan 2. you could even name it something amusing like control tower. or just make a rest api that fires flight plans and call it control tower. |
+1 on control tower. would love that and integrate it with Slack here. |
You can programmatically run Flightplan: // flightplan.js
var plan = module.exports = require('flightplan'); // export instance
...
// api.js
var plan = require('./flightplan'); // load instance from local flightplan.js
plan.run(task, target, options); Is this enough? Of course you can split up your tasks and targets into multiple files. This should get you an idea: // flightplan.js
var plan = require('flightplan'); // export with `module.exports` if wanted, see above
require('./tasks')(plan);
require('./targets')(plan);
// tasks.js and targets.js
module.exports = function(plan) {
/* setup tasks or targets here */
}; Edit: I think it's not even necessary to pass the plan there because I'm exporting always the same instance in ./lib/index.js#L409 |
ah, I didn't realize you could do that, for some reason I always just assumed you had to use the CLI, thanks for taking the time to clarify this for me, I appreciate it. |
I feel this should be mentioned in the docs. |
Just wanted to +1 the API change to |
It would be useful if it would be possible to execute local code in target plans as you might want to run some shell commands to figure out what hosts you have to connect to. For example to connect to a vagrant machine you need to write code like
which is not the nicest way. In fabric it can look like :) Just a feature request.
The text was updated successfully, but these errors were encountered: