Puppet Class: apache::mod::wsgi

Inherits:
::apache::params
Defined in:
manifests/mod/wsgi.pp

Overview

Parameters:

  • wsgi_socket_prefix (Any) (defaults to: $::apache::params::wsgi_socket_prefix)
  • wsgi_python_path (Any) (defaults to: undef)
  • wsgi_python_home (Any) (defaults to: undef)
  • package_name (Any) (defaults to: undef)
  • mod_path (Any) (defaults to: undef)


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
# File 'manifests/mod/wsgi.pp', line 1

class apache::mod::wsgi (
  $wsgi_socket_prefix = $::apache::params::wsgi_socket_prefix,
  $wsgi_python_path   = undef,
  $wsgi_python_home   = undef,
  $package_name       = undef,
  $mod_path           = undef,
) inherits ::apache::params {
  include ::apache
  if ($package_name != undef and $mod_path == undef) or ($package_name == undef and $mod_path != undef) {
    fail('apache::mod::wsgi - both package_name and mod_path must be specified!')
  }

  if $package_name != undef {
    if $mod_path =~ /\// {
      $_mod_path = $mod_path
    } else {
      $_mod_path = "${::apache::lib_path}/${mod_path}"
    }
    ::apache::mod { 'wsgi':
      package => $package_name,
      path    => $_mod_path,
    }
  }
  else {
    ::apache::mod { 'wsgi': }
  }

  # Template uses:
  # - $wsgi_socket_prefix
  # - $wsgi_python_path
  # - $wsgi_python_home
  file {'wsgi.conf':
    ensure  => file,
    path    => "${::apache::mod_dir}/wsgi.conf",
    mode    => $::apache::file_mode,
    content => template('apache/mod/wsgi.conf.erb'),
    require => Exec["mkdir ${::apache::mod_dir}"],
    before  => File[$::apache::mod_dir],
    notify  => Class['apache::service'],
  }
}