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

run_command: support an array of commands #3336

Closed
wants to merge 3 commits into from

Conversation

alex501212
Copy link
Contributor

!feature

  • *run_command: support an array of commands (#3333)

    Added run_commands method which allows an array of commands to be passed to run_command

@alex501212 alex501212 requested a review from donoghuc July 22, 2024 13:29
@alex501212 alex501212 self-assigned this Jul 22, 2024
@alex501212 alex501212 requested a review from a team as a code owner July 22, 2024 13:29
@CLAassistant
Copy link

CLAassistant commented Jul 22, 2024

CLA assistant check
All committers have signed the CLA.

* **run_command: support an array of commands* ([puppetlabs#3333](puppetlabs#3333))

  Added run_commands method which allows an array of commands to be passed to run_command
Copy link
Contributor

@donoghuc donoghuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not address the use case described in the issue. The request is to mirror the pattern in puppet's exec to be more explicit about parameterization. The example they give is: command => ['/bin/echo', 'hello world; rm -rf /']. Your PR here would do:
/bin/echo && hello world; rm -rf / which is absolutely not what we want.

Properly implementing this feature will involve making a similar change to how we use the underlying Open3 lib to take advantage of the explicit parameterization features.

@alex501212 alex501212 marked this pull request as draft July 23, 2024 08:42
@alex501212
Copy link
Contributor Author

alex501212 commented Jul 26, 2024

This does not address the use case described in the issue. The request is to mirror the pattern in puppet's exec to be more explicit about parameterization. The example they give is: command => ['/bin/echo', 'hello world; rm -rf /']. Your PR here would do: /bin/echo && hello world; rm -rf / which is absolutely not what we want.

Properly implementing this feature will involve making a similar change to how we use the underlying Open3 lib to take advantage of the explicit parameterization features.

Wondering if it would be acceptable splitting commands, then escaping each argument and then lastly joining arguments again into a single command? This way in [‘/bin/echo', 'hello world; rm -rf /'] the second command won’t run at all

My latest commit reflects those changes

@donoghuc
Copy link
Contributor

I think you are misunderstanding the feature request. it is not to be able to run multiple commands in the same invocation of the function. Instead it is to support explicit parameters to a single command.

@alex501212 alex501212 closed this Nov 7, 2024
@alex501212 alex501212 deleted the #3333 branch November 7, 2024 12:17
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

Successfully merging this pull request may close these issues.

3 participants