trapexit / mergerfs-tools

Optional tools to help manage data in a mergerfs pool
ISC License
385 stars 44 forks source link

Remove set_defaults from parent ArgumentParser #34

Closed jacobwgillespie closed 7 years ago

jacobwgillespie commented 7 years ago

On older versions of Python3, defaults set on the parent ArgumentParser were not overridden by subparsers, leading to a scenario where func was always None and thus no commands in mergerfs.ctl were operational.

Here's a link to the Python bug report: https://bugs.python.org/issue9351. It's unclear to me what versions received the patch in that issue, and it's still open because apparently that patch broke other things. However, I am able to confirm that the bug exists in the default Python3 version in Debian 8, 3.4.2.

Removing the parent set_defaults line seems to fix all the issues with no downsides.

jacobwgillespie commented 7 years ago

Just removing the line caused an error when no arguments are present, so added a fix.