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

Using /lagoon config add with an empty ~/.lagoon.yml file produces a panic error #331

Open
dale-c-anderson opened this issue Mar 22, 2024 · 0 comments

Comments

@dale-c-anderson
Copy link

dale-c-anderson commented Mar 22, 2024

Describe the bug
While using the uselagoon/lagoon-cli image in a gitlab CI job, we encounter the following error when trying to configure the cli:

panic: assignment to entry in nil map

This appears to happen all the way from v0.18.0 up until the current v0.21.1

To Reproduce

In the container, run

/lagoon config add --graphql $GRAPHQL_ENDPOINT --ui $UI_URL --hostname $SSH_HOST --lagoon $LAGOON --port 22 --force

(populating the shell variables with real things, obviously)

It results in:

panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/uselagoon/lagoon-cli/cmd.glob..func7(0xc00015e700?, {0x9c1242?, 0x4?, 0x9c11ee?})
	/go/src/github.com/uselagoon/lagoon-cli/cmd/config.go:169 +0x249
github.com/spf13/cobra.(*Command).execute(0xde7840, {0xc00013a580, 0xb, 0xb})
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0xabc
github.com/spf13/cobra.(*Command).ExecuteC(0xdeba60)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/uselagoon/lagoon-cli/cmd.Execute()
	/go/src/github.com/uselagoon/lagoon-cli/cmd/root.go:113 +0x1a
main.main()
	/go/src/github.com/uselagoon/lagoon-cli/main.go:8 +0xf
+ /lagoon config default --lagoon XXXX
Chosen context 'XXXX' doesn't exist in config file55 <nil>
+ /lagoon version
lagoon v0.21.1 (go1.21.8)
built 2024-03-22T03:36:21+0000
+ /lagoon config list
NAME	VERSION	GRAPHQL	SSH-HOSTNAME	SSH-PORT	SSH-KEY
+ /lagoon login
Chosen context 'amazeeio' doesn't exist in config file
+ /lagoon whoami

Expected behavior
A config entry added to ~/.lagoon.yml

Additional context

As it turns out, the error is caused by the presence of a blank ~/.lagoon.yml in the container.

Simply removing the empty config file before attempting to add a config prevents the error, and is what we're currently using as a workaround.

@dale-c-anderson dale-c-anderson changed the title Using /lagoon config add in the docker image produces a panic error Using /lagoon config add with an empty ~/.lagoon.yml file produces a panic error Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant