WordPress / playground-tools

GNU General Public License v2.0
127 stars 38 forks source link

wp-now: repeated blueprint executions will faill #310

Open lgersman opened 2 weeks ago

lgersman commented 2 weeks ago

If i repeatedly start wp-now installing a default theme will result in an error:

```
{
    "step": "mkdir",
    "path": "/var/www/html/wp-content/themes"
},
{
    "step": "installTheme",
    "themeZipFile": {
        "resource": "wordpress.org/themes",
        "slug": "twentytwentyfour"
    },
    "options": {
        "activate": true
    }
}

```
Failed to start the server: Error when executing the blueprint step #1 installTheme({"step":"installTheme","themeZipFile":{"resource":"wordpress.org/themes","slug":"twentytwentyfour"},"options":{"activate":true}}) : Could not move /var/www/html/wp-content/mjEznHQBp+eN]u2u(C=<+NjPv4RkH7ystyI-/assets/Twentytwentyfour/twentytwentyfour to /var/www/html/wp-content/themes/twentytwentyfour: Directory not empty.

Both steps will fail when called repeatedly.

mkdir will fail the second time because the path already exists.

installTheme will fail the second time because the theme is already installed.

I suppose there should be an options to make such steps fail gracefully instead of aborting the whole blueprint process.

sejas commented 5 days ago

@lgersman , have you tried running with --reset flag? Would that fix your issue?

lgersman commented 2 days ago

Hi @sejas,

Yes, tried the --reset option too, but it doesn't changed the final outcome (an error because the directory was already existing).

BTW: Wouldn't it be neat to have a mkdir step option to gracefully continue if the directory is already existing ?