Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorized CLI output can upset the typechecker #32

Open
thorstenspille opened this issue Mar 13, 2021 · 2 comments
Open

Colorized CLI output can upset the typechecker #32

thorstenspille opened this issue Mar 13, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@thorstenspille
Copy link

thorstenspille commented Mar 13, 2021

This issue appears with the current version in master branch:

root@abgleich:~# abgleich snap /etc/abgleich/frequent.yaml
| Typ      |   Geschrieben | Name des Datensatzes   | Snapshot-Name       |
|----------|---------------|------------------------|---------------------|
| Snapshot |      96.0 KiB | ROOT                   | 2021031301_frequent |
| Snapshot |       8.2 GiB | ROOT/pve-1             | 2021031301_frequent |
| Snapshot |      96.0 KiB | data                   | 2021031301_frequent |
Möchten Sie fortfahren? [y/N]: y
Traceback (most recent call last):
  File "/usr/local/bin/abgleich", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/abgleich/cli/snap.py", line 67, in snap
    transactions.run()
  File "/usr/local/lib/python3.9/dist-packages/abgleich/core/transaction.py", line 286, in run
    f'{colorize(" | ".join([str(command) for command in transaction.commands]), "yellow"):s}'
  File "/usr/local/lib/python3.9/dist-packages/typeguard/__init__.py", line 916, in wrapper
    raise TypeError(*exc.args) from None
TypeError: type of the return value must be a tuple; got list instead

Tested with Python3.9 on Manjaro Linux and Debian 11 (bullseye/testing) against a Proxmox 6.3.6 system.
My config:

source:
    zpool: rpool
    prefix:
    host: px
    user: root
target:
    zpool: backup
    prefix: px/prod
    host: px
    user: root
include_root: no
keep_snapshots: 8
always_changed: no
written_threshold: 1048576
check_diff: yes
suffix: _frequent
digits: 3
ignore: []
ssh:
    compression: no
    cipher: [email protected]

Python module versions of my pipenv:

$ pipenv run pip list
Package    Version
---------- -------
abgleich   0.0.7
click      7.1.2
pip        21.0.1
PyYAML     5.4.1
setuptools 53.0.0
tabulate   0.8.9
typeguard  2.11.1
wheel      0.36.2
@thorstenspille
Copy link
Author

Just tested with develop branch, seems to be fixed there, could not reproduce this issue.

@s-m-e s-m-e added the bug Something isn't working label Mar 14, 2021
@s-m-e s-m-e changed the title 'abgleich snap' throws TypeError exception Colorized CLI output can upset the typechecker Mar 14, 2021
@s-m-e
Copy link
Member

s-m-e commented Mar 14, 2021

@thorstenspille Yes, this is fixed in develop.

Workaround for 0.0.7: Turning off type checks also eliminates this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants