dev/provisioning/modules/drush/manifests/alias.pp
changeset 357 e3b168fa7513
parent 353 bf1bc6b08c46
equal deleted inserted replaced
356:139bf74b9374 357:e3b168fa7513
       
     1 define drush::alias(
       
     2   $ensure                  = present,
       
     3   $alias_name              = $name,
       
     4   $group                   = undef,
       
     5   $parent                  = undef,
       
     6   $root                    = undef,
       
     7   $uri                     = undef,
       
     8   $db_url                  = undef,
       
     9   $path_aliases            = undef,
       
    10   $ssh_options             = undef,
       
    11   $remote_host             = undef,
       
    12   $remote_user             = undef,
       
    13   $custom_options          = undef,
       
    14   $command_specific        = undef,
       
    15   $source_command_specific = undef,
       
    16   $target_command_specific = undef,
       
    17 ) {
       
    18 
       
    19   if (!defined(Class['drush'])) {
       
    20     fail('You must include class drush before declaring aliases')
       
    21   }
       
    22 
       
    23   if $root {
       
    24     validate_absolute_path($root)
       
    25   }
       
    26   if $parent {
       
    27     validate_re($parent, '^@',
       
    28     "Invalid parent alias '${parent}'. Parent aliases must start with @.")
       
    29   }
       
    30   if $custom_options {
       
    31     validate_hash($custom_options)
       
    32   }
       
    33   if $command_specific {
       
    34     validate_hash($command_specific)
       
    35   }
       
    36 
       
    37   $aliasfile = $group ? {
       
    38     undef   => '/etc/drush/aliases.drushrc.php',
       
    39     default => "/etc/drush/${group}.aliases.drushrc.php",
       
    40   }
       
    41 
       
    42   if !defined(Concat[$aliasfile]) {
       
    43     concat{ $aliasfile:
       
    44       ensure => $ensure,
       
    45     }
       
    46     concat::fragment { "${aliasfile}-header":
       
    47       target  => $aliasfile,
       
    48       content => "<?php\n#MANAGED BY PUPPET!\n\n",
       
    49       order   => 0,
       
    50     }
       
    51   }
       
    52 
       
    53   concat::fragment { "${aliasfile}-${name}":
       
    54     target  => $aliasfile,
       
    55     content => template('drush/alias.erb'),
       
    56     order   => 1,
       
    57   }
       
    58 
       
    59 }
       
    60