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

get_suprocess_output does not have a way to provide stdin #3430

Closed
gotyaoi opened this issue Mar 29, 2019 · 6 comments
Closed

get_suprocess_output does not have a way to provide stdin #3430

gotyaoi opened this issue Mar 29, 2019 · 6 comments

Comments

@gotyaoi
Copy link

gotyaoi commented Mar 29, 2019

This is a feature request, so have not included the debugging information.

Simply put, the get_suprocess_output function (https://github.com/DataDog/integrations-core/blob/master/datadog_checks_base/datadog_checks/base/utils/subprocess_output.py#L27) gives no way to provide stdin to a subprocess. The use case I have in mind is running a pipeline. Since the docs explicitly say that the command is run without a shell, you couldn't do it with a shell pipeline, so the only option is to capture the output of one command and manually pass it to another, emulating the pipeline.

@stale
Copy link

stale bot commented Apr 28, 2019

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

@stale stale bot added the stale label Apr 28, 2019
@hithwen
Copy link
Contributor

hithwen commented Jul 4, 2019

Hallo @gotyaoi, can you elaborate more on your use case? Are you trying to write a new integration/custom check that requires running a pipeline?

@stale stale bot removed the stale label Jul 4, 2019
@gotyaoi
Copy link
Author

gotyaoi commented Jul 5, 2019

Yes, we've written a custom check (not integration) based on an already existing nagios check we had that operates on pkcs12 files. It does this by calling out to the openssl binary, once to get the x509 from the pkcs12 and once to get information from the x509. This could be done in python using the cryptography library, but the version included with datadog is only 2.3.1 and the pkcs12 support didn't show up until 2.5. We've managed to work around it in this case by calling openssl to get the x509 data, then loading the x509 data into cryptography and getting the information that way, but that wouldn't be possible in other cases where we just needed to use installed system utilities.

@hithwen
Copy link
Contributor

hithwen commented Jul 8, 2019

Ok @gotyaoi, we've updated cryptography library in #4000. That will ship with agent release 6.13, will that solve the need for changing get_suprocess_output?

@gotyaoi
Copy link
Author

gotyaoi commented Jul 8, 2019

In this specific case. However, I wonder about situations where the utility used is not covered by a package that comes with the agent. You'd have to add entirely new libraries for each case, which seams troublesome in future.

@hithwen
Copy link
Contributor

hithwen commented Jul 9, 2019

Hallo @gotyaoi, thanks for your quick response. Let's not get ahead of ourselves, you can open a new issue if or when that happens.
Changing base check API is not currently on our roadmap but we also welcome code contributions if you'd like to open a PR.

I'm closing this issue now as I understand 6.13 release will solve it. Please feel free to reopen if that is not the case.

@hithwen hithwen closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants