mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
Merge pull request #13564 from eszense/rmi-patch
docker/provider: handle variation in error text during image removal
This commit is contained in:
commit
bc9f0b8c4c
2 changed files with 12 additions and 2 deletions
|
|
@ -225,8 +225,9 @@ module VagrantPlugins
|
|||
execute('docker', 'rmi', id)
|
||||
return true
|
||||
rescue => e
|
||||
return false if e.to_s.include?("is using it")
|
||||
return false if e.to_s.include?("is being used")
|
||||
return false if e.to_s.include?("is using it") or
|
||||
e.to_s.include?("is being used") or
|
||||
e.to_s.include?("is in use")
|
||||
raise if !e.to_s.include?("No such image")
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -579,6 +579,15 @@ describe VagrantPlugins::DockerProvider::Driver do
|
|||
subject.rmi(id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'image is in use by a container' do
|
||||
before { allow(subject).to receive(:execute).and_raise("image is in use by a container") }
|
||||
|
||||
it 'does not remove the image' do
|
||||
expect(subject.rmi(id)).to eq(false)
|
||||
subject.rmi(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#inspect_container' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue