Accept default/extra features as diff class params
[integration/packaging/puppet-opendaylight.git] / manifests / init.pp
1 # == Class: opendaylight
2 #
3 # OpenDaylight SDN Controller
4 #
5 # === Parameters
6 # TODO: Update these param docs
7 # [*sample_parameter*]
8 #   Explanation of what this parameter affects and what it defaults to.
9 #
10 class opendaylight (
11   $default_features = $::opendaylight::params::default_features,
12   $extra_features = $::opendaylight::params::extra_features,
13 ) inherits ::opendaylight::params {
14
15   # Validate OS family
16   if $::osfamily != 'RedHat' {
17     fail("Unsupported OS family: ${::osfamily}")
18   }
19
20   # Validate OS
21   case $::operatingsystem {
22     centos, redhat: {
23       if $::operatingsystemmajrelease != 7 {
24         # RHEL/CentOS versions < 7 not supported as they lack systemd
25         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
26       }
27     }
28     fedora: {
29       # Fedora distros < 20 are EOL as of Jan 6th 2015
30       if ! ($::operatingsystemmajrelease in [20, 21]) {
31         fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}")
32       }
33     }
34     default: {
35       fail("Unsupported OS: ${::operatingsystem}")
36     }
37   }
38
39   # Build full list of features to install
40   $features = union($default_features, $extra_features)
41
42   class { '::opendaylight::install': } ->
43   class { '::opendaylight::config': } ~>
44   class { '::opendaylight::service': } ->
45   Class['::opendaylight']
46 }