puppet-mediawiki/manifests/extension.pp
Jeremy Stanley 43b131e06d Conditionally define the default extension source
Since $type and $source are both class parameters, we can't
interpolate $type in the default definition for $source. Instead
redefine $source inside the resource if it's unchanged from the
resource default.

Also make the contents of /src/mediawiki/w require the vcsrepo
resource for it. Early creation of the directory causes vcsrepo to
fail to clone into it.

Change-Id: I9b447173d4966f03a195825047cf25afc1a4afd6
2016-09-07 19:29:00 +00:00

26 lines
754 B
Puppet

define mediawiki::extension (
$type = 'extension',
$ensure = latest, # keep up to date
$source = undef, # actual default conditionally applied below
$revision = 'origin/REL1_27',
) {
if $type != 'extension' and $type != 'skin' {
fail( '$type must be extension or skin' )
}
if $source == undef {
# Set our actual default for $source here since we can't interpolate $type
# in it for the resource parameter default
$src = "https://gerrit.wikimedia.org/r/p/mediawiki/${type}s/${name}.git"
} else {
$src = $source
}
vcsrepo { "/srv/mediawiki/w/${type}s/${name}":
ensure => $ensure,
provider => git,
source => $src,
revision => $revision,
require => Vcsrepo['/srv/mediawiki/w'],
}
}