uselagoon / uselagoon/lagoon-cli
"Delete environment" command should fail without both project and environment parameters
@shreddedbacon is already working on this.
Since Aug 22, 2020.
- Dominant language
- Go
- Stars
- 28
- Forks
- 14
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
Description
Describe the bug
Running lagoon delete environment without specifying both project and environment auto-selects one or both based on your current working directory, and attempts to proceed with a deletion. (i.e. shows a confirmation dialog. I haven't tested with --force.)
To Reproduce
Steps to reproduce the behaviour:
- Navigate to a lagoon-enabled repository
- Run one of:
lagoon delete environmentlagoon -p project-name delete environmentlagoon -e environment-name delete environment
- The cli offers to delete an environment, but not necessarily the one you intend
- project appears to pull from the file specified by 'docker-compose-yaml' in
.lagoon.yml - environment seems to use the current git branch name, even if there is no matching environment in a project
- project appears to pull from the file specified by 'docker-compose-yaml' in
Expected behaviour
Unless both project and environment are explicitly provided, a high-impact command like delete should fail fast with a suitable usage message. Making any assumptions based on the current working directory is risky in this context.
Screenshots
N/A
Desktop (please complete the following information):
- OS: Linux
- Browser: N/A
- Version: lagoon 0.9.2 (go version go1.13.12 linux/amd64)
Additional context
As a related side note, the lagoon delete environment syntax feels like it could/should take the target as a direct parameter, e.g.:
lagoon -p project-name delete environment environment-name
That's what I first tried ― no error was thrown, but the environment was selected incorrectly. (Leading to this report.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.