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

Specify -InputFormat None #6

Closed
joshcooper opened this issue Jul 11, 2013 · 6 comments
Closed

Specify -InputFormat None #6

joshcooper opened this issue Jul 11, 2013 · 6 comments

Comments

@joshcooper
Copy link
Contributor

@rismoney suggested we specify -InputFormat None to ensure the powershell script doesn't block reading from stdin. Alternatively, write the script to a tempfile and use -file <path>. See comment #5 (comment)

@joshcooper
Copy link
Contributor Author

@rismoney does the PR #8 make this issue no longer applicable?

@rismoney
Copy link

I can't remember for the life of me how I personally came to that option beyond some script I ran jamming up for no good reason :)

googled:
http://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected#

Overall, the temp file might be the better, than the script block approach I was originally thinking...Combine with the future planned eheredoc capability, and it might be ideal.

On another similar note, I have come to a realization about erb templates (content function) and exec resources should be avoided. We rspec our puppet repo, say for determining if an erb is a valid ruby template. A script can't be valid code, and have embedded ruby.. So I modded our powershell scripts to all accept puppet values as command line parameters. Embedding ruby in powershell is a recipe for trouble...

@joshcooper
Copy link
Contributor Author

A script can't be valid code, and have embedded ruby

is this because the ERB syntax, e.g. <%= hostname %>, has special meaning in powershell, and needs to be escaped?

@rismoney
Copy link

Special meanings run both ways and not limited to PowerShell so if I want to rspec my puppet repo to ensure all erb templates are syntactically sound and all scripts are clean too erb and scripts become mutually exclusive.

I thought I would then ditch content func and go to file func but file function is pmaster server side load into var. Scripts are hard to troubleshoot without being on endpoint except for easy ones. So I think file resource -> exec resource dependency is the right way...

The heredoc idea becomes less needful since you now are dropping things into a file. I am not sure how args play into exec in new approach.

@rismoney
Copy link

Perhaps I need to try use cases...

@joshcooper
Copy link
Contributor Author

@rismoney I'm marking this particular issue as resolved by commit a278941. I'm interested in what your saying about mixing powershell and erb, but haven't thought through all of the implications. It'd be awesome if you could open an issue with some code snippets illustrating the problem.

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