fgrehm / vagrant-cachier

Caffeine reducer
http://fgrehm.viewdocs.io/vagrant-cachier
MIT License
1.07k stars 111 forks source link

Windows Guest Support for Generic Bucket (and others too?) #137

Closed tknerr closed 1 year ago

tknerr commented 9 years ago

Not sure if this is a generic bucket specific issue or a general one.

Since I want caching by default I put this in my global ~/.vagrant.d/Vagrantfile:

Vagrant.configure("2") do |config|

  # enable cachier globally
  if Vagrant.has_plugin?("vagrant-cachier")
    config.cache.scope = :box

    # cache bussers for test-kitchen
    config.cache.enable :generic, {
      "busser" => { cache_dir: "/tmp/busser/gems" }
    }
  end
end

However, when I boot up a Windows VM, e.g.like so...

Vagrant.configure(2) do |config|
  config.vm.box = "tknerr/eval-win7x64-enterprise"
  config.vm.provider "virtualbox" do |vbox|
    vbox.gui = true
  end
end

...I get this error:

C:\Repos\_stash\vagrant-chef-excercises\04-vagrant-windows-boxes\solution\code>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
    default: The Berkshelf shelf is at "W:/home/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150203-9120-6wyuaf-default"
==> default: Importing base box 'tknerr/eval-win7x64-enterprise'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'tknerr/eval-win7x64-enterprise' is up to date...
==> default: Setting the name of the VM: code_default_1422993280514_36513
==> default: Fixed port collision for 22 => 2222. Now on port 2202.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 3389 => 3389 (adapter 1)
    default: 5985 => 5985 (adapter 1)
    default: 22 => 2202 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => C:/Repos/_stash/vagrant-chef-excercises/04-vagrant-windows-boxes/solution/code
    default: /tmp/vagrant-cache => W:/home/.vagrant.d/cache/tknerr/eval-win7x64-enterprise
==> default: Configuring cache buckets...
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

rm /tmp/busser/gems -recurse -force
if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }

Stdout from the command:

Stderr from the command:

#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">Remove-Item : Cannot find path 'C:\tmp\busser\gems' because it does not exist._x000D__x000A_</S><S S="Error">At line:1 char:3_x000D__x000A_</S><S S="Error">+ rm &lt;&lt;&lt;&lt;  /tmp/busser/gems -recurse -force_x000D__x000A_</S><S S="Error">    + CategoryInfo          : ObjectNotFound: (C:\tmp\busser\gems:String) [Rem _x000D__x000A_</S><S S="Error">   ove-Item], ItemNotFoundException_x000D__x000A_</S><S S="Error">    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.Remov _x000D__x000A_</S><S S="Error">   eItemCommand_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>
tknerr commented 9 years ago

Currently adding this to my windows box Vagrantfiles to disable the generic bucket:

...
  # disable the generic cache
  config.cache.enable :generic, {}
...

Actually it would be great if I could determine whether this vagrant execution is part of a test-kitchen run in the global Vagrantfile, so taht I enable the "busser" generic cache dir only in this case...

fgrehm commented 9 years ago

Disabling a specific bucket will be implemented at some point.

As per improving windows guests support, I'm :+1: on it but I personally don't have a need for that =/ If you or someone else is able to put up a PR I'd me more than happy to review it / bring it in!

tknerr commented 7 years ago

Stumbled upon this again. Bummer that the generic cache bucket does not work with windows guests :-/

fgrehm commented 1 year ago

Hey, sorry for the silence here but this project is looking for maintainers :sweat_smile:

As per https://github.com/fgrehm/vagrant-cachier/issues/193, I've added the ignored label and will close this issue. Thanks for the interest in the project and LMK if you want to step up and take ownership of this project on that other issue :wave: