From: Samuel Just Date: Mon, 24 Nov 2025 17:29:55 +0000 (-0800) Subject: pybind/mgr: mechanically fix simple users to not import CLI*Command X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=29b90b36db67c6eadf4a5ecbc20beee225df6755;p=ceph.git pybind/mgr: mechanically fix simple users to not import CLI*Command The next commit will introduce module specific CLICommand classes. Signed-off-by: Samuel Just (cherry picked from commit 9099c682c2596612df7ab698e5ac3cfa578eb6d3) --- diff --git a/src/pybind/mgr/alerts/module.py b/src/pybind/mgr/alerts/module.py index 2374434aea7d..5bd627471ea5 100644 --- a/src/pybind/mgr/alerts/module.py +++ b/src/pybind/mgr/alerts/module.py @@ -3,7 +3,7 @@ A simple cluster health alerting module. """ -from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule, Option +from mgr_module import HandleCommandResult, MgrModule, Option from email.utils import formatdate, make_msgid from threading import Event from typing import Any, Optional, Dict, List, TYPE_CHECKING, Union diff --git a/src/pybind/mgr/balancer/module.py b/src/pybind/mgr/balancer/module.py index 476304275c1c..7b19c3d048eb 100644 --- a/src/pybind/mgr/balancer/module.py +++ b/src/pybind/mgr/balancer/module.py @@ -9,7 +9,7 @@ import json import math import random import time -from mgr_module import CLIReadCommand, CLICommand, CommandResult, MgrModule, Option, OSDMap, CephReleases +from mgr_module import CommandResult, MgrModule, Option, OSDMap, CephReleases from threading import Event from typing import cast, Any, Dict, List, Optional, Sequence, Tuple, Union from mgr_module import CRUSHMap diff --git a/src/pybind/mgr/crash/module.py b/src/pybind/mgr/crash/module.py index e9f78c815140..ed1cb63cdb46 100644 --- a/src/pybind/mgr/crash/module.py +++ b/src/pybind/mgr/crash/module.py @@ -1,5 +1,5 @@ import hashlib -from mgr_module import CLICommand, CLIReadCommand, CLIWriteCommand, MgrModule, Option +from mgr_module import MgrModule, Option import datetime import errno import functools diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index e90db88fd169..0a72e720d096 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -4,7 +4,7 @@ Device health monitoring import errno import json -from mgr_module import MgrModule, CommandResult, MgrModuleRecoverDB, CLIRequiresDB, CLICommand, CLIReadCommand, Option, MgrDBNotReady +from mgr_module import MgrModule, CommandResult, MgrModuleRecoverDB, CLIRequiresDB, Option, MgrDBNotReady import operator import rados import re diff --git a/src/pybind/mgr/feedback/module.py b/src/pybind/mgr/feedback/module.py index 95683912c090..59bd7a756740 100644 --- a/src/pybind/mgr/feedback/module.py +++ b/src/pybind/mgr/feedback/module.py @@ -7,7 +7,7 @@ See doc/mgr/feedback.rst for more info. from requests.exceptions import RequestException -from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule +from mgr_module import HandleCommandResult, MgrModule import errno from .service import CephTrackerClient diff --git a/src/pybind/mgr/hello/module.py b/src/pybind/mgr/hello/module.py index d4b50f401fcd..e7a7fc710b6c 100644 --- a/src/pybind/mgr/hello/module.py +++ b/src/pybind/mgr/hello/module.py @@ -5,7 +5,7 @@ A hello world module See doc/mgr/hello.rst for more info. """ -from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule, Option +from mgr_module import HandleCommandResult, MgrModule, Option from threading import Event from typing import cast, Any, Optional, TYPE_CHECKING import errno diff --git a/src/pybind/mgr/influx/module.py b/src/pybind/mgr/influx/module.py index 2d8c5c174b01..9735b71c6588 100644 --- a/src/pybind/mgr/influx/module.py +++ b/src/pybind/mgr/influx/module.py @@ -8,7 +8,7 @@ import errno import time from typing import cast, Any, Dict, Iterator, List, Optional, Tuple, Union -from mgr_module import CLICommand, CLIReadCommand, CLIWriteCommand, MgrModule, Option, OptionValue +from mgr_module import MgrModule, Option, OptionValue try: from influxdb import InfluxDBClient diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py index 4f1ad4ad6ca0..1e82f3dc0ad8 100644 --- a/src/pybind/mgr/insights/module.py +++ b/src/pybind/mgr/insights/module.py @@ -3,7 +3,7 @@ import json import re import threading -from mgr_module import CLICommand, CLIReadCommand, HandleCommandResult +from mgr_module import HandleCommandResult from mgr_module import MgrModule, CommandResult, NotifyType from . import health as health_util diff --git a/src/pybind/mgr/iostat/module.py b/src/pybind/mgr/iostat/module.py index b101094abc0c..4ef8dbbb0446 100644 --- a/src/pybind/mgr/iostat/module.py +++ b/src/pybind/mgr/iostat/module.py @@ -1,6 +1,6 @@ from typing import Any -from mgr_module import CLIReadCommand, HandleCommandResult, MgrModule +from mgr_module import HandleCommandResult, MgrModule class Module(MgrModule): diff --git a/src/pybind/mgr/mirroring/module.py b/src/pybind/mgr/mirroring/module.py index 67f0942147e8..d65e29e30a4c 100644 --- a/src/pybind/mgr/mirroring/module.py +++ b/src/pybind/mgr/mirroring/module.py @@ -1,6 +1,6 @@ from typing import List, Optional -from mgr_module import MgrModule, CLIReadCommand, CLIWriteCommand, Option, NotifyType +from mgr_module import MgrModule, Option, NotifyType from .fs.snapshot_mirror import FSSnapshotMirror diff --git a/src/pybind/mgr/nfs/module.py b/src/pybind/mgr/nfs/module.py index 00fe8b0e60e2..2d587c617a7d 100644 --- a/src/pybind/mgr/nfs/module.py +++ b/src/pybind/mgr/nfs/module.py @@ -2,7 +2,7 @@ import logging import threading from typing import Tuple, Optional, List, Dict, Any -from mgr_module import MgrModule, CLICommand, Option, CLICheckNonemptyFileInput +from mgr_module import MgrModule, Option, CLICheckNonemptyFileInput import object_format import orchestrator from orchestrator.module import IngressType diff --git a/src/pybind/mgr/pg_autoscaler/module.py b/src/pybind/mgr/pg_autoscaler/module.py index 575de1484fe7..8f8c16b2f8c2 100644 --- a/src/pybind/mgr/pg_autoscaler/module.py +++ b/src/pybind/mgr/pg_autoscaler/module.py @@ -8,7 +8,7 @@ import threading from typing import Any, Dict, List, Optional, Set, Tuple, TYPE_CHECKING, Union import uuid from prettytable import PrettyTable -from mgr_module import HealthChecksT, CLIReadCommand, CLIWriteCommand, CRUSHMap, MgrModule, Option, OSDMap +from mgr_module import HealthChecksT, CRUSHMap, MgrModule, Option, OSDMap """ Some terminology is made up for the purposes of this module: diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 6a871f0599e4..f036cd24f5b3 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -11,7 +11,9 @@ from collections import namedtuple from collections import OrderedDict from tempfile import NamedTemporaryFile -from mgr_module import CLIReadCommand, MgrModule, MgrStandbyModule, PG_STATES, Option, ServiceInfoT, HandleCommandResult, CLIWriteCommand +from .cli import PrometheusCLICommand + +from mgr_module import MgrModule, MgrStandbyModule, PG_STATES, Option, ServiceInfoT, HandleCommandResult from mgr_util import get_default_addr, profile_method, build_url from orchestrator import OrchestratorClientMixin, raise_if_exception, OrchestratorError from rbd import RBD diff --git a/src/pybind/mgr/rbd_support/module.py b/src/pybind/mgr/rbd_support/module.py index 369face038ad..6934905d8134 100644 --- a/src/pybind/mgr/rbd_support/module.py +++ b/src/pybind/mgr/rbd_support/module.py @@ -11,7 +11,7 @@ import rbd import traceback from typing import cast, Any, Callable, Optional, Tuple, TypeVar -from mgr_module import CLIReadCommand, CLIWriteCommand, MgrModule, Option +from mgr_module import MgrModule, Option from threading import Thread, Event from .common import NotAuthorizedError diff --git a/src/pybind/mgr/rgw/module.py b/src/pybind/mgr/rgw/module.py index 284d88ef1751..14b63c821d5b 100644 --- a/src/pybind/mgr/rgw/module.py +++ b/src/pybind/mgr/rgw/module.py @@ -8,7 +8,6 @@ import sys from mgr_module import ( MgrModule, - CLICommand, HandleCommandResult, Option, MonCommandFailed, diff --git a/src/pybind/mgr/selftest/module.py b/src/pybind/mgr/selftest/module.py index 2115c1da35e9..a4e8f65476f3 100644 --- a/src/pybind/mgr/selftest/module.py +++ b/src/pybind/mgr/selftest/module.py @@ -1,5 +1,5 @@ -from mgr_module import MgrModule, CommandResult, HandleCommandResult, CLICommand, Option +from mgr_module import MgrModule, CommandResult, HandleCommandResult, Option import enum import json import random diff --git a/src/pybind/mgr/snap_schedule/module.py b/src/pybind/mgr/snap_schedule/module.py index adf982448b1c..7749af7b79b9 100644 --- a/src/pybind/mgr/snap_schedule/module.py +++ b/src/pybind/mgr/snap_schedule/module.py @@ -8,7 +8,7 @@ import json import sqlite3 from typing import Any, Dict, Optional, Tuple, Union from .fs.schedule_client import SnapSchedClient -from mgr_module import MgrModule, CLIReadCommand, CLIWriteCommand, Option, NotifyType +from mgr_module import MgrModule, Option, NotifyType from mgr_util import CephfsConnectionException from threading import Event diff --git a/src/pybind/mgr/status/module.py b/src/pybind/mgr/status/module.py index d0026fd1ae29..02cc5db4b0c5 100644 --- a/src/pybind/mgr/status/module.py +++ b/src/pybind/mgr/status/module.py @@ -11,7 +11,7 @@ import fnmatch import mgr_util import json -from mgr_module import CLIReadCommand, MgrModule, HandleCommandResult +from mgr_module import MgrModule, HandleCommandResult class Module(MgrModule): diff --git a/src/pybind/mgr/telegraf/module.py b/src/pybind/mgr/telegraf/module.py index 541ddba4f073..6467f8f81181 100644 --- a/src/pybind/mgr/telegraf/module.py +++ b/src/pybind/mgr/telegraf/module.py @@ -7,7 +7,7 @@ from threading import Event from telegraf.basesocket import BaseSocket from telegraf.protocol import Line -from mgr_module import CLICommand, CLIReadCommand, MgrModule, Option, OptionValue, PG_STATES +from mgr_module import MgrModule, Option, OptionValue, PG_STATES from typing import cast, Any, Dict, Iterable, Optional, Tuple from urllib.parse import urlparse diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 2885450fb857..148681ca0222 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -20,7 +20,7 @@ from threading import Event, Lock from collections import defaultdict from typing import cast, Any, DefaultDict, Dict, List, Optional, Tuple, TypeVar, TYPE_CHECKING, Union -from mgr_module import CLICommand, CLIReadCommand, MgrModule, Option, OptionValue, ServiceInfoT +from mgr_module import MgrModule, Option, OptionValue, ServiceInfoT ALL_CHANNELS = ['basic', 'ident', 'crash', 'device', 'perf'] diff --git a/src/pybind/mgr/test_orchestrator/module.py b/src/pybind/mgr/test_orchestrator/module.py index 7e63eda86f7e..701a6b9f90cf 100644 --- a/src/pybind/mgr/test_orchestrator/module.py +++ b/src/pybind/mgr/test_orchestrator/module.py @@ -16,7 +16,7 @@ except ImportError: from ceph.deployment import inventory from ceph.deployment.drive_group import DriveGroupSpec -from mgr_module import CLICommand, HandleCommandResult +from mgr_module import HandleCommandResult from mgr_module import MgrModule import orchestrator