Colleen Murphy fa22ff35e3 Monkey-patch drush module for puppet 4
The puppet-drush module that the puppet-drupal module depends on has
some quirks on puppet 4. First, with the new ordering algorithm, it's
not guaranteed that the drush repo and the composer installation will
happen in the same order as before. We can fix that without touching the
drush module itself by creating resource orderings from the
drupal::drush class. Second, on puppet 3 the empty string '' was
interpreted as falsey, so you could expect `if '' {}` to evaluate as
false. On puppet 4, it's interpreted as truthy, and for the drush module
using '' as the default for the git_tag parameter causes the drush
$git_ref variable to be set to the empty string which causes the module
to stay on the master branch instead of checking out the 6.x branch.
There's no semantic difference between the git_branch and git_tag
parameter, so we'll just set git_tag to the same as git_branch.

Change-Id: I3acbda4edd546b4f145c9991f18ca80bb3e2171e
2018-07-23 11:58:39 -07:00

75 lines
2.5 KiB
Puppet

# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Define: drush
#
# define to add drush and custom dsd extension
#
# Drush parameters:
# - drushdsdtar: drush dsd release tarball
# - basedrushdsdtar: drush dsd tar local filename
# - download_dir: download directory, local copy of release tarball lives here
define drupal::drush (
$basedrushdsdtar = 'drush-dsd-0.10.tar.gz',
$download_dir = '/srv/downloads',
$drushdsdtar = 'https://github.com/mkissam/drush-dsd/archive/v0.10.tar.gz',
) {
# Fix the resource ordering in the drush::git::drush class
Drush::Git['https://github.com/drush-ops/drush.git'] -> Exec['Install composer']
class {'::drush::git::drush':
git_branch => '6.x',
git_tag => '6.x',
}
file { '/usr/share/drush/commands/dsd':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
require => Class['::drush::git::drush'],
}
# If we don't already have the specified dsd tar, download it.
exec { "download:${drushdsdtar}":
command => "/usr/bin/wget ${drushdsdtar} -O ${download_dir}/${basedrushdsdtar}",
creates => "${download_dir}/${basedrushdsdtar}",
require => File[$download_dir],
}
# If drush-dsd.tar.gz isn't the same as $basedrushdsdtar, install it.
file { "${download_dir}/drush-dsd.tar.gz":
ensure => present,
source => "file://${download_dir}/${basedrushdsdtar}",
require => Exec["download:${drushdsdtar}"],
replace => true,
owner => 'root',
group => 'root',
mode => '0644',
}
# If drush-dsd just created extract to /etc/drush
exec { 'drush-dsd-initial-init':
user => 'root',
command => "/bin/tar -C /usr/share/drush/commands/dsd --strip 1 -xzvf ${download_dir}/drush-dsd.tar.gz;/usr/bin/drush cc all",
subscribe => File["${download_dir}/drush-dsd.tar.gz"],
refreshonly => true,
logoutput => true,
require => File['/usr/share/drush/commands/dsd'],
}
}