kubernaut icon indicating copy to clipboard operation
kubernaut copied to clipboard

Config directory needs to be created if it doesn't exist

Open kflynn opened this issue 5 years ago • 1 comments

The first time I tried to migrate from Kubernaut v1 to v2 I got this:

kubernaut config backend create --url="https://next.kubernaut.io" --name="v2" --activate $token
Traceback (most recent call last):
  File "kubernaut/cli.py", line 47, in <module>
  File "site-packages/click/core.py", line 722, in __call__
  File "site-packages/click/core.py", line 697, in main
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 1066, in invoke
  File "site-packages/click/core.py", line 895, in invoke
  File "site-packages/click/core.py", line 535, in invoke
  File "site-packages/click/decorators.py", line 27, in new_func
  File "kubernaut/config/cmd.py", line 49, in create_backend
  File "kubernaut/config/model.py", line 67, in save
  File "pathlib.py", line 1213, in write_text
  File "pathlib.py", line 1181, in open
  File "pathlib.py", line 1035, in _opener
  File "pathlib.py", line 387, in wrapped
FileNotFoundError: [Errno 2] No such file or directory: '/Users/flynn/Library/Application Support/kubernaut/config'
[63733] Failed to execute script cli

Running mkdir '/Users/flynn/Library/Application Support/kubernaut/config' solved the problem.

As an aside: should we just standardize on $HOME/.config/kubernaut like V1 did, and not use click.get_app_dir()? Aside from the fact that it feels a bit odd to me that Kubernaut is using stuff in Library/Application Support since isn't a very Mac-y application, it seems that telling everyone a single config path rather than having it be platform-specific might be convenient.

kflynn avatar Oct 30 '18 14:10 kflynn

Some conversation I had about the config location on Linux vs. macOS.

plombardi [10:53 AM]
Where does kubectl store configs on macOS?

What about other CLI's?

flynn [10:54 AM]
`kubectl` uses `~/.kube`.
In general, Macs are Unix boxes, so `~/.whatever` is still natural. The XDG thing hasn’t really migrated off Linux, I don’t think.

plombardi [10:55 AM]
Do you have a `.config` directory with anything in it besides datawire stuff? Eg is google cloud in there?

flynn [11:03 AM]
Yeah, actually I do, about half-and-half Datawire.
(fish, gcloud, gocode, xonsh, yarn are the non-d6e things)

plombardi [11:06 AM]
Aight. I'll probably just standardize on `~/.kubernaut` or `~/.config/kubernaut`. I don't want people to have to remember where it is depending on OS
Windows being the exception if we ever create one for Windows, but that's unlikely with WSL being a thing

plombardi89 avatar Oct 30 '18 15:10 plombardi89