anybox / buttervolume

BTRFS Volume plugin for Docker
Apache License 2.0
81 stars 11 forks source link

exception during an exception #18

Open ccomb opened 6 years ago

ccomb commented 6 years ago

Found an error in the display of an exception. To reproduce it : start buttervolume with a wrong mount of /var/lib/buttervolume so that it is not a BTRFS filesystem or subvolume. Then try to create a volume with docker volume create -d btrfs truuc :

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/buttervolume-2.0.0-py3.5.egg/buttervolume/plugin.py", line 64, in volume_create
    btrfs.Subvolume(volpath).create()
  File "/usr/local/lib/python3.5/dist-packages/buttervolume-2.0.0-py3.5.egg/buttervolume/btrfs.py", line 40, in create
    out = run('btrfs subvolume create "{}"'.format(self.path))
  File "/usr/local/lib/python3.5/dist-packages/buttervolume-2.0.0-py3.5.egg/buttervolume/btrfs.py", line 7, in run
    stderr=stderr).stdout.decode()
  File "/usr/lib/python3.5/subprocess.py", line 398, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'btrfs subvolume create "/var/lib/buttervolume/volumes/truuc"' returned non-zero exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/bottle-0.12.13-py3.5.egg/EGG-INFO/scripts/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/lib/python3.5/dist-packages/bottle-0.12.13-py3.5.egg/EGG-INFO/scripts/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/usr/local/lib/python3.5/dist-packages/buttervolume-2.0.0-py3.5.egg/buttervolume/plugin.py", line 66, in volume_create
    return json.dumps({'Err': e.stderr})
  File "/usr/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.5/json/encoder.py", line 198, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.5/json/encoder.py", line 256, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.5/json/encoder.py", line 179, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: b'ERROR: not a btrfs filesystem: /var/lib/buttervolume/volumes\n' is not JSON serializable