genesis-community / genesis

A BOSH Deployment Paradigm
MIT License
56 stars 24 forks source link

Trim path from filename when generating env name #349

Closed mkb closed 4 years ago

mkb commented 5 years ago

If I genesis do ./snw-mkb-lab.yml login then the director shows up in bosh envs with the ./ at the beginning of the name.

jhunt commented 5 years ago

I'm curious what happens if you do something pathological like genesis do $PWD/snw-mkb-lab.yml login; IIRC, all Genesis does is trim off the .yml, as a courtesy to tab-completers (who aren't using paths with directories in them).

Rather than trim paths off, I'd be inclined (in this and similar cases) to push back on "cleaning up" the path for the user. As @dennisjbell mentioned in the Slack conversation, the argument to genesis do is an environment name, not a path to a file.

dennisjbell commented 4 years ago

Genesis v2.7.0 adds a convenience factor of specifying the env file as part of the -C argument, for those that want to specify a full path:

genesis -C ../bosh/c-aws-uswest1.yml do -- login

is the shorthand equivalent of

genesis -C ../bosh do c-aws-uswest1 -- login
dennisjbell commented 4 years ago

however, I do think that ./snw-mkb-lab.yml is NOT a valid environment name and should have been rejected.