kaqing 2.0.110__py3-none-any.whl → 2.0.184__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kaqing might be problematic. Click here for more details.
- adam/__init__.py +0 -2
- adam/app_session.py +9 -12
- adam/apps.py +18 -4
- adam/batch.py +5 -5
- adam/checks/check_utils.py +16 -46
- adam/checks/cpu.py +7 -1
- adam/checks/cpu_metrics.py +52 -0
- adam/checks/disk.py +2 -3
- adam/columns/columns.py +3 -1
- adam/columns/cpu.py +3 -1
- adam/columns/cpu_metrics.py +22 -0
- adam/columns/memory.py +3 -4
- adam/commands/__init__.py +24 -0
- adam/commands/alter_tables.py +33 -48
- adam/commands/app/__init__.py +0 -0
- adam/commands/app/app.py +38 -0
- adam/commands/{app_ping.py → app/app_ping.py} +7 -13
- adam/commands/app/show_app_actions.py +49 -0
- adam/commands/{show → app}/show_app_id.py +8 -11
- adam/commands/{show → app}/show_app_queues.py +7 -14
- adam/commands/app/utils_app.py +98 -0
- adam/commands/audit/audit.py +27 -31
- adam/commands/audit/audit_repair_tables.py +14 -18
- adam/commands/audit/audit_run.py +16 -23
- adam/commands/audit/show_last10.py +4 -17
- adam/commands/audit/show_slow10.py +4 -17
- adam/commands/audit/show_top10.py +4 -16
- adam/commands/audit/utils_show_top10.py +15 -3
- adam/commands/bash/__init__.py +5 -0
- adam/commands/bash/bash.py +36 -0
- adam/commands/bash/bash_completer.py +93 -0
- adam/commands/bash/utils_bash.py +16 -0
- adam/commands/cat.py +36 -0
- adam/commands/cd.py +11 -95
- adam/commands/check.py +15 -24
- adam/commands/cli_commands.py +2 -3
- adam/commands/clipboard_copy.py +86 -0
- adam/commands/code.py +57 -0
- adam/commands/command.py +198 -40
- adam/commands/commands_utils.py +12 -27
- adam/commands/cql/cql_completions.py +27 -10
- adam/commands/cql/cqlsh.py +12 -30
- adam/commands/cql/utils_cql.py +297 -0
- adam/commands/deploy/code_start.py +7 -10
- adam/commands/deploy/code_stop.py +4 -21
- adam/commands/deploy/code_utils.py +3 -3
- adam/commands/deploy/deploy.py +4 -27
- adam/commands/deploy/deploy_frontend.py +14 -17
- adam/commands/deploy/deploy_pg_agent.py +3 -6
- adam/commands/deploy/deploy_pod.py +65 -73
- adam/commands/deploy/deploy_utils.py +14 -24
- adam/commands/deploy/undeploy.py +4 -27
- adam/commands/deploy/undeploy_frontend.py +4 -7
- adam/commands/deploy/undeploy_pg_agent.py +6 -8
- adam/commands/deploy/undeploy_pod.py +11 -12
- adam/commands/devices/__init__.py +0 -0
- adam/commands/devices/device.py +123 -0
- adam/commands/devices/device_app.py +163 -0
- adam/commands/devices/device_auit_log.py +49 -0
- adam/commands/devices/device_cass.py +179 -0
- adam/commands/devices/device_export.py +84 -0
- adam/commands/devices/device_postgres.py +150 -0
- adam/commands/devices/devices.py +25 -0
- adam/commands/download_file.py +47 -0
- adam/commands/exit.py +1 -4
- adam/commands/export/__init__.py +0 -0
- adam/commands/export/clean_up_all_export_sessions.py +37 -0
- adam/commands/export/clean_up_export_sessions.py +39 -0
- adam/commands/export/download_export_session.py +39 -0
- adam/commands/export/drop_export_database.py +39 -0
- adam/commands/export/drop_export_databases.py +37 -0
- adam/commands/export/export.py +53 -0
- adam/commands/export/export_databases.py +245 -0
- adam/commands/export/export_select.py +59 -0
- adam/commands/export/export_select_x.py +54 -0
- adam/commands/export/export_sessions.py +209 -0
- adam/commands/export/export_use.py +49 -0
- adam/commands/export/exporter.py +332 -0
- adam/commands/export/import_files.py +44 -0
- adam/commands/export/import_session.py +44 -0
- adam/commands/export/importer.py +81 -0
- adam/commands/export/importer_athena.py +177 -0
- adam/commands/export/importer_sqlite.py +67 -0
- adam/commands/export/show_column_counts.py +45 -0
- adam/commands/export/show_export_databases.py +38 -0
- adam/commands/export/show_export_session.py +39 -0
- adam/commands/export/show_export_sessions.py +37 -0
- adam/commands/export/utils_export.py +343 -0
- adam/commands/find_files.py +51 -0
- adam/commands/find_processes.py +76 -0
- adam/commands/head.py +36 -0
- adam/commands/help.py +5 -3
- adam/commands/intermediate_command.py +49 -0
- adam/commands/issues.py +11 -43
- adam/commands/kubectl.py +38 -0
- adam/commands/login.py +22 -24
- adam/commands/logs.py +3 -6
- adam/commands/ls.py +11 -116
- adam/commands/medusa/medusa.py +4 -22
- adam/commands/medusa/medusa_backup.py +20 -27
- adam/commands/medusa/medusa_restore.py +38 -37
- adam/commands/medusa/medusa_show_backupjobs.py +16 -18
- adam/commands/medusa/medusa_show_restorejobs.py +13 -18
- adam/commands/nodetool.py +11 -17
- adam/commands/param_get.py +11 -14
- adam/commands/param_set.py +8 -12
- adam/commands/postgres/postgres.py +45 -46
- adam/commands/postgres/postgres_databases.py +269 -0
- adam/commands/postgres/postgres_ls.py +4 -8
- adam/commands/postgres/postgres_preview.py +5 -9
- adam/commands/postgres/psql_completions.py +4 -3
- adam/commands/postgres/utils_postgres.py +70 -0
- adam/commands/preview_table.py +8 -44
- adam/commands/pwd.py +14 -46
- adam/commands/reaper/reaper.py +4 -27
- adam/commands/reaper/reaper_forward.py +49 -56
- adam/commands/reaper/reaper_forward_session.py +6 -0
- adam/commands/reaper/reaper_forward_stop.py +10 -16
- adam/commands/reaper/reaper_restart.py +7 -14
- adam/commands/reaper/reaper_run_abort.py +8 -33
- adam/commands/reaper/reaper_runs.py +43 -58
- adam/commands/reaper/reaper_runs_abort.py +29 -49
- adam/commands/reaper/reaper_schedule_activate.py +9 -32
- adam/commands/reaper/reaper_schedule_start.py +9 -32
- adam/commands/reaper/reaper_schedule_stop.py +9 -32
- adam/commands/reaper/reaper_schedules.py +4 -14
- adam/commands/reaper/reaper_status.py +8 -16
- adam/commands/reaper/utils_reaper.py +194 -0
- adam/commands/repair/repair.py +4 -22
- adam/commands/repair/repair_log.py +5 -11
- adam/commands/repair/repair_run.py +27 -34
- adam/commands/repair/repair_scan.py +32 -38
- adam/commands/repair/repair_stop.py +5 -11
- adam/commands/report.py +27 -29
- adam/commands/restart.py +25 -26
- adam/commands/rollout.py +19 -24
- adam/commands/shell.py +12 -4
- adam/commands/show/show.py +10 -25
- adam/commands/show/show_adam.py +3 -3
- adam/commands/show/show_cassandra_repairs.py +35 -0
- adam/commands/show/show_cassandra_status.py +33 -51
- adam/commands/show/show_cassandra_version.py +5 -18
- adam/commands/show/show_commands.py +20 -25
- adam/commands/show/show_host.py +1 -1
- adam/commands/show/show_login.py +20 -27
- adam/commands/show/show_params.py +2 -5
- adam/commands/show/show_processes.py +15 -19
- adam/commands/show/show_storage.py +10 -20
- adam/commands/watch.py +26 -29
- adam/config.py +5 -14
- adam/embedded_params.py +1 -1
- adam/log.py +4 -4
- adam/pod_exec_result.py +6 -3
- adam/repl.py +69 -115
- adam/repl_commands.py +52 -19
- adam/repl_state.py +161 -40
- adam/sql/sql_completer.py +52 -27
- adam/sql/sql_state_machine.py +131 -19
- adam/sso/authn_ad.py +6 -8
- adam/sso/authn_okta.py +4 -6
- adam/sso/cred_cache.py +3 -5
- adam/sso/idp.py +9 -12
- adam/utils.py +511 -9
- adam/utils_athena.py +145 -0
- adam/utils_audits.py +12 -103
- adam/utils_issues.py +32 -0
- adam/utils_k8s/app_clusters.py +28 -0
- adam/utils_k8s/app_pods.py +36 -0
- adam/utils_k8s/cassandra_clusters.py +30 -19
- adam/utils_k8s/cassandra_nodes.py +3 -3
- adam/utils_k8s/custom_resources.py +16 -17
- adam/utils_k8s/ingresses.py +2 -2
- adam/utils_k8s/jobs.py +7 -11
- adam/utils_k8s/k8s.py +87 -0
- adam/utils_k8s/kube_context.py +2 -2
- adam/utils_k8s/pods.py +89 -78
- adam/utils_k8s/secrets.py +4 -4
- adam/utils_k8s/service_accounts.py +5 -4
- adam/utils_k8s/services.py +2 -2
- adam/utils_k8s/statefulsets.py +1 -12
- adam/utils_local.py +4 -0
- adam/utils_net.py +4 -4
- adam/utils_repl/__init__.py +0 -0
- adam/utils_repl/automata_completer.py +48 -0
- adam/utils_repl/repl_completer.py +46 -0
- adam/utils_repl/state_machine.py +173 -0
- adam/utils_sqlite.py +137 -0
- adam/version.py +1 -1
- {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/METADATA +1 -1
- kaqing-2.0.184.dist-info/RECORD +244 -0
- adam/commands/app.py +0 -67
- adam/commands/bash.py +0 -150
- adam/commands/cp.py +0 -95
- adam/commands/cql/cql_utils.py +0 -112
- adam/commands/devices.py +0 -118
- adam/commands/postgres/postgres_context.py +0 -239
- adam/commands/postgres/postgres_utils.py +0 -31
- adam/commands/reaper/reaper_session.py +0 -159
- adam/commands/show/show_app_actions.py +0 -56
- adam/commands/show/show_repairs.py +0 -47
- kaqing-2.0.110.dist-info/RECORD +0 -187
- {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/WHEEL +0 -0
- {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/entry_points.txt +0 -0
- {kaqing-2.0.110.dist-info → kaqing-2.0.184.dist-info}/top_level.txt +0 -0
adam/repl.py
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import re
|
|
3
2
|
import time
|
|
4
|
-
import
|
|
3
|
+
from typing import cast
|
|
5
4
|
import click
|
|
6
|
-
import concurrent
|
|
7
|
-
from prompt_toolkit.completion import NestedCompleter
|
|
8
5
|
from prompt_toolkit.key_binding import KeyBindings
|
|
9
6
|
|
|
10
7
|
from adam.cli_group import cli
|
|
11
|
-
from adam.commands.command import Command
|
|
8
|
+
from adam.commands.command import Command, InvalidArgumentsException, InvalidStateException
|
|
12
9
|
from adam.commands.command_helpers import ClusterCommandHelper
|
|
10
|
+
from adam.commands.devices.devices import Devices
|
|
13
11
|
from adam.commands.help import Help
|
|
14
|
-
from adam.commands.postgres.postgres_context import PostgresContext
|
|
15
12
|
from adam.config import Config
|
|
16
13
|
from adam.utils_audits import Audits
|
|
17
14
|
from adam.utils_k8s.kube_context import KubeContext
|
|
18
|
-
from adam.utils_k8s.statefulsets import StatefulSets
|
|
19
15
|
from adam.log import Log
|
|
20
16
|
from adam.repl_commands import ReplCommands
|
|
21
17
|
from adam.repl_session import ReplSession
|
|
22
18
|
from adam.repl_state import ReplState
|
|
23
|
-
from adam.utils import deep_merge_dicts, deep_sort_dict,
|
|
19
|
+
from adam.utils import clear_wait_log_flag, debug_trace, deep_merge_dicts, deep_sort_dict, tabulize, log2, log_exc, log_timing
|
|
24
20
|
from adam.apps import Apps
|
|
21
|
+
from adam.utils_repl.repl_completer import ReplCompleter
|
|
25
22
|
from . import __version__
|
|
26
23
|
|
|
27
24
|
def enter_repl(state: ReplState):
|
|
@@ -35,66 +32,13 @@ def enter_repl(state: ReplState):
|
|
|
35
32
|
session = ReplSession().prompt_session
|
|
36
33
|
|
|
37
34
|
def prompt_msg():
|
|
38
|
-
msg =
|
|
39
|
-
if state.device == ReplState.P:
|
|
40
|
-
msg = f'{ReplState.P}:'
|
|
41
|
-
pg: PostgresContext = PostgresContext.apply(state.namespace, state.pg_path) if state.pg_path else None
|
|
42
|
-
if pg and pg.db:
|
|
43
|
-
msg += pg.db
|
|
44
|
-
elif pg and pg.host:
|
|
45
|
-
msg += pg.host
|
|
46
|
-
elif state.device == ReplState.A:
|
|
47
|
-
msg = f'{ReplState.A}:'
|
|
48
|
-
if state.app_env:
|
|
49
|
-
msg += state.app_env
|
|
50
|
-
if state.app_app:
|
|
51
|
-
msg += f'/{state.app_app}'
|
|
52
|
-
elif state.device == ReplState.L:
|
|
53
|
-
msg = f'{ReplState.L}:'
|
|
54
|
-
else:
|
|
55
|
-
msg = f'{ReplState.C}:'
|
|
56
|
-
if state.pod:
|
|
57
|
-
# cs-d0767a536f-cs-d0767a536f-default-sts-0
|
|
58
|
-
group = re.match(r".*?-.*?-(.*)", state.pod)
|
|
59
|
-
msg += group[1]
|
|
60
|
-
elif state.sts:
|
|
61
|
-
# cs-d0767a536f-cs-d0767a536f-default-sts
|
|
62
|
-
group = re.match(r".*?-.*?-(.*)", state.sts)
|
|
63
|
-
msg += group[1]
|
|
35
|
+
msg = state.__str__()
|
|
64
36
|
|
|
65
37
|
return f"{msg}$ " if state.bash_session else f"{msg}> "
|
|
66
38
|
|
|
67
39
|
Log.log2(f'kaqing {__version__}')
|
|
68
40
|
|
|
69
|
-
|
|
70
|
-
auto_enter = Config().get('repl.c.auto-enter', 'cluster')
|
|
71
|
-
if auto_enter and auto_enter in ['cluster', 'first-pod']:
|
|
72
|
-
ss = StatefulSets.list_sts_name_and_ns()
|
|
73
|
-
if not ss:
|
|
74
|
-
log2("No Cassandra clusters found.")
|
|
75
|
-
elif not state.sts and len(ss) == 1:
|
|
76
|
-
cluster = ss[0]
|
|
77
|
-
state.sts = cluster[0]
|
|
78
|
-
state.namespace = cluster[1]
|
|
79
|
-
if auto_enter == 'first-pod':
|
|
80
|
-
state.pod = f'{state.sts}-0'
|
|
81
|
-
if KubeContext().in_cluster_namespace:
|
|
82
|
-
Config().wait_log(f'Moving to the only Cassandra cluster: {state.sts}...')
|
|
83
|
-
else:
|
|
84
|
-
Config().wait_log(f'Moving to the only Cassandra cluster: {state.sts}@{state.namespace}...')
|
|
85
|
-
elif state.device == ReplState.A:
|
|
86
|
-
if not state.app_env:
|
|
87
|
-
if app := Config().get('repl.a.auto-enter-app', 'c3/c3'):
|
|
88
|
-
if app != 'no':
|
|
89
|
-
ea = app.split('/')
|
|
90
|
-
state.app_env = ea[0]
|
|
91
|
-
if len(ea) > 1:
|
|
92
|
-
state.app_app = ea[1]
|
|
93
|
-
Config().wait_log(f'Moving to {state.app_env}/{state.app_app}...')
|
|
94
|
-
else:
|
|
95
|
-
Config().wait_log(f'Moving to {state.app_env}...')
|
|
96
|
-
elif state.device == ReplState.P:
|
|
97
|
-
Config().wait_log('Inspecting postgres database instances...')
|
|
41
|
+
Devices.device(state).enter(state)
|
|
98
42
|
|
|
99
43
|
kb = KeyBindings()
|
|
100
44
|
|
|
@@ -102,34 +46,32 @@ def enter_repl(state: ReplState):
|
|
|
102
46
|
def _(event):
|
|
103
47
|
event.app.current_buffer.text = ''
|
|
104
48
|
|
|
105
|
-
with
|
|
49
|
+
with Audits.offload() as exec:
|
|
106
50
|
# warm up AWS lambda - this log line may timeout and get lost, which is fine
|
|
107
|
-
|
|
51
|
+
exec.submit(Audits.log, 'entering kaqing repl', state.namespace, 'z', 0.0)
|
|
108
52
|
|
|
109
53
|
s0 = time.time()
|
|
110
54
|
|
|
111
55
|
# use sorted command list only for auto-completion
|
|
112
56
|
sorted_cmds = sorted(cmd_list, key=lambda cmd: cmd.command())
|
|
113
57
|
while True:
|
|
58
|
+
cmd: str = None
|
|
114
59
|
result = None
|
|
115
60
|
try:
|
|
116
|
-
completer =
|
|
61
|
+
completer = ReplCompleter.from_nested_dict({})
|
|
117
62
|
if not state.bash_session:
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
# print(json.dumps(completions, indent=4))
|
|
132
|
-
completer = NestedCompleter.from_nested_dict(completions)
|
|
63
|
+
with log_timing('completion-calcs'):
|
|
64
|
+
completions = {}
|
|
65
|
+
# app commands are available only on a: drive
|
|
66
|
+
if state.device == ReplState.A and state.app_app:
|
|
67
|
+
completions = log_timing('actions', lambda: Apps(path='apps.yaml').commands())
|
|
68
|
+
|
|
69
|
+
for c in sorted_cmds:
|
|
70
|
+
with log_exc(f'* {c.command()} command returned None completions.'):
|
|
71
|
+
completions = log_timing(c.command(), lambda: deep_sort_dict(deep_merge_dicts(completions, c.completion(state))))
|
|
72
|
+
|
|
73
|
+
# print(json.dumps(completions, indent=4))
|
|
74
|
+
completer = ReplCompleter.from_nested_dict(completions)
|
|
133
75
|
|
|
134
76
|
cmd = session.prompt(prompt_msg(), completer=completer, key_bindings=kb)
|
|
135
77
|
s0 = time.time()
|
|
@@ -141,9 +83,40 @@ def enter_repl(state: ReplState):
|
|
|
141
83
|
|
|
142
84
|
cmd = f'bash {cmd}'
|
|
143
85
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
86
|
+
def targetted(state: ReplState, cmd: str):
|
|
87
|
+
if not (cmd.startswith('@') and len(arry := cmd.split(' ')) > 1):
|
|
88
|
+
return state, cmd
|
|
89
|
+
|
|
90
|
+
if state.device == ReplState.A and state.app_app or state.device == ReplState.P:
|
|
91
|
+
state.push()
|
|
92
|
+
|
|
93
|
+
state.app_pod = arry[0].strip('@')
|
|
94
|
+
cmd = ' '.join(arry[1:])
|
|
95
|
+
elif state.device == ReplState.P:
|
|
96
|
+
state.push()
|
|
97
|
+
|
|
98
|
+
state.app_pod = arry[0].strip('@')
|
|
99
|
+
cmd = ' '.join(arry[1:])
|
|
100
|
+
elif state.sts:
|
|
101
|
+
state.push()
|
|
102
|
+
|
|
103
|
+
state.pod = arry[0].strip('@')
|
|
104
|
+
cmd = ' '.join(arry[1:])
|
|
105
|
+
|
|
106
|
+
return (state, cmd)
|
|
107
|
+
|
|
108
|
+
target, cmd = targetted(state, cmd)
|
|
109
|
+
try:
|
|
110
|
+
if cmd and cmd.strip(' ') and not (result := cmds.run(cmd, target)):
|
|
111
|
+
result = try_device_default_action(target, cmds, cmd_list, cmd)
|
|
112
|
+
except InvalidStateException:
|
|
113
|
+
pass
|
|
114
|
+
except InvalidArgumentsException:
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
if result and type(result) is ReplState and (s := cast(ReplState, result).export_session) != state.export_session:
|
|
118
|
+
state.export_session = s
|
|
119
|
+
|
|
147
120
|
except EOFError: # Handle Ctrl+D (EOF) for graceful exit
|
|
148
121
|
break
|
|
149
122
|
except Exception as e:
|
|
@@ -151,45 +124,26 @@ def enter_repl(state: ReplState):
|
|
|
151
124
|
raise e
|
|
152
125
|
else:
|
|
153
126
|
log2(e)
|
|
154
|
-
|
|
127
|
+
debug_trace()
|
|
155
128
|
finally:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
129
|
+
if not state.bash_session:
|
|
130
|
+
state.pop()
|
|
131
|
+
|
|
132
|
+
clear_wait_log_flag()
|
|
133
|
+
if cmd:
|
|
134
|
+
log_timing(f'command {cmd}', s0=s0)
|
|
159
135
|
|
|
160
136
|
# offload audit logging
|
|
161
137
|
if cmd and (state.device != ReplState.L or Config().get('audit.log-audit-queries', False)):
|
|
162
|
-
|
|
138
|
+
exec.submit(Audits.log, cmd, state.namespace, state.device, time.time() - s0, get_audit_extra(result))
|
|
163
139
|
|
|
164
140
|
def try_device_default_action(state: ReplState, cmds: Command, cmd_list: list[Command], cmd: str):
|
|
165
|
-
result =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if state.device == ReplState.P:
|
|
169
|
-
pg: PostgresContext = PostgresContext.apply(state.namespace, state.pg_path)
|
|
170
|
-
if pg.db:
|
|
171
|
-
c_sql_tried = True
|
|
172
|
-
cmd = f'pg {cmd}'
|
|
173
|
-
result = cmds.run(cmd, state)
|
|
174
|
-
elif state.device == ReplState.A:
|
|
175
|
-
if state.app_app:
|
|
176
|
-
c_sql_tried = True
|
|
177
|
-
cmd = f'app {cmd}'
|
|
178
|
-
result = cmds.run(cmd, state)
|
|
179
|
-
elif state.device == ReplState.L:
|
|
180
|
-
c_sql_tried = True
|
|
181
|
-
cmd = f'audit {cmd}'
|
|
182
|
-
result = cmds.run(cmd, state)
|
|
183
|
-
elif state.sts:
|
|
184
|
-
c_sql_tried = True
|
|
185
|
-
cmd = f'cql {cmd}'
|
|
186
|
-
result = cmds.run(cmd, state)
|
|
187
|
-
|
|
188
|
-
if not c_sql_tried:
|
|
141
|
+
action_taken, result = Devices.device(state).try_fallback_action(cmds, state, cmd)
|
|
142
|
+
|
|
143
|
+
if not action_taken:
|
|
189
144
|
log2(f'* Invalid command: {cmd}')
|
|
190
145
|
log2()
|
|
191
|
-
|
|
192
|
-
log2(lines_to_tabular(lines, separator='\t'))
|
|
146
|
+
tabulize([c.help(state) for c in cmd_list if c.help(state)], separator='\t', to=2)
|
|
193
147
|
|
|
194
148
|
return result
|
|
195
149
|
|
adam/repl_commands.py
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
from adam.commands.alter_tables import AlterTables
|
|
2
|
-
from adam.commands.app import App
|
|
3
|
-
from adam.commands.app_ping import AppPing
|
|
2
|
+
from adam.commands.app.app import App
|
|
3
|
+
from adam.commands.app.app_ping import AppPing
|
|
4
|
+
from adam.commands.app.show_app_actions import ShowAppActions
|
|
5
|
+
from adam.commands.app.show_app_id import ShowAppId
|
|
6
|
+
from adam.commands.app.show_app_queues import ShowAppQueues
|
|
4
7
|
from adam.commands.audit.audit import Audit
|
|
5
|
-
from adam.commands.
|
|
6
|
-
from adam.commands.
|
|
8
|
+
from adam.commands.cat import Cat
|
|
9
|
+
from adam.commands.code import Code
|
|
10
|
+
from adam.commands.download_file import DownloadFile
|
|
7
11
|
from adam.commands.deploy.code_start import CodeStart
|
|
8
12
|
from adam.commands.deploy.code_stop import CodeStop
|
|
9
13
|
from adam.commands.deploy.deploy import Deploy
|
|
@@ -14,22 +18,44 @@ from adam.commands.deploy.undeploy import Undeploy
|
|
|
14
18
|
from adam.commands.deploy.undeploy_frontend import UndeployFrontend
|
|
15
19
|
from adam.commands.deploy.undeploy_pg_agent import UndeployPgAgent
|
|
16
20
|
from adam.commands.deploy.undeploy_pod import UndeployPod
|
|
21
|
+
from adam.commands.devices.device_app import DeviceApp
|
|
22
|
+
from adam.commands.devices.device_auit_log import DeviceAuditLog
|
|
23
|
+
from adam.commands.devices.device_cass import DeviceCass
|
|
24
|
+
from adam.commands.devices.device_export import DeviceExport
|
|
25
|
+
from adam.commands.devices.device_postgres import DevicePostgres
|
|
26
|
+
from adam.commands.export.download_export_session import DownloadExportSession
|
|
27
|
+
from adam.commands.export.drop_export_database import DropExportDatabase
|
|
28
|
+
from adam.commands.export.export import ExportTables
|
|
29
|
+
from adam.commands.export.import_files import ImportCSVFiles
|
|
30
|
+
from adam.commands.export.import_session import ImportSession
|
|
31
|
+
from adam.commands.export.clean_up_export_sessions import CleanUpExportSessions
|
|
32
|
+
from adam.commands.export.clean_up_all_export_sessions import CleanUpAllExportSessions
|
|
33
|
+
from adam.commands.export.drop_export_databases import DropExportDatabases
|
|
34
|
+
from adam.commands.export.export_select import ExportSelect
|
|
35
|
+
from adam.commands.export.export_use import ExportUse
|
|
36
|
+
from adam.commands.export.export_select_x import ExportSelectX
|
|
37
|
+
from adam.commands.export.show_column_counts import ShowColumnCounts
|
|
38
|
+
from adam.commands.export.show_export_databases import ShowExportDatabases
|
|
39
|
+
from adam.commands.export.show_export_session import ShowExportSession
|
|
40
|
+
from adam.commands.export.show_export_sessions import ShowExportSessions
|
|
41
|
+
from adam.commands.find_files import FindLocalFiles
|
|
42
|
+
from adam.commands.find_processes import FindProcesses
|
|
43
|
+
from adam.commands.head import Head
|
|
44
|
+
from adam.commands.kubectl import Kubectl
|
|
17
45
|
from adam.commands.shell import Shell
|
|
18
|
-
from adam.commands.
|
|
19
|
-
from adam.commands.
|
|
20
|
-
from adam.commands.bash import Bash
|
|
46
|
+
from adam.commands.clipboard_copy import ClipboardCopy
|
|
47
|
+
from adam.commands.bash.bash import Bash
|
|
21
48
|
from adam.commands.cd import Cd
|
|
22
49
|
from adam.commands.check import Check
|
|
23
50
|
from adam.commands.command import Command
|
|
24
51
|
from adam.commands.cql.cqlsh import Cqlsh
|
|
25
|
-
from adam.commands.devices import DeviceApp, DeviceAuditLog, DeviceCass, DevicePostgres
|
|
26
52
|
from adam.commands.exit import Exit
|
|
27
53
|
from adam.commands.medusa.medusa import Medusa
|
|
28
54
|
from adam.commands.param_get import GetParam
|
|
29
55
|
from adam.commands.issues import Issues
|
|
30
56
|
from adam.commands.ls import Ls
|
|
31
57
|
from adam.commands.nodetool import NodeTool
|
|
32
|
-
from adam.commands.postgres.postgres import Postgres
|
|
58
|
+
from adam.commands.postgres.postgres import Postgres, PostgresPg
|
|
33
59
|
from adam.commands.preview_table import PreviewTable
|
|
34
60
|
from adam.commands.pwd import Pwd
|
|
35
61
|
from adam.commands.reaper.reaper import Reaper
|
|
@@ -39,8 +65,6 @@ from adam.commands.restart import Restart
|
|
|
39
65
|
from adam.commands.rollout import RollOut
|
|
40
66
|
from adam.commands.param_set import SetParam
|
|
41
67
|
from adam.commands.show.show import Show
|
|
42
|
-
from adam.commands.show.show_app_actions import ShowAppActions
|
|
43
|
-
from adam.commands.show.show_app_id import ShowAppId
|
|
44
68
|
from adam.commands.show.show_cassandra_status import ShowCassandraStatus
|
|
45
69
|
from adam.commands.show.show_cassandra_version import ShowCassandraVersion
|
|
46
70
|
from adam.commands.show.show_commands import ShowKubectlCommands
|
|
@@ -48,7 +72,7 @@ from adam.commands.show.show_host import ShowHost
|
|
|
48
72
|
from adam.commands.show.show_login import ShowLogin
|
|
49
73
|
from adam.commands.show.show_params import ShowParams
|
|
50
74
|
from adam.commands.show.show_processes import ShowProcesses
|
|
51
|
-
from adam.commands.show.
|
|
75
|
+
from adam.commands.show.show_cassandra_repairs import ShowCassandraRepairs
|
|
52
76
|
from adam.commands.show.show_storage import ShowStorage
|
|
53
77
|
from adam.commands.show.show_adam import ShowAdam
|
|
54
78
|
from adam.commands.watch import Watch
|
|
@@ -56,7 +80,7 @@ from adam.commands.watch import Watch
|
|
|
56
80
|
class ReplCommands:
|
|
57
81
|
def repl_cmd_list() -> list[Command]:
|
|
58
82
|
cmds: list[Command] = ReplCommands.navigation() + ReplCommands.cassandra_ops() + ReplCommands.postgres_ops() + \
|
|
59
|
-
ReplCommands.app_ops() + ReplCommands.audit_ops() + ReplCommands.tools() + ReplCommands.exit()
|
|
83
|
+
ReplCommands.app_ops() + ReplCommands.audit_ops() + ReplCommands.export_ops() + ReplCommands.tools() + ReplCommands.exit()
|
|
60
84
|
|
|
61
85
|
intermediate_cmds: list[Command] = [App(), Audit(), Reaper(), Repair(), Deploy(), Show(), Undeploy()]
|
|
62
86
|
ic = [c.command() for c in intermediate_cmds]
|
|
@@ -75,24 +99,33 @@ class ReplCommands:
|
|
|
75
99
|
return deduped
|
|
76
100
|
|
|
77
101
|
def navigation() -> list[Command]:
|
|
78
|
-
return [Ls(), PreviewTable(), DeviceApp(), DevicePostgres(), DeviceCass(), DeviceAuditLog(),
|
|
102
|
+
return [Ls(), PreviewTable(), DeviceApp(), DevicePostgres(), DeviceCass(), DeviceAuditLog(), DeviceExport(),
|
|
103
|
+
Cd(), Cat(), Head(), DownloadFile(), FindLocalFiles(), FindProcesses(), Pwd(), ClipboardCopy(),
|
|
79
104
|
GetParam(), SetParam(), ShowParams(), ShowKubectlCommands(), ShowLogin(), ShowAdam(), ShowHost()]
|
|
80
105
|
|
|
81
106
|
def cassandra_ops() -> list[Command]:
|
|
82
|
-
return [Cqlsh(), ShowCassandraStatus(), ShowCassandraVersion(),
|
|
83
|
-
|
|
107
|
+
return [Cqlsh(), ShowCassandraStatus(), ShowCassandraVersion(), ShowCassandraRepairs(), ShowStorage(), ShowProcesses(),
|
|
108
|
+
Check(), Issues(), NodeTool(), Report(), AlterTables(), Bash(),
|
|
109
|
+
ExportTables(), ExportSelect(), ExportUse(), ShowExportDatabases(), ShowColumnCounts(),
|
|
110
|
+
DropExportDatabase(), DropExportDatabases(),
|
|
111
|
+
ShowExportSessions(), ShowExportSession(), DownloadExportSession(),
|
|
112
|
+
CleanUpExportSessions(), CleanUpAllExportSessions(), ImportSession(), ImportCSVFiles()] + \
|
|
113
|
+
Medusa().cmd_list() + [Restart(), RollOut(), Watch()] + Reaper().cmd_list() + Repair().cmd_list()
|
|
84
114
|
|
|
85
115
|
def postgres_ops() -> list[Command]:
|
|
86
|
-
return [Postgres(), DeployPgAgent(), UndeployPgAgent()]
|
|
116
|
+
return [Postgres(), DeployPgAgent(), UndeployPgAgent(), PostgresPg()]
|
|
87
117
|
|
|
88
118
|
def app_ops() -> list[Command]:
|
|
89
119
|
return [ShowAppActions(), ShowAppId(), ShowAppQueues(), AppPing(), App()]
|
|
90
120
|
|
|
91
121
|
def audit_ops() -> list[Command]:
|
|
92
|
-
return [Audit()] + Audit.cmd_list()
|
|
122
|
+
return [Audit()] + Audit().cmd_list()
|
|
123
|
+
|
|
124
|
+
def export_ops() -> list[Command]:
|
|
125
|
+
return [ExportSelectX(), DropExportDatabase(), DropExportDatabases(), ShowColumnCounts()]
|
|
93
126
|
|
|
94
127
|
def tools() -> list[Command]:
|
|
95
|
-
return [
|
|
128
|
+
return [Shell(), CodeStart(), CodeStop(), DeployFrontend(), UndeployFrontend(), DeployPod(), UndeployPod(), Kubectl(), Code()]
|
|
96
129
|
|
|
97
130
|
def exit() -> list[Command]:
|
|
98
131
|
return [Exit()]
|