Skip to content

Commit

Permalink
Merge pull request #195 from andytson/feature/bento-atlas
Browse files Browse the repository at this point in the history
Use Bento's Atlas boxes by default if detected
  • Loading branch information
Seth Thomas committed Jan 15, 2016
2 parents 4f53d5f + 5697d9f commit 9eb3e6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
12 changes: 2 additions & 10 deletions lib/kitchen/driver/vagrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,15 @@ def create(state)
# @return [String,nil] the Vagrant box for this Instance
def default_box
if bento_box?(instance.platform.name)
"opscode-#{instance.platform.name}"
"bento/#{instance.platform.name}"
else
instance.platform.name
end
end

# @return [String,nil] the Vagrant box URL for this Instance
def default_box_url
return unless bento_box?(instance.platform.name)

provider = config[:provider]
provider = "vmware" if config[:provider] =~ /^vmware_(.+)$/

if %w[virtualbox vmware].include?(provider)
"https://opscode-vm-bento.s3.amazonaws.com/vagrant/#{provider}/" \
"opscode_#{instance.platform.name}_chef-provisionerless.box"
end
nil
end

# Destroys an instance.
Expand Down
22 changes: 2 additions & 20 deletions spec/kitchen/driver/vagrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def run_command(_cmd, options = {})
before { allow(platform).to receive(:name) { "#{name}-99.04" } }

it "sets :box based on the platform name by default" do
expect(driver[:box]).to eq("opscode-#{name}-99.04")
expect(driver[:box]).to eq("bento/#{name}-99.04")
end

it "sets :box to a custom value" do
Expand All @@ -163,25 +163,7 @@ def run_command(_cmd, options = {})
expect(driver[:box]).to eq("booya")
end

it "sets :box_url to a bento box URL for a virtualbox provider" do
config[:provider] = "virtualbox"

expect(driver[:box_url]).to eq(
"https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/" \
"opscode_#{name}-99.04_chef-provisionerless.box"
)
end

it "sets :box_url to a bento box URL for a vmware-based provider" do
config[:provider] = "vmware_awesometown"

expect(driver[:box_url]).to eq(
"https://opscode-vm-bento.s3.amazonaws.com/vagrant/vmware/" \
"opscode_#{name}-99.04_chef-provisionerless.box"
)
end

it "sets :box_url to nil for any other provider" do
it "sets :box_url to nil" do
config[:provider] = "the-next-coolness"

expect(driver[:box_url]).to eq(nil)
Expand Down

0 comments on commit 9eb3e6c

Please sign in to comment.