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

Be more aggressive about removing "bento-*" vagrant boxes #476

Merged
merged 2 commits into from
Oct 13, 2015
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ packer.log
/packer-*/
*.variables.json
/builds/
.kitchen
19 changes: 16 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ require 'json'
require 'net/http'
require 'kitchen'
require 'aws-sdk'
require 'mixlib/shellout'

# TODO: private boxes may need to specify a mirror

Expand Down Expand Up @@ -222,11 +223,23 @@ def compute_metadata_files
`ls builds/*.json`.split("\n")
end

def destroy_all_bento
cmd = Mixlib::ShellOut.new("vagrant box list | grep 'bento-'")
cmd.run_command
boxes = cmd.stdout.split("\n")

boxes.each do | box |
b = box.split(" ")
rm_cmd = Mixlib::ShellOut.new("vagrant box remove --force #{b[0]} --provider #{b[1].to_s.gsub(/(,|\()/, '')}")
puts "Removing #{b[0]} for provider #{b[1].to_s.gsub(/(,|\()/, '')}"
rm_cmd.run_command
end
end

def test_box(boxname, providers)
providers.each do |provider, provider_data|

puts "Removing box: #{boxname} provider: #{provider}"
`vagrant box remove #{boxname} --provider #{provider}`
destroy_all_bento

provider = 'vmware_fusion' if provider == 'vmware_desktop'

Expand All @@ -240,7 +253,7 @@ def test_box(boxname, providers)
{"name"=>"vagrant",
"synced_folders"=>[[".", "/vagrant", "disabled: #{share_disabled}"]],
"provider"=>provider,
"box"=>boxname,
"box"=>"bento-#{boxname}",
"box_url"=>"file://#{ENV['PWD']}/builds/#{provider_data['file']}"}}],
"suites"=>[{"name"=>"default", "run_list"=>nil, "attributes"=>{}}]}

Expand Down