Skip to content

Activate pre-installed plugins listed in config(.local).yaml #147

@peterwilsoncc

Description

@peterwilsoncc

In wp:plugin the code checks if a plugin is installed and run wp plugin install --activate if it isn't. A side effect of this is that plugins listed in the plugins section of the yaml file are not activated if it is already installed.

exec { "wp install plugin $title --activate$network$held":
cwd => $location,
user => $::wp::user,
command => "/usr/bin/wp plugin install $slug --activate $held",
unless => "/usr/bin/wp plugin is-installed $slug",
require => Class["wp::cli"],
onlyif => "/usr/bin/wp core is-installed"

This can become problematic if destroying and reupping a Chassis site as plugins the developer expects to be activated on provision are not. Ideally previously installed plugins in the config file would be activated when a box is re-upped.

Running wp plugin install [previously-installed-plugin] --activate returns a success signal so it might be possible to remove the unless and have the plugins activate on reprovisioning a box. A new version of the plugin is not downloaded.

As an alternative, it might be possible to keep the unless statement but remove the --activate switch and activate the plugin as a separate step during the install.


  1. What operating system do you use? macOS Big Sur

  2. What version of Vagrant are you running? 2.2.10

  3. Are you using VirtualBox or VMWare and which version are you using? VirtualBox 6.1.16

  4. Do you have a custom YAML file? If so, what does it contain?
    (Please paste in your chassis.local.yaml file)

# Relevant section only...

# Plugins
#
# Install and activate a list of plugins from wp.org
plugins:
   - query-monitor
  1. Do you have any Chassis other extensions installed? If so, what are they?
# Instruct Chassis to use this extension.
extensions:
  - core_dev
  - mailhog
  - xdebug
  - phpunit
  - npm
  - grunt
  - nodejs
  - composer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions