funkyfuture / deck-chores

A job scheduler for Docker containers, configured via labels.
https://deck-chores.readthedocs.io/
ISC License
197 stars 27 forks source link

AttributeError: 'JobConfigValidator' object has no attribute 'rules' #69

Closed Rillke closed 3 years ago

Rillke commented 3 years ago

When starting the container, it's immediately crashing:

$ docker logs officer
Attaching to iliasdocker_officer_1
Traceback (most recent call last):
  File "/usr/local/bin/deck-chores", line 5, in <module>
    from deck_chores.main import main
  File "/usr/local/lib/python3.9/site-packages/deck_chores/main.py", line 23, in <module>
    from deck_chores.parsers import job_config_validator, parse_labels
  File "/usr/local/lib/python3.9/site-packages/deck_chores/parsers.py", line 96, in <module>
    job_config_validator = JobConfigValidator(
  File "/usr/local/lib/python3.9/site-packages/cerberus/validator.py", line 193, in __init__
    self.schema = kwargs.get('schema', None)
  File "/usr/local/lib/python3.9/site-packages/cerberus/validator.py", line 604, in schema
    self._schema = DefinitionSchema(self, schema)
  File "/usr/local/lib/python3.9/site-packages/cerberus/schema.py", line 72, in __init__
    self.validation_schema = SchemaValidationSchema(validator)
  File "/usr/local/lib/python3.9/site-packages/cerberus/schema.py", line 307, in __init__
    'schema': validator.rules,
AttributeError: 'JobConfigValidator' object has no attribute 'rules'

The affected image is:

$ docker images
REPOSITORY                                                      TAG                   IMAGE ID            CREATED             SIZE
funkyfuture/deck-chores                                         1.1                   c731009cab3a        17 hours ago        349MB
$ docker image inspect c731009cab3a
[
    {
        "Id": "sha256:c731009cab3a7fb5f12220a1919c3ede94e422488850f1da1e047ae28c76611c",
        "RepoTags": [
            "funkyfuture/deck-chores:1.1"
        ],
        "RepoDigests": [
            "funkyfuture/deck-chores@sha256:bb48080b2a03dfb9d18ffa4590931a0074184791efd94546546c00c939b5a93d"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2021-05-04T17:58:13.593487812Z",
        "Container": "f22357bbe3cfd8f5092795ac13581e0a0796c40905a1c8c95276c7d51dac6c11",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
                "PYTHON_VERSION=3.9.4",
                "PYTHON_PIP_VERSION=21.1.1",
                "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/1954f15b3f102ace496a34a013ea76b061535bd2/public/get-pip.py",
                "PYTHON_GET_PIP_SHA256=f499d76e0149a673fb8246d88e116db589afbd291739bd84f2cd9a7bca7b6993",
                "PYTHONOPTIMIZE=1"
            ],
            "Cmd": [
                "|3",
                "BUILD_DATE=2021-05-04 17:47:48+00:00",
                "SOURCE_COMMIT=bc02428766f09da2c84e0755da666ee056e7fa96",
                "VERSION=1.1.9",
                "/bin/sh",
                "-c",
                "apk upgrade --no-cache  && apk add --no-cache --virtual .build-deps build-base cargo ca-certificates libffi-dev musl-dev openssl-dev python3-dev  && apk add --no-cache tzdata  && echo \"UTC\" > /etc/timezone  && cd /src  && pip install --no-cache-dir /src  && rm -rf /root/.cache  && apk del .build-deps"
            ],
            "Image": "sha256:d27de56510603fdb54a2eef6ffce6d6a976763fef89c90c77ef0a58929066021",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "org.opencontainers.image.created": "2021-05-04 17:47:48+00:00",
                "org.opencontainers.image.description": "Job scheduler for Docker containers, configured via labels.",
                "org.opencontainers.image.documentation": "https://deck-chores.readthedocs.org/",
                "org.opencontainers.image.revision": "bc02428766f09da2c84e0755da666ee056e7fa96",
                "org.opencontainers.image.source": "https://github.com/funkyfuture/deck-chores",
                "org.opencontainers.image.title": "deck-chores",
                "org.opencontainers.image.version": "1.1.9"
            }
        },
        "DockerVersion": "19.03.8",
        "Author": "Frank Sachsenheim <funkyfuture@riseup.net>",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "LANG=C.UTF-8",
                "GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568",
                "PYTHON_VERSION=3.9.4",
                "PYTHON_PIP_VERSION=21.1.1",
                "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/1954f15b3f102ace496a34a013ea76b061535bd2/public/get-pip.py",
                "PYTHON_GET_PIP_SHA256=f499d76e0149a673fb8246d88e116db589afbd291739bd84f2cd9a7bca7b6993",
                "PYTHONOPTIMIZE=1"
            ],
            "Cmd": [
                "deck-chores"
            ],
            "Image": "sha256:d27de56510603fdb54a2eef6ffce6d6a976763fef89c90c77ef0a58929066021",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {
                "org.opencontainers.image.created": "2021-05-04 17:47:48+00:00",
                "org.opencontainers.image.description": "Job scheduler for Docker containers, configured via labels.",
                "org.opencontainers.image.documentation": "https://deck-chores.readthedocs.org/",
                "org.opencontainers.image.revision": "bc02428766f09da2c84e0755da666ee056e7fa96",
                "org.opencontainers.image.source": "https://github.com/funkyfuture/deck-chores",
                "org.opencontainers.image.title": "deck-chores",
                "org.opencontainers.image.version": "1.1.9"
            }
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 348510329,
        "VirtualSize": 348510329,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/db3c11afc18dd069612ea67e2d001cc17061e6a31f79521c99be334ccf5a93e1/diff:/var/lib/docker/overlay2/ba6e9ba425df6b515841e4add761c0abd893b5ab359b8349b7cb66e7f295bd46/diff:/var/lib/docker/overlay2/902897c9ac7a0fec36e73bfbb7788dd49b1b635c1f4d9242088133320cf6fab7/diff:/var/lib/docker/overlay2/b2c898c0c2d70964638478f04ed02450f43cd9173e562148fd5b36f43143f915/diff:/var/lib/docker/overlay2/833433921b014d2c7c2a9ed49638f6b4491209252d621123d545db0fb1017f09/diff:/var/lib/docker/overlay2/b23b249718c780ed531e18a70923f42372d0c39a7c764b12f16413a5dfb6fa39/diff",
                "MergedDir": "/var/lib/docker/overlay2/cc80bc25c7a22b6ea34cd1814edc25d5e4a1b8567029a1e878e89fa53cec31bf/merged",
                "UpperDir": "/var/lib/docker/overlay2/cc80bc25c7a22b6ea34cd1814edc25d5e4a1b8567029a1e878e89fa53cec31bf/diff",
                "WorkDir": "/var/lib/docker/overlay2/cc80bc25c7a22b6ea34cd1814edc25d5e4a1b8567029a1e878e89fa53cec31bf/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:b2d5eeeaba3a22b9b8aa97261957974a6bd65274ebd43e1d81d0a7b8b752b116",
                "sha256:ff362123de14f499ce9b7bb1907ff5955b1938f615a28e197b1481421c5c73e7",
                "sha256:d90070ff2c3ab48d4e20eea260548adfae9f3068330f9cc3a853bdc58c77455f",
                "sha256:b1ed2c7094f4f469685494a40727ce1a82da1f629f1f5d84530516c087f1ea80",
                "sha256:9238e5c915fa41ca71c86b8331356096e62ebb1c1c557b161999902b2d366e87",
                "sha256:97d548b7d8cb0d55ca40b496829bf03239efddcb20acd3c23e8beac139189aa5",
                "sha256:92112dff3cee040ed4b92f71a1e6ddcfbdf063e80c706730d375bb552d8e7671"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

Minimal Docker-Compose file:

version: "2"
services:

  officer:
    image: funkyfuture/deck-chores:1.1
    restart: always
    environment:
      - TIMEZONE
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
user@staging:~$ docker-compose up -d
Creating network "user_default" with the default driver
Pulling officer (funkyfuture/deck-chores:1.1)...
1.1: Pulling from funkyfuture/deck-chores
540db60ca938: Already exists
d037ddac5dde: Pull complete
05d0edf52df4: Pull complete
54d94e388fb8: Pull complete
0d1523f4f3ad: Pull complete
994fd1bfbb47: Pull complete
062d5168acac: Pull complete
Digest: sha256:bb48080b2a03dfb9d18ffa4590931a0074184791efd94546546c00c939b5a93d
Status: Downloaded newer image for funkyfuture/deck-chores:1.1
Creating user_officer_1 ... done

user@staging:~$ docker-compose ps
     Name           Command       State      Ports
--------------------------------------------------
user_officer_1   deck-chores   Restarting        

user@staging:~$ docker-compose logs
Attaching to user_officer_1
officer_1  | Traceback (most recent call last):
officer_1  |   File "/usr/local/bin/deck-chores", line 5, in <module>
officer_1  |     from deck_chores.main import main
officer_1  |   File "/usr/local/lib/python3.9/site-packages/deck_chores/main.py", line 23, in <module>
officer_1  |     from deck_chores.parsers import job_config_validator, parse_labels
officer_1  |   File "/usr/local/lib/python3.9/site-packages/deck_chores/parsers.py", line 96, in <module>
officer_1  |     job_config_validator = JobConfigValidator(
officer_1  |   File "/usr/local/lib/python3.9/site-packages/cerberus/validator.py", line 193, in __init__
officer_1  |     self.schema = kwargs.get('schema', None)
officer_1  |   File "/usr/local/lib/python3.9/site-packages/cerberus/validator.py", line 604, in schema
officer_1  |     self._schema = DefinitionSchema(self, schema)
officer_1  |   File "/usr/local/lib/python3.9/site-packages/cerberus/schema.py", line 72, in __init__
officer_1  |     self.validation_schema = SchemaValidationSchema(validator)
officer_1  |   File "/usr/local/lib/python3.9/site-packages/cerberus/schema.py", line 307, in __init__
officer_1  |     'schema': validator.rules,
officer_1  | AttributeError: 'JobConfigValidator' object has no attribute 'rules'

Expected: No crash and container running.

JRedOW commented 3 years ago

This just started happening to me too, with the most recent update.

Edit: After doing some digging, the problem is coming from cerberus, a dependency that was updated to ver 1.3.3 with the most recent update.

funkyfuture commented 3 years ago

thanks for reporting! i could actually have anticipated that and will provide contextual information and a fixing update in the course of my evening in Europe.

funkyfuture commented 3 years ago

i released version 1.1.11 that reverts the underlying change. a fix release for Cerberus where i had introduced the cause is on its way and will be included in the next maintenance release.