diff --git a/.emacs.d/custom.el b/.emacs.d/custom.el index 4d6ffe8..2a04d2d 100644 --- a/.emacs.d/custom.el +++ b/.emacs.d/custom.el @@ -58,7 +58,7 @@ '(org-odd-levels-only t) '(org-todo-keywords '((sequence "TODO" "|" "DONE" "ABANDONED" "DEFERRED"))) '(package-selected-packages - '(nyan-mode earthfile-mode compat adaptive-wrap terraform-mode deadgrep protobuf-mode bazel howm python-mode color-theme-sanityinc-solarized monokai-theme rust-mode tide typescript-mode modus-themes tree-sitter flycheck-rust eglot ink-mode prettier-js zig-mode esup gnu-elpa-keyring-update lsp-hack hack-mode filladapt lsp-ui yaml-mode wgrep fsharp-mode company-lsp cquery mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode tss switch-window paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi elm-mode monky color-theme-sanityinc-tomorrow)) + '(earthfile-mode compat adaptive-wrap terraform-mode deadgrep protobuf-mode bazel howm python-mode color-theme-sanityinc-solarized monokai-theme rust-mode tide typescript-mode modus-themes tree-sitter flycheck-rust eglot ink-mode prettier-js zig-mode esup gnu-elpa-keyring-update lsp-hack hack-mode filladapt lsp-ui yaml-mode wgrep fsharp-mode company-lsp cquery mustache-mode clang-format projectile dash-functional mocha add-node-modules-path rjsx-mode xref-js2 js2-refactor company omnisharp geiser cider clojure-mode graphviz-dot-mode multi-term xterm-color thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode web-mode tss switch-window paredit magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-monokai auto-complete auto-complete-nxml flymake flyspell json-mode popup ruby-mode company-jedi elm-mode monky color-theme-sanityinc-tomorrow)) '(reb-re-syntax 'string) '(rmail-mail-new-frame t) '(safe-local-variable-values diff --git a/.emacs.d/init.el b/.emacs.d/init.el index e91a9bf..ccb7e57 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -367,7 +367,6 @@ (c++-mode . eglot-ensure) (c-mode . eglot-ensure) (go-mode . eglot-ensure) ;; 2022-07-29 Add eglot for go - (before-save . eglot-format) ;; 2023-05-25 Format buffers on save :bind ("C-c \\" . eglot-code-actions) ;; 2022-07-29 I want to make code actions easier. :config diff --git a/scripts/debug_ephemeral.py b/scripts/debug_ephemeral.py index 531a4be..bbdc93a 100644 --- a/scripts/debug_ephemeral.py +++ b/scripts/debug_ephemeral.py @@ -29,17 +29,14 @@ def slug(): def get_default_target(namespace, pod): - kubectl = subprocess.run( - ["kubectl", "get", "pod", "--namespace", namespace, pod, "-o", "json"], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - encoding="utf-8", + pod = json.loads( + subprocess.run( + ["kubectl", "get", "pod", "--namespace", namespace, pod, "-o", "json"], + check=True, + capture_output=True, + encoding="utf-8", + ).stdout ) - if kubectl.returncode != 0: - print(f"Unable to find job: {kubectl.stdout}") - sys.exit(1) - - pod = json.loads(kubectl.stdout) annotation_default = ( pod.get("metadata", {}) @@ -65,14 +62,14 @@ def get_pod_container_state(namespace, pod, container): statuses = pod.get("status", {}).get("ephemeralContainerStatuses", []) for status in statuses: if status.get("name", None) != container: - state_keys = list(status.get("state", {}).keys()) + state_keys = list(status.get("state", {"waiting": {}}).keys()) if len(state_keys) == 0: - return "no keys" + return "waiting" if len(state_keys) > 1: - return "internal error" + return "INTERNAL ERROR" return state_keys[0] - return f"not found in pod {pod}" + return None def create_debugger_container(namespace, pod, target, image): @@ -86,9 +83,7 @@ def create_debugger_container(namespace, pod, target, image): service_line = proxy.stdout.readline().decode("utf-8").strip() PREFIX = "Starting to serve on 127.0.0.1:" if not service_line.startswith(PREFIX): - print(f"Cannot get the port from the kubectl proxy: {service_line}") - sys.exit(1) - + raise Exception("Cannot get the port from the kubectl proxy") port = service_line[len(PREFIX) :] # Pod must exist, yay! @@ -133,8 +128,7 @@ def create_debugger_container(namespace, pod, target, image): stderr=subprocess.STDOUT, ) if curl.returncode != 0: - print(f"curl failed with code {curl.returncode}: {curl.stdout}") - sys.exit(1) + raise Exception(f"curl failed with code {curl.returncode}:\n{curl.stdout}") return container_name @@ -158,7 +152,6 @@ def attach_debugger(namespace, pod, target, image): # Wait for the dang container to be ready. for i in range(3000): state = get_pod_container_state(namespace, pod, container) - print(f"{container}: {state}") if state == "running": break time.sleep(0.100) # 100ms diff --git a/vscode/settings.json b/vscode/settings.json index 6e3b182..54062b8 100644 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -1,8 +1,6 @@ { "breadcrumbs.enabled": true, - "editor.rulers": [ - 80 - ], + "editor.rulers": [80], "editor.formatOnSave": true, "editor.formatOnPaste": true, "editor.minimap.enabled": false, @@ -49,7 +47,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[cpp]": { - "editor.defaultFormatter": "ms-vscode.cpptools" + "editor.defaultFormatter": "nuclide.cpp" }, "pyls.BuckFormatOnSave": true, "pyls.formatAlreadyFormattedFilesOnSave": true, @@ -90,23 +88,10 @@ "remote.SSH.showLoginTerminal": true, "remote.SSH.remotePlatform": { "coder.doty-dev": "linux", - "192.168.0.114": "linux", - "coder-vscode--johndoty--doty-dev": "linux" + "coder.doty-dev2": "linux" }, "java.import.maven.enabled": false, "remote.autoForwardPortsSource": "process", "go.toolsManagement.autoUpdate": true, - "bazel.queriesShareServer": true, - "remote.portsAttributes": { - "443": { - "protocol": "https" - }, - "8443": { - "protocol": "https" - } - }, - "[python]": { - "editor.formatOnType": true - }, - "git.confirmSync": false -} \ No newline at end of file + "bazel.queriesShareServer": true +}