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

Callback support for run_command in parallel and single clients #275

Open
pkittenis opened this issue Jan 19, 2021 · 0 comments
Open

Callback support for run_command in parallel and single clients #275

pkittenis opened this issue Jan 19, 2021 · 0 comments

Comments

@pkittenis
Copy link
Member

Is your feature request related to a problem? Please describe.
Would like to be able to use callback function for run_command to call when a command has finished executing.

Describe the solution you'd like

def my_cb(host_out, my_arg):
    for line in host_out.stdout:
        print(line)

client.run_command('echo me', callback=my_cb, callback_extra_args=('my_arg',))

my_cb gets executed as my_cb(host_out, 'my_arg') when command completes on each host. This allows for output handling code to be executed automatically on command completion without client code having to store or handle output objects explicitly.

Describe alternatives you've considered
Can be done by sub-classing, though non-trivial.

Additional context
N/A.

@pkittenis pkittenis added this to the 2.7.0 milestone Feb 16, 2021
@pkittenis pkittenis removed this from the 2.7.0 milestone Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant