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

vsphere-iso - UNC paths in iso_url don't work anymore #8729

Closed
jpgrall opened this issue Feb 13, 2020 · 10 comments · Fixed by #8954
Closed

vsphere-iso - UNC paths in iso_url don't work anymore #8729

jpgrall opened this issue Feb 13, 2020 · 10 comments · Fixed by #8954
Assignees
Labels
bug core Core components of Packer track-internal
Milestone

Comments

@jpgrall
Copy link

jpgrall commented Feb 13, 2020

Overview of the Issue

Recently updated to 1.5.2 to use the new integrated vsphere-iso builder. Upon running my workflows (which previously worked on version 1.4.5), I'm getting the following message when it's retrieving the iso. I cleared the packer_cache but the issue still occurs.

09:34:38 ==> vsphere-iso: Download failed download not supported for scheme 'smb'

Reproduction Steps

Run packer build -var "iso_url=smb://server.domain.com/W2k19StandardBase.iso"

Packer version

1.5.2

Simplified Packer Buildfile

https://gist.github.com/jpgrall/e745fd96b6f059a311fed51fa7343190

Operating system and Environment details

Microsoft Windows Server 2012 R2 Datacenter

Log Fragments and crash.log files

09:34:38 vsphere-iso: output will be in this color.
09:34:38
09:34:38 ==> vsphere-iso: Retrieving ISO
09:34:38 ==> vsphere-iso: Trying smb://server.domain.com/W2k19StandardBase.iso
09:34:38 ==> vsphere-iso: Trying smb://server.domain.com/W2k19StandardBase.iso?checksum=md5%checksumvaluehere
09:34:38 ==> vsphere-iso: Download failed download not supported for scheme 'smb'
09:34:38 ==> vsphere-iso: Trying [] /usr/lib/vmware/isoimages/windows.iso
09:34:38 ==> vsphere-iso: Trying %5B%5D%20/usr/lib/vmware/isoimages/windows.iso?checksum=md5%checksumvaluehere
09:34:38 ==> vsphere-iso: Download failed source path error: CreateFile C:/ws/[] /usr/lib/vmware/isoimages/windows.iso: The system cannot find the path specified.
09:34:38 ==> vsphere-iso: error downloading ISO: [download not supported for scheme 'smb' source path error: CreateFile C:/ws/[] /usr/lib/vmware/isoimages/windows.iso: The system cannot find the path specified.]
09:34:38 Build 'vsphere-iso' errored: error downloading ISO: [download not supported for scheme 'smb' source path error: CreateFile C:/ws/[] /usr/lib/vmware/isoimages/windows.iso: The system cannot find the path specified.]
09:34:38
09:34:38 ==> Some builds didn't complete successfully and had errors:
09:34:38 --> vsphere-iso: error downloading ISO: [download not supported for scheme 'smb' source path error: CreateFile C:/ws/[] /usr/lib/vmware/isoimages/windows.iso: The system cannot find the path specified.]
09:34:38
09:34:38 ==> Builds finished but no artifacts were created.

@jpgrall jpgrall added the bug label Feb 13, 2020
@jpgrall
Copy link
Author

jpgrall commented Feb 13, 2020

Seems similar to #7783. Testing various formats of the iso_url to confirm.

@jpgrall
Copy link
Author

jpgrall commented Feb 13, 2020

Getting "Download failed invalid source string:" when using //server.domain.com/W2k19StandardBase.iso format rather than smb://server.domain.com/W2k19StandardBase.iso.

@jpgrall jpgrall changed the title vsphere-iso not supporting smb vsphere-iso - UNC paths in iso_url don't work anymore Feb 13, 2020
@sylviamoss sylviamoss added the core Core components of Packer label Feb 14, 2020
@andzn
Copy link

andzn commented Feb 26, 2020

Probably caused by #7627 ? @azr

@GMZwinge
Copy link

Seems to have existed before #7627. See for example #8552. UNC path seems to have stopped working after 1.3.5, although the debug and/or error messages have slightly changed depending on versions. Could go-getter not work with UNC path?

@SwampDragons
Copy link
Contributor

Yes, I suspect this is a result of the go-getter change. We'll probably need to make a PR against go-getter to make this work, though I haven't had a chance to sit down and work through this yet.

@SwampDragons SwampDragons added this to the 1.6.0 milestone Mar 10, 2020
@andzn
Copy link

andzn commented Mar 10, 2020

I took a quick look on the code, and debugged it a little bit and there's a lot of weird stuff going on there when it comes to UNC paths, mostly because they are not really URLs. I was able to hack up a working solution, but it was a little bit hard for me to find out a clean one, given the complexity of the current logic that covers many corner-cases.

From what I saw this is what's happening:
This line transforms every UNC path of the form \\server\share into a smb URL (smb://server/share). The go-getter however, doesn't support smb URLs. This is why before #7627, there used to be defined an smb getter which was only an alias to the file getter. Once that was removed, using a UNC path returns 'Download failed download not supported for scheme 'smb''.
Since smb is not supported, I decided to give file URIs a chance: file://server/share. However, it seems that go-getter doesn't cover the case where a file URI refers to a network share. But besides that, the logic in the download step from packer also modifies the passed file URL in such a way that it doesn't really look like a file url when it gets passed to go-getter anymore.

@SwampDragons
Copy link
Contributor

This is potentially the same underlying issue as #8552

@andzn
Copy link

andzn commented Mar 26, 2020

@sylviamoss I'm not sure where your comment has disappeared, but I've tested https://circleci.com/gh/hashicorp/packer/41554#artifacts/containers/0 and it worked perfectly for me.

@sylviamoss
Copy link
Contributor

sylviamoss commented Mar 26, 2020

Good to know! I deleted the comment because one pipeline failed in my PR but nothing that would change the solution for you. I will send the binaries again if necessary! I was able to reproduce it locally anyways :D
Thanks for testing!

@ghost
Copy link

ghost commented Jul 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jul 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug core Core components of Packer track-internal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants