def stop_container(self, container_id=None): c = Container.objects.get(container_id=container_id) if c.protected: raise ProtectedContainerError( _('Unable to stop container. Container is protected.')) c = self._get_client() c.stop(container_id)
def stop_container(self, container_id=None): c_id = utils.get_short_id(container_id) c = Container.objects.get(container_id=c_id) if c.protected: raise ProtectedContainerError( _('Unable to stop container. Container is protected.')) c = self._get_client() c.stop(c_id) self._invalidate_container_cache()
def destroy_container(self, container_id=None): c = Container.objects.get(container_id=container_id) if c.protected: raise ProtectedContainerError( _('Unable to destroy container. Container is protected.')) c = self._get_client() try: c.kill(container_id) c.remove_container(container_id) except client.APIError: # ignore 404s from api if container not found pass # remove metadata Container.objects.filter(container_id=container_id).delete()