kdebug 0.3.2__tar.gz → 0.3.4__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.
- {kdebug-0.3.2 → kdebug-0.3.4}/PKG-INFO +1 -1
- {kdebug-0.3.2 → kdebug-0.3.4}/pyproject.toml +1 -1
- {kdebug-0.3.2 → kdebug-0.3.4}/src/kdebug/cli.py +21 -0
- {kdebug-0.3.2 → kdebug-0.3.4}/.gitignore +0 -0
- {kdebug-0.3.2 → kdebug-0.3.4}/README.md +0 -0
- {kdebug-0.3.2 → kdebug-0.3.4}/src/kdebug/__init__.py +0 -0
- {kdebug-0.3.2 → kdebug-0.3.4}/src/kdebug/completions/__init__.py +0 -0
- {kdebug-0.3.2 → kdebug-0.3.4}/src/kdebug/completions/_kdebug +0 -0
- {kdebug-0.3.2 → kdebug-0.3.4}/src/kdebug/completions/kdebug.bash +0 -0
- {kdebug-0.3.2 → kdebug-0.3.4}/src/kdebug/completions/kdebug.fish +0 -0
|
@@ -138,6 +138,19 @@ def get_current_namespace() -> str:
|
|
|
138
138
|
return output if output else "default"
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
def validate_cluster_connection(namespace: str) -> Optional[str]:
|
|
142
|
+
"""Validate kubectl can connect to the cluster and namespace exists.
|
|
143
|
+
|
|
144
|
+
Returns None on success, or an error message string on failure.
|
|
145
|
+
"""
|
|
146
|
+
cmd = f"{kubectl_base_cmd()} get namespace {namespace} -o name"
|
|
147
|
+
print_debug_command(cmd)
|
|
148
|
+
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
|
|
149
|
+
if result.returncode != 0:
|
|
150
|
+
return result.stderr.strip()
|
|
151
|
+
return None
|
|
152
|
+
|
|
153
|
+
|
|
141
154
|
def get_pod_by_name(pod_name: str, namespace: str) -> Optional[Dict]:
|
|
142
155
|
"""Get pod information by name."""
|
|
143
156
|
print(
|
|
@@ -450,6 +463,14 @@ def select_pod(args) -> Optional[Dict]:
|
|
|
450
463
|
"""Select a pod based on provided arguments."""
|
|
451
464
|
namespace = args.namespace or get_current_namespace()
|
|
452
465
|
|
|
466
|
+
# Validate cluster connection and namespace before proceeding
|
|
467
|
+
error = validate_cluster_connection(namespace)
|
|
468
|
+
if error:
|
|
469
|
+
print(
|
|
470
|
+
f"{colorize('✗ Error:', Colors.RED)} {error}"
|
|
471
|
+
)
|
|
472
|
+
return None
|
|
473
|
+
|
|
453
474
|
# Direct pod selection
|
|
454
475
|
if args.pod:
|
|
455
476
|
return get_pod_by_name(args.pod, namespace)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|