Project

General

Profile

Actions

Idea #9181

closed

[Docker Cleaner] Crashes on startup when the Docker daemon has no events

Added by Brett Smith almost 8 years ago. Updated almost 8 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
05/11/2016
Due date:
Story points:
-

Description

At least with Docker 1.7.1, if you ask for events in a series where there are none, it yields an empty string. Note this is not a bytes object, so when Docker cleaner tries to decode it, it crashes:

% sudo service docker restart
% py
Python 3.4.2 (default, Oct  8 2014, 10:45:20)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker, time
>>> t = int(time.time())
>>> dc = docker.Client(version='1.14')
>>> evs = dc.events(until=t - 1)
>>> next(evs)
''
>>> _.decode('utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'

Docker cleaner should probably check for the empty string and treat it as a non-event.


Subtasks 1 (0 open1 closed)

Task #9386: ReviewClosedBrett Smith05/11/2016Actions
Actions

Also available in: Atom PDF