33
33
from .._stratisd_constants import ReportKey , StratisdErrors
34
34
from ._connection import get_object
35
35
from ._constants import TOP_OBJECT
36
+ from ._dynamic import ClassKey , make_dyn_class
36
37
from ._formatting import print_table
37
38
38
39
@@ -44,8 +45,7 @@ def _fetch_keylist(proxy):
44
45
:rtype: list of str
45
46
:raises StratisCliEngineError:
46
47
"""
47
- # pylint: disable=import-outside-toplevel
48
- from ._data import Manager
48
+ Manager = make_dyn_class (ClassKey .MANAGER )
49
49
50
50
(keys , return_code , message ) = Manager .Methods .ListKeys (proxy , {})
51
51
if return_code != StratisdErrors .OK : # pragma: no cover
@@ -68,8 +68,7 @@ def _add_update_key(proxy, key_desc, capture_key, *, keyfile_path):
68
68
"""
69
69
assert capture_key == (keyfile_path is None )
70
70
71
- # pylint: disable=import-outside-toplevel
72
- from ._data import Manager
71
+ Manager = make_dyn_class (ClassKey .MANAGER )
73
72
74
73
if capture_key :
75
74
password = getpass (prompt = "Enter key data followed by the return key: " )
@@ -119,22 +118,22 @@ def get_report(namespace):
119
118
120
119
# pylint: disable=import-outside-toplevel
121
120
if namespace .report_name == ReportKey .MANAGED_OBJECTS .value :
122
- from . _data import ObjectManager
121
+ ObjectManager = make_dyn_class ( ClassKey . OBJECT_MANAGER )
123
122
124
123
json_report = ObjectManager .Methods .GetManagedObjects (
125
124
get_object (TOP_OBJECT ), {}
126
125
)
127
126
128
127
else :
129
128
if namespace .report_name == ReportKey .ENGINE_STATE .value :
130
- from . _data import Manager
129
+ Manager = make_dyn_class ( ClassKey . MANAGER )
131
130
132
131
(report , return_code , message ) = Manager .Methods .EngineStateReport (
133
132
get_object (TOP_OBJECT ), {}
134
133
)
135
134
136
135
else :
137
- from . _data import Report
136
+ Report = make_dyn_class ( ClassKey . REPORT )
138
137
139
138
(report , return_code , message ) = Report .Methods .GetReport (
140
139
get_object (TOP_OBJECT ), {"name" : namespace .report_name }
@@ -242,8 +241,7 @@ def unset_key(namespace):
242
241
:raises StratisCliNoChangeError:
243
242
:raises StratisCliIncoherenceError:
244
243
"""
245
- # pylint: disable=import-outside-toplevel
246
- from ._data import Manager
244
+ Manager = make_dyn_class (ClassKey .MANAGER )
247
245
248
246
proxy = get_object (TOP_OBJECT )
249
247
0 commit comments