Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Using gcloud without any parameters will crash #73

Closed
onnimonni opened this issue Jan 27, 2023 · 5 comments · Fixed by #77
Closed

bug: Using gcloud without any parameters will crash #73

onnimonni opened this issue Jan 27, 2023 · 5 comments · Fixed by #77
Labels
bug Something isn't working

Comments

@onnimonni
Copy link

Describe the bug

I have a fresh installation of MacOS and asdf on a Macbook where I have ran following:

# On MacOS 13.1 (22C65)
$ brew install asdf
$ asdf plugin add gcloud
$ asdf plugin add python
$ asdf install python 3.11.1
$ asdf install gcloud 415.0.0

I'm using fish shell with these lines in my ~/.config/fish/config.fish:

# Use asdf installed with homebrew
if type -q brew
  if type -q asdf
    source (brew --prefix asdf)/libexec/asdf.fish
  end
end

# Add fish completions from homebrew
if test -d /opt/homebrew/share/fish/vendor_completions.d
    source /opt/homebrew/share/fish/vendor_completions.d/*.fish
end
if test -d /opt/homebrew/share/fish/vendor_functions.d
    source /opt/homebrew/share/fish/vendor_functions.d/*.fish
end

When I run just bare gcloud I get following error:

$ gcloud
/opt/homebrew/opt/asdf/libexec/lib/commands/command-exec.bash: line 23: shim_args[@]: unbound variable

I would have expected to get list of all gcloud commands instead.

When I run command with parameters eg:

$ gcloud auth login

It works just fine.

I'm not sure if this is failure on my configuration but seems that something is wrong with the /opt/homebrew/opt/asdf/libexec/lib/commands/command-exec.bash

For example if I run python installed with asdf I don't get any problems:

$ which python
~/.asdf/shims/python
$ python
Python 3.11.1 (main, Jan 27 2023, 08:09:37) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

Steps to reproduce

$ asdf gcloud --version
Unknown command: `asdf gcloud --version`
No documentation for plugin gcloud

asdf version

v0.11.1

asdf-gcloud version

v1.2.2

gcloud version

415.0.0

Additional Information

No response

@onnimonni onnimonni added the bug Something isn't working label Jan 27, 2023
@onnimonni
Copy link
Author

Same thing also happens with kubectl installed through gcloud

$ kubectl
/opt/homebrew/opt/asdf/libexec/lib/commands/command-exec.bash: line 23: shim_args[@]: unbound variable

@cathex-matt
Copy link

I think the above behavior is explained here https://github.com/jthegedus/asdf-gcloud#faq

@jtama
Copy link

jtama commented May 10, 2023

Actually this IS a bug as it prevents using gke-gcloud-auth-plugin... which forces me to rollback

@sodabrew
Copy link

sodabrew commented May 18, 2023

This error prevents using gke-gcloud-auth-plugin. I removed the u from the line set -euo pipefail in .asdf/plugins/gcloud/lib/utils.bash in order to update my asdf gcloud plugin to the latest release and connect to my GKE cluster.

What would a proper fix look like that both handles no arguments and errors out on other unset variables, e.g. to catch typos during dev work?

@jtama
Copy link

jtama commented May 22, 2023

Actually sourcing the plugins as printed at install time did solve the issuer for me :

source /Users//.asdf/installs/gcloud/431.0.0/completion.zsh.inc
source /Users//.asdf/installs/gcloud/431.0.0/path.zsh.inc

Must have misses configured before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants