dev/provisioning/modules/apache/manifests/mod/wsgi.pp
changeset 28 b0b56e0f8c7f
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
       
     1 class apache::mod::wsgi (
       
     2   $wsgi_socket_prefix = $::apache::params::wsgi_socket_prefix,
       
     3   $wsgi_python_path   = undef,
       
     4   $wsgi_python_home   = undef,
       
     5   $package_name       = undef,
       
     6   $mod_path           = undef,
       
     7 ){
       
     8 
       
     9   if ($package_name != undef and $mod_path == undef) or ($package_name == undef and $mod_path != undef) {
       
    10     fail('apache::mod::wsgi - both package_name and mod_path must be specified!')
       
    11   }
       
    12 
       
    13   if $package_name != undef {
       
    14     if $mod_path =~ /\// {
       
    15       $_mod_path = $mod_path
       
    16     } else {
       
    17       $_mod_path = "${::apache::lib_path}/${mod_path}"
       
    18     }
       
    19     ::apache::mod { 'wsgi':
       
    20       package => $package_name,
       
    21       path    => $_mod_path,
       
    22     }
       
    23   }
       
    24   else {
       
    25     ::apache::mod { 'wsgi': }
       
    26   }
       
    27 
       
    28   # Template uses:
       
    29   # - $wsgi_socket_prefix
       
    30   # - $wsgi_python_path
       
    31   # - $wsgi_python_home
       
    32   file {'wsgi.conf':
       
    33     ensure  => file,
       
    34     path    => "${::apache::mod_dir}/wsgi.conf",
       
    35     content => template('apache/mod/wsgi.conf.erb'),
       
    36     require => Exec["mkdir ${::apache::mod_dir}"],
       
    37     before  => File[$::apache::mod_dir],
       
    38     notify  => Class['apache::service'],
       
    39   }
       
    40 }
       
    41