rmccue/puppet-wp — pull request #17 by zamoose (2014-01-17 14:53:32+00:00)
Title: Defined type duplication fix

No idea where else this might occur -- I'm thinking `theme.pp` might also have something similar, in which case I'll look to fix.

Long and short of it, though, is that you need to allow defined types to have unique resource names. Using `$title` as your Wp::Plugin `$name` means that anything downstream trying to define multiple Plugins runs into [this issue](http://docs.puppetlabs.com/learning/definedtypes.html#special-little-flowers), *hard*. Adding another parameter, `$slug`, allows us to sidestep this.

This is particularly important if you're provisioning several VirtualHosts/sites on a single install and you want identical plugin loadouts.

This change allows me to do the following:

```
wp::plugin {
#	[ "developer", "theme-check", "monster-widget", "debogger", "log-deprecated-notices",
#	"debug-bar" ]:
"${install_path} Developer":
slug	=> "developer",
location	=> "$install_path",
require	=> Wp::Site[$install_path];
"${install_path} Theme Check":
slug	=> "theme-check",
location	=> "$install_path",
require	=> Wp::Site[$install_path];
}
```

The commented-out invocation previously caused errors like

```
Error: Duplicate declaration: Exec[wp install plugin developer] is already declared in file /tmp/vagrant-puppet-1/modules-0/wp/manifests/plugin.pp at line 20; cannot redeclare on node localhost.localdomain
Error: Duplicate declaration: Exec[wp install plugin developer] is already declared in file /tmp/vagrant-puppet-1/modules-0/wp/manifests/plugin.pp at line 20; cannot redeclare on node localhost.localdomain
```

on my Vagrant builds.