/
alias.pp
67 lines (63 loc) · 2.12 KB
/
alias.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# == Define Resource Type: drush::alias
#
# @param ensure
# @param alias_name
# @param group
# @param parent
# @param root
# @param uri
# @param db_url
# @param path_aliases
# @param ssh_options
# @param remote_host
# @param remote_user
# @param custom_options
# @param command_specific
# @param source_command_specific
# @param target_command_specific
#
define drush::alias (
String $ensure = present,
String $alias_name = $name,
Optional[String] $group = undef,
Optional[String] $parent = undef,
Optional[Stdlib::Absolutepath] $root = undef,
Optional[String] $uri = undef,
Optional[String] $db_url = undef,
Optional[Hash] $path_aliases = undef,
Optional[String] $ssh_options = undef,
Optional[String] $remote_host = undef,
Optional[String] $remote_user = undef,
Optional[Hash] $custom_options = undef,
Optional[Hash] $command_specific = undef,
Optional[Hash] $source_command_specific = undef,
Optional[Hash] $target_command_specific = undef,
) {
if (!defined(Class['drush'])) {
fail('You must include class drush before declaring aliases')
}
if $parent {
if $parent !~ /^@/ {
fail("Invalid parent alias '${parent}'. Parent aliases must start with @.")
}
}
$aliasfile = $group ? {
undef => '/etc/drush/aliases.drushrc.php',
default => "/etc/drush/${group}.aliases.drushrc.php",
}
if !defined(Concat[$aliasfile]) {
concat { $aliasfile:
ensure => $ensure,
}
concat::fragment { "${aliasfile}-header":
target => $aliasfile,
content => "<?php\n#MANAGED BY PUPPET!\n\n",
order => 0,
}
}
concat::fragment { "${aliasfile}-${name}":
target => $aliasfile,
content => template('drush/alias.erb'),
order => 1,
}
}