Closed yermulnik closed 9 months ago
> fgrep -w VERSION /etc/os-release
VERSION="22.04.3 LTS (Jammy Jellyfish)"
and
> fgrep -w VERSION /etc/os-release
VERSION="19.3 (Tricia)"
ps: the latter is a bit outdated though is for the sake of example
Similar here:
[~]% target vault create [name] --endpoint "https://vault.[hidden].com" --token "hvs.[hidden]" --namespace "secrets"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x100847fa8]
goroutine 1 [running]:
github.com/devops-rob/target-cli/cmd.glob..func52(0x100b3ba20, {0x14000229110, 0x1, 0x7})
/home/runner/work/target-cli/target-cli/cmd/vaultcreate.go:25 +0x28
github.com/spf13/cobra.(*Command).execute(0x100b3ba20, {0x140002290a0, 0x7, 0x7})
/home/runner/work/target-cli/target-cli/vendor/github.com/spf13/cobra/command.go:944 +0x70c
github.com/spf13/cobra.(*Command).ExecuteC(0x100b394c0)
/home/runner/work/target-cli/target-cli/vendor/github.com/spf13/cobra/command.go:1068 +0x41c
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/work/target-cli/target-cli/vendor/github.com/spf13/cobra/command.go:992
github.com/devops-rob/target-cli/cmd.Execute()
/home/runner/work/target-cli/target-cli/cmd/root.go:146 +0x30
main.main()
/home/runner/work/target-cli/target-cli/main.go:6 +0x20
[~]% uname -a
Darwin mac06770 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64 arm Darwin
[~]% sw_vers
ProductName: macOS
ProductVersion: 14.2.1
BuildVersion: 23C71
I also stumbled upon this. Looks like it's related to the following (global config variable used by the CLI):
It hits this case:
But doesn't set the global config variable (c
), because it never hits this:
For context (pun intended), my configuration file contains:
$ cat ~/.target/profiles.json
{
"vault": {},
"consul": {},
"nomad": {}
"terraform": {}
}
💡 We need to remove the else
it is wrapped in in order for things to then ultimately flow properly into that global variable.
The error is in https://github.com/devops-rob/target-cli/blob/main/pkg/targetdir/targetdir.go#L29 which generates a malformed profiles.json
.
The document misses a comma at the end of the nomad line. Fixing the json made the command works.
Fixing the json made the command works.
Yay! I can confirm the fix. Thanks.
Any
list
command fails with the below: