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

config.omnibus.install_url = '/some/path/on/the/host' doesn't work on windows #110

Open
vinyar opened this issue Jan 28, 2015 · 3 comments

Comments

@vinyar
Copy link

vinyar commented Jan 28, 2015

Looks like on windows the download is initialized with WebClient, and the ?v breaks when attempting to 'download' from local path.

Vagrantfile:

    config.omnibus.chef_version = '12.0.3'
    config.omnibus.install_url = 'c:\\parent_binaries\\chef_client\\'
    config.vm.guest = :windows #needed for vagrant omnibus to work (1.4.1 has a bug https://github.com/chef/vagrant-omnibus/issues/90)
    config.vm.communicator = "winrm"

Error:

powershell -command "(New-Object System.Net.WebClient).DownloadFile('c:\parent_binaries\chef_client\?v=%version%', '%dest%')"

Gets translated to:
(New-Object System.Net.WebClient).DownloadFile('c:\parent_binaries\chef_client\?v=12.0.3', 'C:\Users\vagrant\chef-client-12.0.3-1.windows.msi')
PS C:\Users\vagrant> (New-Object System.Net.WebClient).DownloadFile('c:\parent_binaries\chef_client\?v=12.0.3', 'C:\User
s\vagrant\chef-client-12.0.3-1.windows.msi')
Exception calling "DownloadFile" with "2" argument(s): "Illegal characters in path."
At line:1 char:47
+ (New-Object System.Net.WebClient).DownloadFile <<<< ('c:\parent_binaries\chef_client\?v=12.0.3', 'C:\Users\vagrant\ch
ef-client-12.0.3-1.windows.msi')
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

I am not sure if there is a simple syntax change that would allow both. Paging @smurawski

@vinyar
Copy link
Author

vinyar commented Jan 28, 2015

After looking at the code in more details, if I understood it correctly, it doesn't look like Windows supports custom installer script.

if windows_guest? generate install.bat, otherwise use custom one for linux.

I am not familiar with Vagrants internals, so I don't know if Vagrant::Util::Downloader works on windows. But it would be nice if a custom installer could be defined for windows as well.

@vinyar
Copy link
Author

vinyar commented Jan 28, 2015

testing the following syntax

if(test-path '#{url}\chef-client*%version%-1.windows.msi'){
  copy '#{url}\chef-client*%version%-1.windows.msi %dest%'
}else{
  (New-Object System.Net.WebClient).DownloadFile('c:\parent_binaries\chef_client\?v=%version%', '%dest%')
}

@vinyar
Copy link
Author

vinyar commented Jan 28, 2015

pull request here:
#111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant