mirror of
https://github.com/ceph/ceph
synced 2025-03-25 11:48:05 +00:00
Merge pull request #55808 from neesingh-rh/wip-63700
cephfs-shell: fixing cephfs-shell test failures Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
commit
20af41d716
@ -15,14 +15,22 @@ import re
|
||||
import shlex
|
||||
import stat
|
||||
import errno
|
||||
import distro
|
||||
|
||||
from cmd2 import Cmd
|
||||
from cmd2 import __version__ as cmd2_version
|
||||
from packaging.version import Version
|
||||
|
||||
# DFLAG is used to override the checks done by cephfs-shell
|
||||
# for cmd2 versions due to weird behaviour of Ubuntu22.04 with
|
||||
# cmd2's version i.e. it always gets the version of cmd2 as
|
||||
# "0.0.0" instead of the actual cmd2 version.
|
||||
DFLAG = False
|
||||
if distro.name() == "Ubuntu" and distro.version() == "22.04":
|
||||
DFLAG = True
|
||||
# XXX: In cmd2 versions < 1.0.1, we'll get SystemExit(2) instead of
|
||||
# Cmd2ArgparseError
|
||||
if Version(cmd2_version) >= Version("1.0.1"):
|
||||
if Version(cmd2_version) >= Version("1.0.1") or DFLAG is True:
|
||||
from cmd2.exceptions import Cmd2ArgparseError
|
||||
else:
|
||||
# HACK: so that we don't have check for version everywhere
|
||||
@ -1700,7 +1708,7 @@ def read_shell_conf(shell, shell_conf_file):
|
||||
|
||||
sec = 'cephfs-shell'
|
||||
opts = []
|
||||
if Version(cmd2_version) >= Version("0.10.0"):
|
||||
if Version(cmd2_version) >= Version("0.10.0") or DFLAG is True:
|
||||
for attr in shell.settables.keys():
|
||||
opts.append(attr)
|
||||
else:
|
||||
@ -1768,7 +1776,7 @@ def manage_args():
|
||||
args.exe_and_quit = False # Execute and quit, don't launch the shell.
|
||||
|
||||
if args.batch:
|
||||
if Version(cmd2_version) <= Version("0.9.13"):
|
||||
if Version(cmd2_version) <= Version("0.9.13") and DFLAG is not True:
|
||||
args.commands = ['load ' + args.batch, ',quit']
|
||||
else:
|
||||
args.commands = ['run_script ' + args.batch, ',quit']
|
||||
@ -1813,7 +1821,7 @@ def execute_cmds_and_quit(args):
|
||||
# value to indicate whether the execution of the commands should stop, but
|
||||
# since 0.9.7 it returns the return value of do_* methods only if it's
|
||||
# not None. When it is None it returns False instead of None.
|
||||
if Version(cmd2_version) <= Version("0.9.6"):
|
||||
if Version(cmd2_version) <= Version("0.9.6") and DFLAG is not True:
|
||||
stop_exec_val = None
|
||||
else:
|
||||
stop_exec_val = False
|
||||
|
Loading…
Reference in New Issue
Block a user