Actions
Bug #55716
closedcephfs-shell: Cmd2ArgparseError is imported without version check
% Done:
0%
Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
qa-suite
Labels (FS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):
Description
cmd2.exceptions.Cmd2ArgparseError
is imported without version check. It's available only after 1.0.0
. Developer's machines usually have latest version while teuthology machines tend to have older versions of cmd2.
The issue was discovered by running fs:shell
suite.
Link to the teuthology job - http://qa-proxy.ceph.com/teuthology/rishabh-2022-05-19_12:35:33-fs-wip-rishabh-shell-rm-distro-basic-smithi/6841347.
Error on the teuthology job -
2022-05-19T12:54:37.350 DEBUG:teuthology.orchestra.run.smithi017:> cephfs-shell -b /tmp/test-cephfs85wnyhvy 2022-05-19T12:54:37.644 INFO:teuthology.orchestra.run.smithi017.stderr:Traceback (most recent call last): 2022-05-19T12:54:37.644 INFO:teuthology.orchestra.run.smithi017.stderr: File "/usr/bin/cephfs-shell", line 21, in <module> 2022-05-19T12:54:37.644 INFO:teuthology.orchestra.run.smithi017.stderr: from cmd2.exceptions import Cmd2ArgparseError 2022-05-19T12:54:37.645 INFO:teuthology.orchestra.run.smithi017.stderr:ModuleNotFoundError: No module named 'cmd2.exceptions'; 'cmd2' is not a package
Confirming cmd2 version on the testing machine -
2022-05-19T12:20:24.666 INFO:teuthology.orchestra.run.smithi123.stdout:Setting up python3-cmd2 (0.8.5-2.1) ...
Following grep query was run cmd2 repo root -
$ git checkout 1.0.1 Previous HEAD position was a7511e16 Added 1.1 release date to CHANGELOG HEAD is now at 36864f4d Updating change log for release $ grep -rnI Cmd2ArgparseError ./ ./tests/test_plugin.py:852: Verify Cmd2ArgparseErrors raised after calling a command prevent postcmd events from ./cmd2/cmd2.py:53:from .exceptions import Cmd2ArgparseError, Cmd2ShlexError, EmbeddedConsoleExit, EmptyStatement ./cmd2/cmd2.py:1685: except (Cmd2ArgparseError, EmptyStatement): ./cmd2/exceptions.py:5:class Cmd2ArgparseError(Exception): ./cmd2/decorators.py:7:from .exceptions import Cmd2ArgparseError ./cmd2/decorators.py:148: raise Cmd2ArgparseError ./cmd2/decorators.py:220: raise Cmd2ArgparseError $ git checkout 1.0.0 Previous HEAD position was 36864f4d Updating change log for release HEAD is now at 59739aa5 Added info to changelog in preparation for 1.0.0 release $ grep -rnI Cmd2ArgparseError ./
SystemExit(2) is raised in earlier versions.
$ pip install cmd2===0.8.5 && cephfs-shell -- get dump5 DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621 Defaulting to user installation because normal site-packages is not writeable Collecting cmd2===0.8.5 Using cached cmd2-0.8.5-py2.py3-none-any.whl (51 kB) Requirement already satisfied: pyperclip in /home/rishabh/.local/lib/python3.9/site-packages (from cmd2===0.8.5) (1.8.2) Requirement already satisfied: pyparsing>=2.0.1 in /usr/lib/python3.9/site-packages (from cmd2===0.8.5) (2.4.7) Requirement already satisfied: wcwidth in /usr/lib/python3.9/site-packages (from cmd2===0.8.5) (0.2.5) Requirement already satisfied: six in /usr/lib/python3.9/site-packages (from cmd2===0.8.5) (1.15.0) Installing collected packages: cmd2 Attempting uninstall: cmd2 Found existing installation: cmd2 1.5.0 Uninstalling cmd2-1.5.0: Successfully uninstalled cmd2-1.5.0 Successfully installed cmd2-0.8.5 WARNING: You are using pip version 22.0.4; however, version 22.1 is available. You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command. usage: get [-h] [-f] remote_path local_path get: error: the following arguments are required: local_path $ echo $? 2 $ $ $ cephfs-shell -- get dump5 > /home/abcd/ceph/src/tools/cephfs/cephfs-shell(470)onecmd() -> res = Cmd.onecmd(self, line, **kwargs) (Pdb) n usage: get [-h] [-f] remote_path local_path get: error: the following arguments are required: local_path SystemExit: 2 > /home/abcd/ceph/src/tools/cephfs/cephfs-shell(470)onecmd() -> res = Cmd.onecmd(self, line, **kwargs) (Pdb)
Check should've been added here - https://github.com/ceph/ceph/pull/46110/files#diff-35294eb9e54c75ffc1459f1c03a06dfbc7e921aebeb48a41418b5f60f21953d8R21
Actions