Remove container inspection caching and Exception rescue

Container inspection is caching data on first lookup. This will
result in incorrect data being returned on subsequent lookups if
a different `cid` value is provided. Also removed rescue of
the `Exception` class as this generally should never happen; rescue
of StandardError will be enough.
This commit is contained in:
Chris Roberts 2019-03-15 09:23:27 -07:00
parent c251e090b3
commit 1224622387
1 changed files with 2 additions and 4 deletions

View File

@ -152,15 +152,13 @@ module VagrantPlugins
def rmi(id)
execute('docker', 'rmi', id)
return true
rescue Exception => e
rescue => e
return false if e.to_s.include?("is using it")
raise if !e.to_s.include?("No such image")
end
def inspect_container(cid)
# DISCUSS: Is there a chance that this json will change after the container
# has been brought up?
@data ||= JSON.parse(execute('docker', 'inspect', cid)).first
JSON.parse(execute('docker', 'inspect', cid)).first
end
def all_containers