fgrehm / vagrant-cachier

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

Cachier should not bail out #142

Closed tknerr closed 1 year ago

tknerr commented 9 years ago

Given a Vagrantfile like this:

Vagrant.configure(2) do |config|
  config.vm.provider "docker" do |d|
    d.build_dir = "."  # Dockerfile right here
  end
end

When I vagrant up, cachier bails out hard with an exception:

C:\Repos\_github\bills-kitchen\target\build\tmp\vagrocker>vagrant up
Bringing machine 'default' up with 'docker' provider...
==> default: Docker host is required. One will be created if necessary...
    default: Docker host VM is already ready.
C:/Repos/_github/bills-kitchen/target/build/home/.vagrant.d/gems/gems/vagrant-cachier-1.2.0/lib/vagrant-cachier/action/configure_bucket_root.rb:44: in `cache_root': Cachier plugin only supported with docker provider when image is used (RuntimeError)
        from C:/Repos/_github/bills-kitchen/target/build/home/.vagrant.d/gems/gems/vagrant-cachier-1.2.0/lib/vagrant-cachier/action/configure_bucket_root.rb:24: in `setup_buckets_folder'
        from C:/Repos/_github/bills-kitchen/target/build/home/.vagrant.d/gems/gems/vagrant-cachier-1.2.0/lib/vagrant-cachier/action/configure_bucket_root.rb:16: in `call'
        from C:/Repos/_github/bills-kitchen/target/build/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34: in `call'
        from C:/Repos/_github/bills-kitchen/target/build/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95: in `block in finalize_action'
        from C:/Repos/_github/bills-kitchen/target/build/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34: in `call'

Well, it says clearly "Cachier plugin only supported with docker provider when image is used (RuntimeError)". Well, I didn't use image but build_dir instead.

So clearly it's my fault, but wouldn't it be possible to disable the bucket / cachier instead of throwing an exception here?

tknerr commented 9 years ago

I have to add that I have vagrant-cachier globally (and transparently) enabled via my global ~/.vagrant.d/Vagrantfile:

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

That's why cachier is enabled in the first place.

I like that approach because it's totally transparent. However, as you see it bails out when I use build_dir in the example above.

lferro9000 commented 8 years ago

Shouldn't the docker VM that uses build_dir be:

Vagrant.configure(2) do |config| config.vm.provider "docker" do |d| config.cache.enable = false d.build_dir = "." # Dockerfile right here end end

There are references on https://github.com/fgrehm/vagrant-cachier/blob/master/lib/vagrant-cachier/config.rb regarding the a disable! and the enabled value.

Also, if ALLOWED scope had a NONE value, that could be checked and if scope was NONE, then that could be used to trigger a "soft" disable.

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: