misheska / basebox-packer

Packer templates for vagrant baseboxes
286 stars 80 forks source link

WinRM not configured on win7x64-pro box #54

Closed schisamo closed 10 years ago

schisamo commented 10 years ago

I generated a new win7x64-pro box and WinRM is not configured. I believe it's related to the "fix networking" logic which is not being applied correctly. If I comment out these lines the network is tweaked as expected: https://github.com/misheska/basebox-packer/blob/master/template/windows7/floppy/install-winrm.cmd#L15-L16

I see this same behavior with both VMware and VirtualBox boxes.

schisamo commented 10 years ago

So I brought a Windows 7 instance up and ran the command that determines if the network should be fixed and got this output:

C:\Users\vagrant>systeminfo | findstr /B /C:"OS Name" | findstr "Windows 7"
OS Name:                   Microsoft Windows 7 Professional

C:\Users\vagrant>echo %ERRORLEVEL%
0

C:\Users\vagrant>

Based on those findings I think we want to to fix the network if errorlevel 1. Perhaps this was just a mistake in @rasa's recent commit: https://github.com/misheska/basebox-packer/commit/ad90e9b6020fc09f18791cdbbb26bff6df97db1e#diff-769740064ff1789b4a861546fa2e1d4cR20.

misheska commented 10 years ago

Yup, looks like it - will need to run through a build cycle before promoting the change. Thanks!

misheska commented 10 years ago

Also, since I have a primitive test harness now (with serverspec), this is a good candidate for a regression test - checking to see if WinRM is available, so want to add that in as well...

misheska commented 10 years ago

Very interesting issue - key is that 'FINDSTR "Windows 7"' doesn't do what Ross thought it does - it actually searches for "Windows" OR "7"...he forgot the /C it seems, but testing...

misheska commented 10 years ago

Yup, that did the trick! Ross was trying to make that file work for all versions of Windows, and we didn't actually test on Windows 7. The command just needs to be changed to this: systeminfo | findstr /B /C:"OS Name" | findstr /C:"Windows 7"

misheska commented 10 years ago

Looks like it also needs the modified errorlevel, as the findstr exit code is backwards along with the /C, testing

misheska commented 10 years ago

Success! Committing variant to Windows 7 - now testing to make sure it doesn't break anything in the others

misheska commented 10 years ago

Also seems to work on Windows 2012R2 - committed change and closing issue

rasa commented 10 years ago

My bad, guys, sorry 'bout that!

In my defense, I did test the build on Windows 7, but only to see if the box built, or not.

misheska commented 10 years ago

It's all good - it did prompt me to accelerate the process of getting automated box tests into the build pipeline. Now when the boxes are built, a vagrant up/destroy is performed automatically on the box to verify it actually works. Plus I now have the ability to reach inside the box using serverspec and run lots more tests to check the box (though right now the tests are just POC stubs until I run through a whole suite of box builds). I'm finding a few more issues with the current templates as the builds run, and I'm posting issues when I find them. Going forward, I'll always run this automated test suite in a build before committing/merging any changes/PRs.