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

[script] Is there a limit on the number of char's within a script block #539

Closed
username-is-already-taken2 opened this issue Mar 14, 2016 · 4 comments
Labels
Type: Bug Feature not working as expected

Comments

@username-is-already-taken2
Copy link
Contributor

Hi there

I've come across an issue with regards to the script resouce.

I'm targeting a windows server using WINRM, my script is written in PowerShell and I'm using inspec version 0.15.0

The error I was getting was that when using the inspec shell the stdout of my script would return nothing ""

e.g.

inspec> script(script).stdout => ""
I know my script is OK, after a bit of troubleshooting I think there is a limit of 1166 characters.

Here is a script block to demonstrate, if you run this it should work (in that it returns the numbers) but if you add 5 to the last line it should fail.

script = <<-EOH
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 0123456789
write-host 01234
EOH

The script I'm trying to run comes in at just over 1600 chars (I'm having to use my own functions) but I'll see if I can put it on a diet to squeeze it in :)

Thanks

Gary

@chris-rock
Copy link
Contributor

@username-is-already-taken2 yes, at the moment there is a 8k upload limit as highlighted by @mwrock in WinRb/WinRM#87

So far we have not implemented a native upload feature, because we didn't had the need. I assume you want to use some powershell modules?

@chris-rock chris-rock added the Type: Bug Feature not working as expected label Apr 11, 2016
@amunoz951
Copy link

amunoz951 commented Jun 10, 2016

Running into the same issue. I have a powershell script that needs to run before a test and it's outputting nothing if it's longer than a certain length although the script is only 5k. My thinking is that I create the script in a separate recipe and add it to the kitchen run list. I'd rather do it all through the inspec code but may have to resort to this. Any other ideas?

@mwrock
Copy link
Contributor

mwrock commented Jun 10, 2016

Winrm v2 is getting super close but still probably a few weeks away. It will do away with the 8k limit.

In actuality the limit right now is closer to 5k because of the base64 encoding done.

@chris-rock
Copy link
Contributor

@username-is-already-taken2 with the recent move to winrm 2.0 we do not have that restriction anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

No branches or pull requests

4 participants