Skip to content
This repository was archived by the owner on Aug 3, 2020. It is now read-only.

Commit

Permalink
Dead containers can not be inspected
Browse files Browse the repository at this point in the history
ibuildthecloud committed Jun 15, 2016
1 parent 5e4297b commit cb38de6
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions cattle/plugins/docker/compute.py
Original file line number Diff line number Diff line change
@@ -822,28 +822,31 @@ def _get_instance_host_map_data(self, obj):
docker_ports = []
docker_ip = None

if existing is not None:
inspect = client.inspect_container(existing['Id'])
docker_mounts = self._get_mount_data(obj.host, existing['Id'])
docker_ip = inspect['NetworkSettings']['IPAddress']
if existing.get('Ports') is not None:
for port in existing['Ports']:
private_port = '{0}/{1}'.format(port['PrivatePort'],
port['Type'])
port_spec = private_port

bind_addr = ''
if 'IP' in port:
bind_addr = '%s:' % port['IP']

public_port = ''
if 'PublicPort' in port:
public_port = '%s:' % port['PublicPort']
elif 'IP' in port:
public_port = ':'

port_spec = bind_addr + public_port + port_spec
docker_ports.append(port_spec)
try:
if existing is not None:
inspect = client.inspect_container(existing['Id'])
docker_mounts = self._get_mount_data(obj.host, existing['Id'])
docker_ip = inspect['NetworkSettings']['IPAddress']
if existing.get('Ports') is not None:
for port in existing['Ports']:
private_port = '{0}/{1}'.format(port['PrivatePort'],
port['Type'])
port_spec = private_port

bind_addr = ''
if 'IP' in port:
bind_addr = '%s:' % port['IP']

public_port = ''
if 'PublicPort' in port:
public_port = '%s:' % port['PublicPort']
elif 'IP' in port:
public_port = ':'

port_spec = bind_addr + public_port + port_spec
docker_ports.append(port_spec)
except NotFound:
pass

update = {
'instance': {

0 comments on commit cb38de6

Please sign in to comment.