Skip to content

Commit

Permalink
Suppress kubectl command error output and disable debug printing in r…
Browse files Browse the repository at this point in the history
…un_shell_command
  • Loading branch information
vitobotta committed Jan 27, 2025
1 parent 3664b90 commit 65f546b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hetzner/instance/create.cr
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class Hetzner::Instance::Create
end

private def build_kubectl_command(instance_name)
%(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}{"\\n"}{.items[0].status.addresses[?(@.type=="ExternalIP")].address}' --field-selector metadata.name=#{instance_name})
%(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}{"\\n"}{.items[0].status.addresses[?(@.type=="ExternalIP")].address}' --field-selector metadata.name=#{instance_name} 2>/dev/null)
end

private def initialize_instance(instance_name, internal_ip, external_ip)
Expand All @@ -318,7 +318,7 @@ class Hetzner::Instance::Create

debug = ENV.fetch("DEBUG", "false") == "true"

result = run_shell_command(command, settings.kubeconfig_path, settings.hetzner_token, print_output: debug, abort_on_error: false)
result = run_shell_command(command, settings.kubeconfig_path, settings.hetzner_token, print_output: false, abort_on_error: false)

return nil unless result.success?

Expand Down

0 comments on commit 65f546b

Please sign in to comment.