turn off the progress stream to prevent it from getting merged into stderr#1
turn off the progress stream to prevent it from getting merged into stderr#1afiune merged 1 commit intoafiune:WinRMfrom mwrock:WinRM
Conversation
|
BTW: I have filed a bug with Microsoft regarding this issue at https://connect.microsoft.com/PowerShell/feedback/details/927384/progress-stream-being-sent-to-stderr-in-winrm-responses |
|
I have two points here:
Thanks for posting this issue/PR... |
|
I just synced up and this reproduces on every first kitchen verify after creating a box. Subsequent verifies succeed. Just curious, after a kitchen destroy, does your first kitchen verify fail? BTW: I'm using serverspec tests. Happy to answer any questions on this. Here is the relevant excerpt from So SilentlyContinue will cause all writes to the progress stream (write-progress) to go to the unix equivalent of dev/null and thus winrm will not include that output in its responses. |
|
Interesting.. I do not have that problem at all.. Let's try to isolate the issue! Cloud you follow this simple Gist and create a new one with the output and share it with me? This test cookbook is using |
|
Looks like that gist will not run on windows which is where I have been hosting my testing. I'm running it on my linux (ubuntu 14) box now but it hangs on installing ridley. I'm gonna kill it and try again but I'm not very confident. Do you have anything that can run on windows? |
|
ok. after fiddling, i've got this running both on linux and windows. I'm running it with my Hyper-V vagrant box on windows since I cannot install VBox along side of it. I get a new error early in the convergence: Looks like it is trying to run linux commands on the host. On linux, I had to fanagle it to use my installed version of vagrant because it wanted to use it via a gem which vagrant did not like at all. Using your vbox image it did work. I'm gonna dig into this and see what needs to be done to get it working on a windows host. Thanks! |
|
The gist has been tested on Windows/Unix host.. So it should work. About that error, I'm thinking what is happening because that shouldn't happen now! that's an old issue.. uhmm could you try to delete the |
|
The bundle install never fully worked on windows and I have had lots of problems with bundler on windows. It dies when it tries to compile native extensions. So I just copied the new fems over the old ones which I realize is a bit sketchy. Here is the error from bundle install: I'll troubleshoot this later, but I also wanted to let you know that today I deployed your test-kitchen winrm fork on my ubuntu chef workstation at work. There I have a custom vsphere chef-metal driver that I extended so that it can also serve as a kitchen driver. Things mostly worked but I had these issues:
These should probably be the default for windows guests. I did not hit this before you pulled in Fletcher Nicols commits so I'm guessing this is related to that. Its interesting that I did not have issues with the progress stream on vbox. I did not really look deeply into it. Could be that vbox fundamentally does networking differently than hyper-v/vmware but I'm not sure why that would impact this issue. I'd be happy to test/troubleshoot/send PR's as I bump into stuff. Testability on Windows is key to our organization and some personal projects of my own. |
|
Great stuff @mwrock !!! I really like that you are testing this in different environments. For the first issue, I don't have a windows host to test but there is many people that is using it so I will pass this error to them to get some help. The second one, (vmware over linux) I can confirm that the properties that you set are the default one 👍 So I am not sure why you had to set it manually. I agree that I had to refactor some stuff after that bid giant commit but I'm sure I solved everything.. So I might assume (as you don't use bundler) that the code is old and you need to pull it down.. (maybe) Yeah, I'd be happy too. Please do it, continue sending them and I will track them down as we continue developing.. |
|
btw: I'm testing your PR on my MAC! 👍 |
|
Could you validate that you have this commit [https://github.com/afiune/test-kitchen/commit/9a7545b613e655ce65a642e99b5e3cf2c2b92428] applied on you local computer where you are testing.. |
|
Hey @btm could you help me with this? I know you tested my code on Windows7/Windows8 with ChefDK and without it.. Thanks in advance! |
|
Hey @afiune, on my ubuntu box, I did a gem build and then a gem install so that the change would be globally available because I enjoy living dangerously. After doing so a Kitchen -v shows I am using 1.3.0. while the previous version installed via chefdk is 1.2.1/1.2.2.dev. I admit that I am still far from comfortable with the nuances of ruby versioning conventions enforced by gems and bundler but would it be possible that that would not be sufficient? I did confirm that 1.3.0 includes the commit referenced above. |
|
@mwrock in your bundle install error, I see: I encountered similar errors with In any case, I wonder where this copy of HTH. |
|
@danielsdeleo I think the issue is that it is calling and the windows mkdir command does not have a -p parameter. |
|
just synced up my branch cleaning up the conflicts. |
|
ok i found the missing link on my windows box. I run chef via chefdk. chefdk calls the test-kitchen bits from embedded/apps and that was not updated. After copying the latest test-kitchen/lib over apps/test-kitchen/lib, things are working again. However, if I remove my edit to winrm_base, I continue to get errors like this: Note the 0 error code and no error message. The raw winrm response is: You can easily reproduce this in irb: Unless you have a winrm client customized to parse out these progress messages, they are invisible to a winrm session. These are those progress bar messages in light blue that you sometimes see in a powershell console. Since the content in the context of a test-kitchen run is immaterial to the actual test run, the easiest way to get around this is to simply turn off the progress stream output. |
[PoSH] Turn off the progress stream to prevent it from getting merged into STDERR.
|
Hey you wanna test the new Transport Abstraction? It's Released!!
https://github.com/afiune/tk-multiplatform |
|
Oh I am SO on it! |
|
So this is slightly better and perhaps a good move as a "default" implementation. Using my "wrapper" cookbook with direct dependencies on: Note: The above list does not include transitive dependencies. There are quite a few. Setting Adjusting Obviously 6 minutes is still way to long to wait. What I like about the new transport model is that I can now create my own vsphere_winrm transport class that leverages the vsphere API and can bring the time down to a couple seconds. I'd think that you could do something with synced folders to get the vagrant plugin down to a similar number. Adding a synced folder on the sandbox directory parent and then just do a Copy-Item in powershell via winrm. One thing to include in error handling would be to make sure connections are closed. I had to manually kill all the winrs processes on the windows node. Also (and this is an issue with the winrm gem) the "real" error when the limit is exceeded is hidden and the user only gets a generic 500 message with nothing actionable. I had to hack the winrm gem to see the true error (I could have done the same by sniffing the http traffic). I have filed an issue WinRb/WinRM#83 to address that. Before I refactor my fork and create a new transport, can you tell me if the basic structure here is pretty stable or would you suggest holding off to let the dust settle? Thanks!! |
|
Hey @mwrock pretty good catch!! Thanks for opening that ticket ... Let's see if @sneal has some comments about it! I know this new Talking about the upload process I think it should stay like that since test-kitchen has many other drivers and not only I would say hold on just next week to get the approval from @fnichol... But you can start doing some work around it since I really don't think it will change to much. 👍 |
|
Cool. I had another thought on the "default" winrm implementation: With powershell remoting you can transfer files like this: http://www.powershellcookbook.com/recipe/ISfp/program-transfer-a-file-to-a-remote-computer This essentially streams the binary content and I don't think it does so by sending several requests, but maybe it does. I've used it with some large transfers and it is much faster than what we are seeing here. Powershell remoting is built on top of winrm and I'm not certain off the top of my head how this could be implemented in straight up winrm but it would be interesting to reverse engineer the http messages and come up with a winrm implementation that does the same. It may mean needing to extend the winrm gem but that would be a cool feature if its feasible. I have not looked closely myself yet and it is possible my payloads were much smaller than the set of cookbooks I am dealing with here and it actually is sending several requests. Even so, you could still achieve large optimizations by compressing to a single file and using much larger chunks than the 8k here. Might be worth a look... |
|
Nice! I will take a look tomorrow ... |
|
Just took a look at a 45mb file copy in wire shark. It does make several posts but they are around ~180k each. |
|
I briefly looked closer at this today and it looks quite doable to get some significant optimizations here. First, the easiest way to reverse engineer this is from a Windows client.
So looking at this I noticed that the winrm stream had a command element and an argumants element. You can see here the small script included in the link above but the bytes that get piped into that script are in the . I'm betting that the arguments are not bound to a size limit. What is also interesting here is that the powershell script is not wrapped in a cmd.exe call to powershell so the arguments are actual powershell arguments. I'm guessing this is done because the winrm endpoint is So the base winrm gem would need to be adjusted to accomodate a "pure" ps shell but even without that you could take advantage of calling the winrm Not sure what your priorities look like, but I'd be happy to take a stab at this this week if you are in the middle of other stuff. Otherwise just keep me posted on how things are progressing. This is all very exciting stuff to see convergence testing becoming a reality on Windows and thanks a bunch for the good work here!! |
|
I'd like to see the winrm gem contain some sort of remote file system abstraction. It would reduce duplication between this and Vagrant. @mwrock Interesting findings about larger file sizes. I'm going to look at that. |
|
+1 on handling this from the winrm gem. Some kind of file_copy method exposed from their would be great! |
I have been noticing that when converging the first time and also on kitchen setup, kitchen fails with false errors. These come from the powershell progress stream sending progress activity to stderr with harmless messages. Here is an example:
from: