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

Need error message when USER env variable not set #18

Closed
richarddli opened this Issue Jul 12, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@richarddli
Contributor

richarddli commented Jul 12, 2017

This is what you get when you run forge setup inside a Docker container

`

forge setup
--
  | == Checking Kubernetes Setup ==
  |  
  | CMD: kubectl version --short -> Client Version: v1.6.0
  | Server Version: v1.6.0
  | CMD: kubectl get service kubernetes --namespace default -> NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  | kubernetes 10.96.0.1 443/TCP 10m
  | Traceback (most recent call last):
  | File "/home/scrapbook/.bin/forge/bin/forge", line 11, in
  | load_entry_point('Forge==0.2.6+1.g161789d', 'console_scripts', 'forge')()
  | File "/home/scrapbook/.bin/forge/venv/local/lib/python2.7/site-packages/forge/cli.py", line 388, in call_main
  | exit(main())
  | File "/home/scrapbook/.bin/forge/venv/local/lib/python2.7/site-packages/forge/cli.py", line 350, in main
  | if args["setup"]: return forge.setup()
  | File "/home/scrapbook/.bin/forge/venv/local/lib/python2.7/site-packages/forge/cli.py", line 124, in setup
  | user = os.environ["USER"]
  | File "/home/scrapbook/.bin/forge/venv/lib/python2.7/UserDict.py", line 23, in getitem
  | raise KeyError(key)
  | KeyError: 'USER'

`

@ark3

This comment has been minimized.

ark3 commented Jul 12, 2017

FYI popular Docker images (Alpine, Ubuntu) don't set $USER by default. We should manually run a Forge smoke test inside Docker to see whether we run into other such issues.

@plombardi89

This comment has been minimized.

Contributor

plombardi89 commented Jul 12, 2017

Environment variables are just notoriously flaky in general. It's often hard to figure out what's required by (insert spec here... POSIX?) vs. what various shells include. Since Alpine and Ubuntu don't use Bash this could be a case where USER is Bashism. I've often made the mistake of using Bash only environment variables.

Further complicating matters is Windows compatibility if we ever go down that route.

@rhs rhs self-assigned this Jul 12, 2017

@rhs

This comment has been minimized.

Contributor

rhs commented Jul 12, 2017

I did a quick fix for this and made sure we have no other hard dependencies on any environment variables. I will open a separate issue for adding some smoke tests inside docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment