Skip to content

Commit

Permalink
Merge "Docker default command fix"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Dec 11, 2014
2 parents f257baa + b42dd5b commit ea057e0
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,19 @@ def _stop(self, vm_name, vmi_left_id, vmi_right_id, vmi_management_id):

netns_mgr = NetnsManager(str(docker_pid), nic_left, nic_right,
nic_management)
self._client.stop(vm_name)

try:
#It is possible that namespace does not exists
netns_mgr.unplug_namespace_interface()
netns_mgr.destroy()
except ValueError:
pass

self._client.stop(vm_name)

netns_path = "/var/run/netns/%s" % docker_pid
if os.path.exists(netns_path):
os.remove(netns_path)

def create(self):
vm_name = validate_uuid(self.args.vm_id)
image_name = self.args.image
Expand All @@ -177,19 +181,20 @@ def create(self):
instance_data = {}

try:
image = self._client.inspect_image(image_name)
self._client.inspect_image(image_name)
except APIError as e:
if e.response.status_code == 404:
self._client.pull(image_name)
image = self._client.inspect_image(image_name)
self._client.inspect_image(image_name)
else:
raise
if self.args.command is not None:
command = self.args.command
elif "command" in instance_data:
command = instance_data["command"]
else:
command = image["ContainerConfig"]["Cmd"]
# use container default
command = None
docker_id = None
try:
result = self._client.create_container(
Expand Down

0 comments on commit ea057e0

Please sign in to comment.