Skip to content

Parsing status occasionally wrong #27

@xkortex

Description

@xkortex

I'm noticing under some conditions, dps (docker-pretty-ps) reports containers as running when they are exited. This appears to be an issue with revised_line_split[4] on line 227.

Here's my output when I add this line to _clean_status(val)

    print('STATUS: {} [{}]'.format(val, val.lower().strip()))
STATUS:  Exited (0) About an hour ago [exited (0) about an hour ago]
STATUS:  Exited (1) About an hour ago [exited (1) about an hour ago]
STATUS: Created [created]
STATUS: Exited (127) 4 days ago [exited (127) 4 days ago]
STATUS:  4 days ago [4 days ago]
STATUS:  4 days ago [4 days ago]
STATUS:  4 days ago [4 days ago]
STATUS:  4 days ago [4 days ago]
STATUS:  4 days ago [4 days ago]
STATUS:  4 days ago [4 days ago]
STATUS: Exited (1) 4 days ago [exited (1) 4 days ago]
STATUS: Exited (1) 4 days ago [exited (1) 4 days ago]
STATUS: Exited (1) 4 days ago [exited (1) 4 days ago]

...(truncated)...
Total containers:	33
Total running:		6

Those 6 running appear to be coming from the failure to split the output properly. Here's some sample output that causes the splitting to fail.

CONTAINER ID        IMAGE                                                                                    COMMAND                  CREATED             STATUS                         PORTS               NAMES

c17fa80d9493        79332bd117f0                                                                             "/bin/sh"                4 days ago          Created                                            pycharm_helpers_PY-183.5912.18
fdbf9b4b6df4        a9b6bbef0884                                                                             "/bin/sh -c 'curl ht…"   4 days ago          Exited (127) 4 days ago                            practical_keller
99f0f77fe65a        7dc5fcb2d5fd                                                                             "/bin/sh -c 'ln -s  …"   4 days ago          Exited (1) 4 days ago                              objective_wright
820a1a39c1b1        7dc5fcb2d5fd                                                                             "/bin/sh -c 'ln -s  …"   4 days ago          Exited (1) 4 days ago                              relaxed_chaum
b1edb9b13abb        7dc5fcb2d5fd                                                                             "/bin/sh -c 'ln -s  …"   4 days ago          Exited (1) 4 days ago                              serene_gagarin
b33e9c1a90ba        7dc5fcb2d5fd                                                                             "/bin/sh -c 'ln -s  …"   4 days ago          Exited (1) 4 days ago                              nostalgic_brown
caba00f3f0be        7dc5fcb2d5fd                                                                             "/bin/sh -c 'ln -s  …"   4 days ago          Exited (1) 4 days ago                              competent_ganguly
f875a1053e5c        74d93d2436c7                                                                             "/bin/sh -c 'ln -s  …"   4 days ago          Exited (1) 4 days ago                              awesome_mayer
50c2796bd7e1        1da54eb8ec63                                                                             "/bin/bash -c 'sourc…"   4 days ago          Exited (1) 4 days ago                              practical_sinoussi
f9120b6d9d74        5205d6f43877                                                                             "/bin/bash -c 'sourc…"   4 days ago          Exited (1) 4 days ago                              quizzical_golick
8bf6c7662fd8        b12e22934b40                                                                             "/bin/bash -c 'sourc…"   4 days ago          Exited (1) 4 days ago                              angry_einstein
7f230bb18ddf        e3ea4e8d8e34                                                                             "/bin/sh -c 'ln -s $…"   5 days ago          Exited (1) 5 days ago                              friendly_feistel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions