kaqing 2.0.105__tar.gz → 2.0.110__tar.gz
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.
- {kaqing-2.0.105 → kaqing-2.0.110}/PKG-INFO +1 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/app.py +2 -2
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/app_ping.py +2 -2
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/audit/audit.py +12 -2
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/audit/audit_repair_tables.py +5 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/audit/audit_run.py +7 -1
- kaqing-2.0.110/adam/commands/audit/show_last10.py +50 -0
- kaqing-2.0.110/adam/commands/audit/show_slow10.py +49 -0
- kaqing-2.0.110/adam/commands/audit/show_top10.py +48 -0
- kaqing-2.0.110/adam/commands/audit/utils_show_top10.py +59 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/cd.py +6 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/check.py +6 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/command.py +6 -4
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/cql/cql_utils.py +1 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/deploy.py +7 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/undeploy.py +7 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/help.py +7 -5
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/issues.py +6 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/login.py +6 -3
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/logs.py +1 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/ls.py +6 -6
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/medusa/medusa_show_backupjobs.py +1 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/preview_table.py +3 -7
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper.py +3 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/repair/repair.py +3 -3
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/report.py +6 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show.py +3 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_app_actions.py +3 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_app_queues.py +3 -2
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_login.py +3 -0
- kaqing-2.0.110/adam/embedded_params.py +2 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/pod_exec_result.py +4 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/repl.py +31 -54
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/repl_commands.py +13 -10
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/repl_state.py +130 -28
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sql/sql_state_machine.py +10 -10
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_audits.py +51 -25
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/cassandra_clusters.py +0 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/cassandra_nodes.py +1 -1
- kaqing-2.0.110/adam/version.py +5 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/kaqing.egg-info/PKG-INFO +1 -1
- {kaqing-2.0.105 → kaqing-2.0.110}/kaqing.egg-info/SOURCES.txt +4 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/setup.py +1 -1
- kaqing-2.0.105/adam/embedded_params.py +0 -2
- kaqing-2.0.105/adam/version.py +0 -5
- {kaqing-2.0.105 → kaqing-2.0.110}/README +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/app_session.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/apps.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/batch.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/check.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/check_context.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/check_result.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/check_utils.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/compactionstats.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/cpu.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/disk.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/gossip.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/issue.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/memory.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/checks/status.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/cli.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/cli_group.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/column.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/columns.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/compactions.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/cpu.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/dir_data.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/dir_snapshots.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/gossip.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/host_id.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/memory.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/node_address.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/node_load.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/node_owns.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/node_status.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/node_tokens.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/node_utils.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/pod_name.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/volume_cassandra.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/columns/volume_root.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/alter_tables.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/audit/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/bash.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/cli_commands.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/command_helpers.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/commands_utils.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/cp.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/cql/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/cql/cql_completions.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/cql/cqlsh.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/code_start.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/code_stop.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/code_utils.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/deploy_frontend.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/deploy_pg_agent.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/deploy_pod.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/deploy_utils.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/undeploy_frontend.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/undeploy_pg_agent.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/deploy/undeploy_pod.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/devices.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/exit.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/medusa/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/medusa/medusa.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/medusa/medusa_backup.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/medusa/medusa_restore.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/medusa/medusa_show_restorejobs.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/nodetool.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/nodetool_commands.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/param_get.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/param_set.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/postgres/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/postgres/postgres.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/postgres/postgres_context.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/postgres/postgres_ls.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/postgres/postgres_preview.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/postgres/postgres_utils.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/postgres/psql_completions.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/pwd.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_forward.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_forward_stop.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_restart.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_run_abort.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_runs.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_runs_abort.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_schedule_activate.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_schedule_start.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_schedule_stop.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_schedules.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_session.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/reaper/reaper_status.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/repair/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/repair/repair_log.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/repair/repair_run.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/repair/repair_scan.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/repair/repair_stop.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/restart.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/rollout.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/shell.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_adam.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_app_id.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_cassandra_status.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_cassandra_version.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_commands.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_host.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_params.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_processes.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_repairs.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/show/show_storage.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/commands/watch.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/config.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/embedded_apps.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/log.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/repl_session.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sql/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sql/sql_completer.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sql/term_completer.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/authenticator.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/authn_ad.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/authn_okta.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/cred_cache.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/id_token.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/idp.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/idp_login.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/idp_session.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/sso/sso_config.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/__init__.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/config_maps.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/custom_resources.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/deployment.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/ingresses.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/jobs.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/kube_context.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/pods.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/secrets.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/service_accounts.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/services.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/statefulsets.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_k8s/volumes.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/adam/utils_net.py +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/kaqing.egg-info/dependency_links.txt +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/kaqing.egg-info/entry_points.txt +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/kaqing.egg-info/top_level.txt +0 -0
- {kaqing-2.0.105 → kaqing-2.0.110}/setup.cfg +0 -0
|
@@ -22,14 +22,14 @@ class App(Command):
|
|
|
22
22
|
return App.COMMAND
|
|
23
23
|
|
|
24
24
|
def required(self):
|
|
25
|
-
return RequiredState.
|
|
25
|
+
return RequiredState.APP_APP
|
|
26
26
|
|
|
27
27
|
def run(self, cmd: str, state: ReplState):
|
|
28
28
|
if not(args := self.args(cmd)):
|
|
29
29
|
return super().run(cmd, state)
|
|
30
30
|
|
|
31
31
|
state, args = self.apply_state(args, state)
|
|
32
|
-
if not self.validate_state(state
|
|
32
|
+
if not self.validate_state(state):
|
|
33
33
|
return state
|
|
34
34
|
|
|
35
35
|
args, forced = Command.extract_options(args, '--force')
|
|
@@ -18,14 +18,14 @@ class AppPing(Command):
|
|
|
18
18
|
return AppPing.COMMAND
|
|
19
19
|
|
|
20
20
|
def required(self):
|
|
21
|
-
return RequiredState.
|
|
21
|
+
return RequiredState.APP_APP
|
|
22
22
|
|
|
23
23
|
def run(self, cmd: str, state: ReplState):
|
|
24
24
|
if not(args := self.args(cmd)):
|
|
25
25
|
return super().run(cmd, state)
|
|
26
26
|
|
|
27
27
|
state, args = self.apply_state(args, state)
|
|
28
|
-
if not self.validate_state(state
|
|
28
|
+
if not self.validate_state(state):
|
|
29
29
|
return state
|
|
30
30
|
|
|
31
31
|
_, forced = Command.extract_options(args, '--force')
|
|
@@ -2,6 +2,10 @@ import click
|
|
|
2
2
|
|
|
3
3
|
from adam.commands.audit.audit_repair_tables import AuditRepairTables
|
|
4
4
|
from adam.commands.audit.audit_run import AuditRun
|
|
5
|
+
from adam.commands.audit.show_last10 import ShowLast10
|
|
6
|
+
from adam.commands.audit.show_slow10 import ShowSlow10
|
|
7
|
+
from adam.commands.audit.show_top10 import ShowTop10
|
|
8
|
+
from adam.commands.audit.utils_show_top10 import show_top10_completions_for_nesting
|
|
5
9
|
from adam.commands.command import Command
|
|
6
10
|
from adam.config import Config
|
|
7
11
|
from adam.repl_state import ReplState
|
|
@@ -25,11 +29,16 @@ class Audit(Command):
|
|
|
25
29
|
def command(self):
|
|
26
30
|
return Audit.COMMAND
|
|
27
31
|
|
|
32
|
+
def required(self):
|
|
33
|
+
return ReplState.L
|
|
34
|
+
|
|
28
35
|
def run(self, cmd: str, state: ReplState):
|
|
29
36
|
if not(args := self.args(cmd)):
|
|
30
37
|
return super().run(cmd, state)
|
|
31
38
|
|
|
32
39
|
state, args = self.apply_state(args, state)
|
|
40
|
+
if not self.validate_state(state):
|
|
41
|
+
return state
|
|
33
42
|
|
|
34
43
|
r = None
|
|
35
44
|
if len(args) > 0:
|
|
@@ -52,10 +61,11 @@ class Audit(Command):
|
|
|
52
61
|
Config().wait_log(f'Inspecting audit database schema...')
|
|
53
62
|
self.schema_read = True
|
|
54
63
|
# warm up the caches first time when l: drive is accessed
|
|
64
|
+
Audits.audit_table_names()
|
|
55
65
|
Audits.audit_column_names()
|
|
56
66
|
Audits.audit_column_names(partition_cols_only=True)
|
|
57
67
|
|
|
58
|
-
return super().completion(state) | SqlCompleter(
|
|
68
|
+
return super().completion(state) | show_top10_completions_for_nesting() | SqlCompleter(
|
|
59
69
|
lambda: Audits.audit_table_names(),
|
|
60
70
|
columns=lambda table: Audits.audit_column_names(),
|
|
61
71
|
partition_columns=lambda table: Audits.audit_column_names(partition_cols_only=True),
|
|
@@ -65,7 +75,7 @@ class Audit(Command):
|
|
|
65
75
|
return {}
|
|
66
76
|
|
|
67
77
|
def cmd_list():
|
|
68
|
-
return [AuditRepairTables(), AuditRun()]
|
|
78
|
+
return [AuditRepairTables(), AuditRun(), ShowLast10(), ShowSlow10(), ShowTop10()]
|
|
69
79
|
|
|
70
80
|
def help(self, _: ReplState):
|
|
71
81
|
return f'[{Audit.COMMAND}] [<sql-statements>]\t run SQL queries on Authena audit database'
|
|
@@ -23,11 +23,16 @@ class AuditRepairTables(Command):
|
|
|
23
23
|
def command(self):
|
|
24
24
|
return AuditRepairTables.COMMAND
|
|
25
25
|
|
|
26
|
+
def required(self):
|
|
27
|
+
return ReplState.L
|
|
28
|
+
|
|
26
29
|
def run(self, cmd: str, state: ReplState):
|
|
27
30
|
if not(args := self.args(cmd)):
|
|
28
31
|
return super().run(cmd, state)
|
|
29
32
|
|
|
30
33
|
state, args = self.apply_state(args, state)
|
|
34
|
+
if not self.validate_state(state):
|
|
35
|
+
return state
|
|
31
36
|
|
|
32
37
|
tables = Config().get('audit.athena.repair-partition-tables', 'audit').split(',')
|
|
33
38
|
if args:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import concurrent
|
|
2
|
+
|
|
2
3
|
from adam.commands.command import Command
|
|
3
4
|
from adam.config import Config
|
|
4
5
|
from adam.repl_state import ReplState
|
|
@@ -21,11 +22,16 @@ class AuditRun(Command):
|
|
|
21
22
|
def command(self):
|
|
22
23
|
return AuditRun.COMMAND
|
|
23
24
|
|
|
25
|
+
def required(self):
|
|
26
|
+
return ReplState.L
|
|
27
|
+
|
|
24
28
|
def run(self, cmd: str, state: ReplState):
|
|
25
29
|
if not(args := self.args(cmd)):
|
|
26
30
|
return super().run(cmd, state)
|
|
27
31
|
|
|
28
32
|
state, args = self.apply_state(args, state)
|
|
33
|
+
if not self.validate_state(state):
|
|
34
|
+
return state
|
|
29
35
|
|
|
30
36
|
meta: AuditMeta = Audits.get_meta()
|
|
31
37
|
clusters = Audits.find_new_clusters(meta.cluster_last_checked)
|
|
@@ -35,7 +41,7 @@ class AuditRun(Command):
|
|
|
35
41
|
tables = Config().get('audit.athena.repair-cluster-tables', 'cluster').split(',')
|
|
36
42
|
with concurrent.futures.ThreadPoolExecutor(max_workers=Config().get('audit.workers', 3)) as executor:
|
|
37
43
|
for table in tables:
|
|
38
|
-
Audits.run_audit_query
|
|
44
|
+
executor.submit(Audits.run_audit_query, f'MSCK REPAIR TABLE {table}', None,)
|
|
39
45
|
else:
|
|
40
46
|
log2(f'No new clusters were found.')
|
|
41
47
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from adam.commands.audit.utils_show_top10 import extract_limit_and_duration
|
|
2
|
+
from adam.commands.command import Command
|
|
3
|
+
from adam.repl_state import ReplState
|
|
4
|
+
from adam.utils import log2
|
|
5
|
+
from adam.utils_audits import Audits
|
|
6
|
+
|
|
7
|
+
class ShowLast10(Command):
|
|
8
|
+
COMMAND = 'show last'
|
|
9
|
+
|
|
10
|
+
# the singleton pattern
|
|
11
|
+
def __new__(cls, *args, **kwargs):
|
|
12
|
+
if not hasattr(cls, 'instance'): cls.instance = super(ShowLast10, cls).__new__(cls)
|
|
13
|
+
|
|
14
|
+
return cls.instance
|
|
15
|
+
|
|
16
|
+
def __init__(self, successor: Command=None):
|
|
17
|
+
super().__init__(successor)
|
|
18
|
+
|
|
19
|
+
def command(self):
|
|
20
|
+
return ShowLast10.COMMAND
|
|
21
|
+
|
|
22
|
+
def required(self):
|
|
23
|
+
return ReplState.L
|
|
24
|
+
|
|
25
|
+
def run(self, cmd: str, state: ReplState):
|
|
26
|
+
if not(args := self.args(cmd)):
|
|
27
|
+
return super().run(cmd, state)
|
|
28
|
+
|
|
29
|
+
state, args = self.apply_state(args, state)
|
|
30
|
+
if not self.validate_state(state):
|
|
31
|
+
return state
|
|
32
|
+
|
|
33
|
+
limit, date_condition = extract_limit_and_duration(args)
|
|
34
|
+
|
|
35
|
+
query = '\n '.join([
|
|
36
|
+
"SELECT * FROM audit",
|
|
37
|
+
f"WHERE drive <> 'z' and ({date_condition})",
|
|
38
|
+
f"ORDER BY ts DESC LIMIT {limit};"])
|
|
39
|
+
log2(query)
|
|
40
|
+
log2()
|
|
41
|
+
Audits.run_audit_query(query)
|
|
42
|
+
|
|
43
|
+
return state
|
|
44
|
+
|
|
45
|
+
def completion(self, _: ReplState):
|
|
46
|
+
|
|
47
|
+
return {}
|
|
48
|
+
|
|
49
|
+
def help(self, _: ReplState):
|
|
50
|
+
return f'{ShowLast10.COMMAND} [limit]\t show last <limit> audit lines'
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from adam.commands.audit.utils_show_top10 import extract_limit_and_duration
|
|
2
|
+
from adam.commands.command import Command
|
|
3
|
+
from adam.repl_state import ReplState
|
|
4
|
+
from adam.utils import log2
|
|
5
|
+
from adam.utils_audits import Audits
|
|
6
|
+
|
|
7
|
+
class ShowSlow10(Command):
|
|
8
|
+
COMMAND = 'show slow'
|
|
9
|
+
|
|
10
|
+
# the singleton pattern
|
|
11
|
+
def __new__(cls, *args, **kwargs):
|
|
12
|
+
if not hasattr(cls, 'instance'): cls.instance = super(ShowSlow10, cls).__new__(cls)
|
|
13
|
+
|
|
14
|
+
return cls.instance
|
|
15
|
+
|
|
16
|
+
def __init__(self, successor: Command=None):
|
|
17
|
+
super().__init__(successor)
|
|
18
|
+
|
|
19
|
+
def command(self):
|
|
20
|
+
return ShowSlow10.COMMAND
|
|
21
|
+
|
|
22
|
+
def required(self):
|
|
23
|
+
return ReplState.L
|
|
24
|
+
|
|
25
|
+
def run(self, cmd: str, state: ReplState):
|
|
26
|
+
if not(args := self.args(cmd)):
|
|
27
|
+
return super().run(cmd, state)
|
|
28
|
+
|
|
29
|
+
state, args = self.apply_state(args, state)
|
|
30
|
+
if not self.validate_state(state):
|
|
31
|
+
return state
|
|
32
|
+
|
|
33
|
+
limit, date_condition = extract_limit_and_duration(args)
|
|
34
|
+
|
|
35
|
+
query = '\n '.join([
|
|
36
|
+
"SELECT * FROM audit",
|
|
37
|
+
f"WHERE drive <> 'z' and ({date_condition})",
|
|
38
|
+
f"ORDER BY CAST(duration AS REAL) DESC LIMIT {limit};"])
|
|
39
|
+
log2(query)
|
|
40
|
+
log2()
|
|
41
|
+
Audits.run_audit_query(query)
|
|
42
|
+
|
|
43
|
+
return state
|
|
44
|
+
|
|
45
|
+
def completion(self, _: ReplState):
|
|
46
|
+
return {}
|
|
47
|
+
|
|
48
|
+
def help(self, _: ReplState):
|
|
49
|
+
return f'{ShowSlow10.COMMAND} [limit]\t show slow <limit> audit lines'
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from adam.commands.audit.utils_show_top10 import extract_limit_and_duration
|
|
2
|
+
from adam.commands.command import Command
|
|
3
|
+
from adam.repl_state import ReplState
|
|
4
|
+
from adam.utils import log2
|
|
5
|
+
from adam.utils_audits import Audits
|
|
6
|
+
|
|
7
|
+
class ShowTop10(Command):
|
|
8
|
+
COMMAND = 'show top'
|
|
9
|
+
|
|
10
|
+
# the singleton pattern
|
|
11
|
+
def __new__(cls, *args, **kwargs):
|
|
12
|
+
if not hasattr(cls, 'instance'): cls.instance = super(ShowTop10, cls).__new__(cls)
|
|
13
|
+
|
|
14
|
+
return cls.instance
|
|
15
|
+
|
|
16
|
+
def __init__(self, successor: Command=None):
|
|
17
|
+
super().__init__(successor)
|
|
18
|
+
|
|
19
|
+
def command(self):
|
|
20
|
+
return ShowTop10.COMMAND
|
|
21
|
+
|
|
22
|
+
def required(self):
|
|
23
|
+
return ReplState.L
|
|
24
|
+
|
|
25
|
+
def run(self, cmd: str, state: ReplState):
|
|
26
|
+
if not(args := self.args(cmd)):
|
|
27
|
+
return super().run(cmd, state)
|
|
28
|
+
|
|
29
|
+
state, args = self.apply_state(args, state)
|
|
30
|
+
if not self.validate_state(state):
|
|
31
|
+
return state
|
|
32
|
+
|
|
33
|
+
limit, date_condition = extract_limit_and_duration(args)
|
|
34
|
+
query = '\n '.join([
|
|
35
|
+
"SELECT min(c) AS cluster, line, COUNT(*) AS cnt, avg(CAST(duration AS REAL)) AS duration",
|
|
36
|
+
f"FROM audit WHERE drive <> 'z' and ({date_condition})",
|
|
37
|
+
f"GROUP BY line ORDER BY cnt DESC LIMIT {limit};"])
|
|
38
|
+
log2(query)
|
|
39
|
+
log2()
|
|
40
|
+
Audits.run_audit_query(query)
|
|
41
|
+
|
|
42
|
+
return state
|
|
43
|
+
|
|
44
|
+
def completion(self, _: ReplState):
|
|
45
|
+
return {}
|
|
46
|
+
|
|
47
|
+
def help(self, _: ReplState):
|
|
48
|
+
return f'{ShowTop10.COMMAND} [limit]\t show top <limit> audit lines'
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
from datetime import datetime, timedelta
|
|
2
|
+
|
|
3
|
+
from adam.utils_audits import Audits
|
|
4
|
+
from adam.utils_repl.automata_completer import AutomataCompleter
|
|
5
|
+
from adam.utils_repl.state_machine import StateMachine
|
|
6
|
+
|
|
7
|
+
def extract_limit_and_duration(args: list[str]) -> tuple[int, datetime]:
|
|
8
|
+
limit = 10
|
|
9
|
+
_from = datetime.now() - timedelta(days=30)
|
|
10
|
+
if args:
|
|
11
|
+
try:
|
|
12
|
+
limit = int(args[0])
|
|
13
|
+
except:
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
if len(args) > 2 and args[1] == 'over':
|
|
17
|
+
if args[2] == 'day':
|
|
18
|
+
_from = datetime.now() - timedelta(days=1)
|
|
19
|
+
|
|
20
|
+
return (limit, Audits.date_from(_from))
|
|
21
|
+
|
|
22
|
+
def limit_and_duration_completion():
|
|
23
|
+
return {'10': {'over': {
|
|
24
|
+
'day': None,
|
|
25
|
+
'month': None
|
|
26
|
+
}}}
|
|
27
|
+
|
|
28
|
+
SHOW_TOP10_SPEC = [
|
|
29
|
+
' > show > show',
|
|
30
|
+
'show > last|slow|top > show_top ^ last,slow,top',
|
|
31
|
+
'show_top > word > show_top_n ^ 10',
|
|
32
|
+
'show_top_n > over > show_top_n_over ^ over',
|
|
33
|
+
'show_top_n_over > day|month > show_top_n_over$ ^ day,month',
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
SHOW_TOP10_KEYWORDS = [
|
|
37
|
+
'show',
|
|
38
|
+
'top',
|
|
39
|
+
'last',
|
|
40
|
+
'slow',
|
|
41
|
+
'over',
|
|
42
|
+
'day',
|
|
43
|
+
'month'
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
class ShowTop10StateMachine(StateMachine[str]):
|
|
47
|
+
def spec(self) -> str:
|
|
48
|
+
return SHOW_TOP10_SPEC
|
|
49
|
+
|
|
50
|
+
def keywords(self) -> list[str]:
|
|
51
|
+
return SHOW_TOP10_KEYWORDS
|
|
52
|
+
|
|
53
|
+
def show_top10_completions_for_nesting():
|
|
54
|
+
return {
|
|
55
|
+
'show': {
|
|
56
|
+
'last': AutomataCompleter(ShowTop10StateMachine(), first_term='show last'),
|
|
57
|
+
'slow': AutomataCompleter(ShowTop10StateMachine(), first_term='show slow'),
|
|
58
|
+
'top': AutomataCompleter(ShowTop10StateMachine(), first_term='show top'),
|
|
59
|
+
}}
|
|
@@ -23,10 +23,16 @@ class Cd(Command):
|
|
|
23
23
|
def command(self):
|
|
24
24
|
return Cd.COMMAND
|
|
25
25
|
|
|
26
|
+
def required(self):
|
|
27
|
+
return ReplState.NON_L
|
|
28
|
+
|
|
26
29
|
def run(self, cmd: str, state: ReplState):
|
|
27
30
|
if not(args := self.args(cmd)):
|
|
28
31
|
return super().run(cmd, state)
|
|
29
32
|
|
|
33
|
+
if not self.validate_state(state):
|
|
34
|
+
return state
|
|
35
|
+
|
|
30
36
|
if len(args) < 2:
|
|
31
37
|
return state
|
|
32
38
|
|
|
@@ -23,11 +23,17 @@ class Check(Issues):
|
|
|
23
23
|
def command(self):
|
|
24
24
|
return Check.COMMAND
|
|
25
25
|
|
|
26
|
+
def required(self):
|
|
27
|
+
return ReplState.NON_L
|
|
28
|
+
|
|
26
29
|
def run(self, cmd: str, state: ReplState):
|
|
27
30
|
if not(args := self.args(cmd)):
|
|
28
31
|
return super().run(cmd, state)
|
|
29
32
|
|
|
30
33
|
state, args = self.apply_state(args, state)
|
|
34
|
+
if not self.validate_state(state):
|
|
35
|
+
return state
|
|
36
|
+
|
|
31
37
|
args, show = Command.extract_options(args, ['-s', '--show'])
|
|
32
38
|
|
|
33
39
|
if not args:
|
|
@@ -28,8 +28,10 @@ class Command:
|
|
|
28
28
|
|
|
29
29
|
return None
|
|
30
30
|
|
|
31
|
-
def completion(self,
|
|
32
|
-
|
|
31
|
+
def completion(self, state: ReplState, leaf: dict[str, any] = None) -> dict[str, any]:
|
|
32
|
+
if not self.validate_state(state, show_err=False):
|
|
33
|
+
return {}
|
|
34
|
+
|
|
33
35
|
d = leaf
|
|
34
36
|
for t in reversed(self.command().split(' ')):
|
|
35
37
|
d = {t: d}
|
|
@@ -39,8 +41,8 @@ class Command:
|
|
|
39
41
|
def required(self) -> RequiredState:
|
|
40
42
|
return None
|
|
41
43
|
|
|
42
|
-
def validate_state(self, state: ReplState,
|
|
43
|
-
return state.validate(self.required(),
|
|
44
|
+
def validate_state(self, state: ReplState, show_err=True):
|
|
45
|
+
return state.validate(self.required(), show_err=show_err)
|
|
44
46
|
|
|
45
47
|
def help(self, _: ReplState) -> str:
|
|
46
48
|
return None
|
|
@@ -35,7 +35,7 @@ def tables(state: ReplState, on_any=False) -> dict[str, list[str]]:
|
|
|
35
35
|
|
|
36
36
|
return parse_cql_desc_tables(r.stdout if state.pod else r[0].stdout)
|
|
37
37
|
|
|
38
|
-
def run_cql(state: ReplState, cql: str, opts: list = [], show_out = False, use_single_quotes = False, on_any = False, background=False):
|
|
38
|
+
def run_cql(state: ReplState, cql: str, opts: list = [], show_out = False, use_single_quotes = False, on_any = False, background=False) -> list[PodExecResult]:
|
|
39
39
|
user, pw = Secrets.get_user_pass(state.sts if state.sts else state.pod, state.namespace, secret_path='cql.secret')
|
|
40
40
|
if use_single_quotes:
|
|
41
41
|
command = f"cqlsh -u {user} -p {pw} {' '.join(opts)} -e '{cql}'"
|
|
@@ -4,7 +4,7 @@ from adam.commands.command import Command
|
|
|
4
4
|
from adam.commands.deploy.deploy_pg_agent import DeployPgAgent
|
|
5
5
|
from adam.commands.deploy.deploy_pod import DeployPod
|
|
6
6
|
from .deploy_frontend import DeployFrontend
|
|
7
|
-
from adam.repl_state import ReplState
|
|
7
|
+
from adam.repl_state import ReplState, RequiredState
|
|
8
8
|
|
|
9
9
|
class Deploy(Command):
|
|
10
10
|
COMMAND = 'deploy'
|
|
@@ -22,10 +22,16 @@ class Deploy(Command):
|
|
|
22
22
|
def command(self):
|
|
23
23
|
return Deploy.COMMAND
|
|
24
24
|
|
|
25
|
+
def required(self):
|
|
26
|
+
return RequiredState.NAMESPACE
|
|
27
|
+
|
|
25
28
|
def run(self, cmd: str, state: ReplState):
|
|
26
29
|
if not(args := self.args(cmd)):
|
|
27
30
|
return super().run(cmd, state)
|
|
28
31
|
|
|
32
|
+
if not self.validate_state(state):
|
|
33
|
+
return state
|
|
34
|
+
|
|
29
35
|
return super().intermediate_run(cmd, state, args, Deploy.cmd_list())
|
|
30
36
|
|
|
31
37
|
def cmd_list():
|
|
@@ -4,7 +4,7 @@ from adam.commands.command import Command
|
|
|
4
4
|
from adam.commands.deploy.undeploy_frontend import UndeployFrontend
|
|
5
5
|
from adam.commands.deploy.undeploy_pg_agent import UndeployPgAgent
|
|
6
6
|
from adam.commands.deploy.undeploy_pod import UndeployPod
|
|
7
|
-
from adam.repl_state import ReplState
|
|
7
|
+
from adam.repl_state import ReplState, RequiredState
|
|
8
8
|
|
|
9
9
|
class Undeploy(Command):
|
|
10
10
|
COMMAND = 'undeploy'
|
|
@@ -22,10 +22,16 @@ class Undeploy(Command):
|
|
|
22
22
|
def command(self):
|
|
23
23
|
return Undeploy.COMMAND
|
|
24
24
|
|
|
25
|
+
def required(self):
|
|
26
|
+
return RequiredState.NAMESPACE
|
|
27
|
+
|
|
25
28
|
def run(self, cmd: str, state: ReplState):
|
|
26
29
|
if not(args := self.args(cmd)):
|
|
27
30
|
return super().run(cmd, state)
|
|
28
31
|
|
|
32
|
+
if not self.validate_state(state):
|
|
33
|
+
return state
|
|
34
|
+
|
|
29
35
|
return super().intermediate_run(cmd, state, args, Undeploy.cmd_list())
|
|
30
36
|
|
|
31
37
|
def cmd_list():
|
|
@@ -30,14 +30,16 @@ class Help(Command):
|
|
|
30
30
|
lines.append('NAVIGATION')
|
|
31
31
|
lines.append(' a: | c: | l: | p:\t switch to another operational device: App, Cassandra, Audit or Postgres')
|
|
32
32
|
lines.extend(section(ReplCommands.navigation()))
|
|
33
|
-
lines.append('
|
|
34
|
-
lines.extend(section(ReplCommands.cassandra_check()))
|
|
35
|
-
lines.append('CASSANDRA OPERATIONS')
|
|
33
|
+
lines.append('CASSANDRA')
|
|
36
34
|
lines.extend(section(ReplCommands.cassandra_ops()))
|
|
35
|
+
lines.append('POSTGRES')
|
|
36
|
+
lines.extend(section(ReplCommands.postgres_ops()))
|
|
37
|
+
lines.append('APP')
|
|
38
|
+
lines.extend(section(ReplCommands.app_ops()))
|
|
39
|
+
lines.append('AUDIT')
|
|
40
|
+
lines.extend(section(ReplCommands.audit_ops()))
|
|
37
41
|
lines.append('TOOLS')
|
|
38
42
|
lines.extend(section(ReplCommands.tools()))
|
|
39
|
-
lines.append('APP')
|
|
40
|
-
lines.extend(section(ReplCommands.app()))
|
|
41
43
|
lines.append('')
|
|
42
44
|
lines.extend(section(ReplCommands.exit()))
|
|
43
45
|
|
|
@@ -21,11 +21,17 @@ class Issues(Command):
|
|
|
21
21
|
def command(self):
|
|
22
22
|
return Issues.COMMAND
|
|
23
23
|
|
|
24
|
+
def required(self):
|
|
25
|
+
return ReplState.NON_L
|
|
26
|
+
|
|
24
27
|
def run(self, cmd: str, state: ReplState):
|
|
25
28
|
if not(args := self.args(cmd)):
|
|
26
29
|
return super().run(cmd, state)
|
|
27
30
|
|
|
28
31
|
state, args = self.apply_state(args, state)
|
|
32
|
+
if not self.validate_state(state):
|
|
33
|
+
return state
|
|
34
|
+
|
|
29
35
|
args, show = Command.extract_options(args, ['-s', '--show'])
|
|
30
36
|
|
|
31
37
|
results = run_checks(state.sts, state.namespace, state.pod, show_output=show)
|
|
@@ -8,7 +8,7 @@ from adam.config import Config
|
|
|
8
8
|
from adam.sso.idp import Idp
|
|
9
9
|
from adam.sso.idp_login import IdpLogin
|
|
10
10
|
from adam.commands.command import Command
|
|
11
|
-
from adam.repl_state import ReplState
|
|
11
|
+
from adam.repl_state import ReplState, RequiredState
|
|
12
12
|
from adam.utils import log, log2
|
|
13
13
|
|
|
14
14
|
class Login(Command):
|
|
@@ -26,6 +26,9 @@ class Login(Command):
|
|
|
26
26
|
def command(self):
|
|
27
27
|
return Login.COMMAND
|
|
28
28
|
|
|
29
|
+
def required(self):
|
|
30
|
+
return ReplState.NON_L
|
|
31
|
+
|
|
29
32
|
def run(self, cmd: str, state: ReplState):
|
|
30
33
|
def custom_handler(signum, frame):
|
|
31
34
|
AppSession.ctrl_c_entered = True
|
|
@@ -59,8 +62,8 @@ class Login(Command):
|
|
|
59
62
|
|
|
60
63
|
return state
|
|
61
64
|
|
|
62
|
-
def completion(self,
|
|
63
|
-
return
|
|
65
|
+
def completion(self, state: ReplState):
|
|
66
|
+
return super().completion(state)
|
|
64
67
|
|
|
65
68
|
def help(self, _: ReplState):
|
|
66
69
|
return f'{Login.COMMAND}\t SSO login'
|
|
@@ -134,13 +134,13 @@ class Ls(Command):
|
|
|
134
134
|
log(lines_to_tabular(Audits.audit_table_names(), 'NAME', separator=','))
|
|
135
135
|
|
|
136
136
|
def completion(self, state: ReplState):
|
|
137
|
-
if state.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
if state.device == ReplState.C:
|
|
138
|
+
if state.pod:
|
|
139
|
+
return super().completion(state)
|
|
140
|
+
elif not state.sts:
|
|
141
|
+
return {Ls.COMMAND: {n: None for n in StatefulSets.list_sts_names()}}
|
|
142
142
|
|
|
143
|
-
return
|
|
143
|
+
return super().completion(state)
|
|
144
144
|
|
|
145
145
|
def help(self, _: ReplState):
|
|
146
146
|
return f'{Ls.COMMAND} [device:]\t list apps, envs, clusters, nodes, pg hosts or pg databases'
|
|
@@ -22,19 +22,15 @@ class PreviewTable(Command):
|
|
|
22
22
|
return PreviewTable.COMMAND
|
|
23
23
|
|
|
24
24
|
def required(self):
|
|
25
|
-
return RequiredState.CLUSTER_OR_POD
|
|
25
|
+
return [RequiredState.CLUSTER_OR_POD, RequiredState.PG_DATABASE, ReplState.L]
|
|
26
26
|
|
|
27
27
|
def run(self, cmd: str, state: ReplState):
|
|
28
28
|
if not(args := self.args(cmd)):
|
|
29
29
|
return super().run(cmd, state)
|
|
30
30
|
|
|
31
31
|
state, args = self.apply_state(args, state)
|
|
32
|
-
if
|
|
33
|
-
|
|
34
|
-
return state
|
|
35
|
-
elif state.device != ReplState.L:
|
|
36
|
-
if not self.validate_state(state):
|
|
37
|
-
return state
|
|
32
|
+
if not self.validate_state(state):
|
|
33
|
+
return state
|
|
38
34
|
|
|
39
35
|
if not args:
|
|
40
36
|
def show_tables():
|
|
@@ -28,6 +28,8 @@ class Repair(Command):
|
|
|
28
28
|
def run(self, cmd: str, state: ReplState):
|
|
29
29
|
if not(args := self.args(cmd)):
|
|
30
30
|
return super().run(cmd, state)
|
|
31
|
+
if not self.validate_state(state):
|
|
32
|
+
return state
|
|
31
33
|
|
|
32
34
|
return super().intermediate_run(cmd, state, args, Repair.cmd_list())
|
|
33
35
|
|
|
@@ -35,9 +37,7 @@ class Repair(Command):
|
|
|
35
37
|
return [RepairRun(), RepairScan(), RepairStop(), RepairLog()]
|
|
36
38
|
|
|
37
39
|
def completion(self, state: ReplState):
|
|
38
|
-
|
|
39
|
-
return super().completion(state)
|
|
40
|
-
return {}
|
|
40
|
+
return super().completion(state)
|
|
41
41
|
|
|
42
42
|
class RepairCommandHelper(click.Command):
|
|
43
43
|
def get_help(self, ctx: click.Context):
|
|
@@ -22,12 +22,18 @@ class Report(Command):
|
|
|
22
22
|
def command(self):
|
|
23
23
|
return Report.COMMAND
|
|
24
24
|
|
|
25
|
+
def required(self):
|
|
26
|
+
return ReplState.NON_L
|
|
27
|
+
|
|
25
28
|
def run(self, cmd: str, state: ReplState):
|
|
26
29
|
if not(args := self.args(cmd)):
|
|
27
30
|
return super().run(cmd, state)
|
|
28
31
|
|
|
29
32
|
output: dict[str, any] = {}
|
|
30
33
|
state, args = self.apply_state(args, state)
|
|
34
|
+
if not self.validate_state(state):
|
|
35
|
+
return state
|
|
36
|
+
|
|
31
37
|
if state.in_repl:
|
|
32
38
|
args, show = Command.extract_options(args, ['-s', '--show'])
|
|
33
39
|
|