Skip to content
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

List of tasks to be executed #706

Closed
rsaikali opened this issue Aug 16, 2012 · 5 comments
Closed

List of tasks to be executed #706

rsaikali opened this issue Aug 16, 2012 · 5 comments

Comments

@rsaikali
Copy link

@rsaikali rsaikali commented Aug 16, 2012

Hi,

I'm looking for a way to find all the tasks to be executed.

$ fab -H myhost task1 task2

env.tasks (or whatever) could be set to ['task1', 'task2']

Thanks.

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Aug 16, 2012

It's not part of the public API, but you can do this:

import fabric.state

print fabric.state.commands.keys()

fabric.state.commands is the data structure fab builds when it parses args & such. It's a dict of the form {'task_name': task_object}.

@bitprophet bitprophet closed this Aug 16, 2012
@rsaikali
Copy link
Author

@rsaikali rsaikali commented Aug 17, 2012

Thanks for the quick reply.

But it seems to give me the entire list of tasks for the current fabfile (it can be useful too... I was parsing a 'fab -l' to find these...).
It doesn't give me those asked to be executed.

fab -H myhost task1 task2
['task1', 'task2', 'task3', 'task4']

I was expecting :

['task1', 'task2']
@rsaikali
Copy link
Author

@rsaikali rsaikali commented Aug 17, 2012

Found from fabric.main, in command line parsing :

parser, options, arguments = parse_options()

where arguments is the list of tasks asked to be run... (but maybe other stuff... need to test more...).

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Aug 17, 2012

Sorry, my bad -- I tested on a quick test fabfile. You're right -- we don't store the parsed info into env. It would be simple to do so -- if you want to dig into it I'd totally accept a patch.

@bitprophet bitprophet reopened this Aug 17, 2012
@bitprophet
Copy link
Member

@bitprophet bitprophet commented Aug 20, 2012

Moving to #709

@bitprophet bitprophet closed this Aug 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants