Skip to content
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

Duplicate project name detection and prevention #80

Open
matpratta opened this issue May 27, 2022 · 5 comments
Open

Duplicate project name detection and prevention #80

matpratta opened this issue May 27, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@matpratta
Copy link

Lando v3.6.5 here, but also happens on v3.6.4

Basically, the main issue here is that if you have two projects/directories with different recipes/plugins being used, Lando will not pick up the recipe/plugin specified in the current Landofile and not only will show you invalid commands if you run lando --help, but also will completely ignore any commands valid for the active Landofile.

Reproduction:

  1. Create directories lando-A and lando-B
  2. Initialize Laravel on lando-A
  3. Run lando --help and take note of the options, lando artisan and lando laravel should be present
  4. Initialize WordPress on lando-B
  5. Run lando --help and take note of the options, lando wp should be present
  6. You will note that in one of the cases above it won't behave correctly. Either Laravel options will show up on WordPress or vice-versa

The only thing I found that fixes this situation is going to the project directory and running lando start or lando rebuild. It seems to update some sort of cache and becomes the "current" Lando application.

A bit related, but something I noticed is that it's possible to run Lando commands such as lando laravel before starting or rebuilding the project for the first time. This leads to a bit of confusion because it will start the containers just as one would expect, but not download any CLI binaries, which will lead to an error saying the binary was not found.

Hope the report is somehow helpful, I've been using Lando for about a month now and it's a quite useful tool! Just found those small details to be a bit confusing or unexpected...

@matpratta
Copy link
Author

A quick update on this, as @gitressa pointed out in my other Issue, seems like this is caused because I had the same app name for both the WordPress and Laravel app. Maybe the app tried to cache it somehow and kept conflicting, but naming things correctly fixes the issue. Sorry, my bad.

@gitressa
Copy link

Thanks for creating this issue @MatheusMK3. It is important to not have identical names for different .lando files, since they will otherwise affect each other. But it is currently up to the user to make sure of this, which is not ideal ...

The easiest and most efficient way of starting all over with fresh Lando instances, should you ever need it again, is this method: https://docs.lando.dev/help/purging-containers.html

@labboy0276: Is it somehow possible to block the creation of a Lando instance, if the name already exists? Perhaps something like this?

$ lando init --recipe drupal9 --name my-lando-app --source cwd --webroot web
Sorry, the name my-lando-app already exists, please pick another name.

... as well as:

$ lando init
? From where should we get your app's codebase? current working directory
? What recipe do you want to use? wordpress
? Where is your webroot relative to the init destination? .
? What do you want to call this app? my-lando-app
Sorry, the name my-lando-app already exists, please pick another name.

@labboy0276
Copy link
Contributor

@gitressa I will rename this issue and make it a feature request. We are all heads down on Lando 4 stuffs now, so I don't think it will be considered for quite sometime.

@labboy0276 labboy0276 changed the title Lando not picking up correct recipe/plugin from Landofile Duplicate project name detection and prevention May 31, 2022
@labboy0276 labboy0276 added the enhancement New feature or request label May 31, 2022
@gitressa
Copy link

@labboy0276 I am looking forward to Lando 4, and agree that you should totally focus on getting that done first.

@matpratta
Copy link
Author

Glad to see this might come as an improvement! Looking forward to it!

@pirog pirog transferred this issue from lando/legacy-cli Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants