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

Use Bento's Atlas boxes by default if detected #195

Merged
merged 1 commit into from
Jan 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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