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
This commit is contained in:
parent
ea9b6df992
commit
43b131e06d
@ -12,12 +12,14 @@ class mediawiki::app ($revision = 'origin/REL1_27'){
|
||||
provider => git,
|
||||
source => 'https://gerrit.wikimedia.org/r/p/mediawiki/vendor.git',
|
||||
revision => $revision,
|
||||
require => Vcsrepo['/srv/mediawiki/w'],
|
||||
}
|
||||
file { '/srv/mediawiki/w/cache':
|
||||
ensure => directory,
|
||||
recurse => true,
|
||||
owner => 'www-data',
|
||||
group => 'www-data',
|
||||
require => Vcsrepo['/srv/mediawiki/w'],
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,25 @@
|
||||
define mediawiki::extension (
|
||||
$type = 'extension',
|
||||
$ensure = latest, # keep up to date
|
||||
$source = "https://gerrit.wikimedia.org/r/p/mediawiki/${type}s/${name}.git",
|
||||
$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 => $source,
|
||||
source => $src,
|
||||
revision => $revision,
|
||||
require => Vcsrepo['/srv/mediawiki/w'],
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user