aboutsummaryrefslogtreecommitdiff
path: root/manifests/vserver/cflags.pp
blob: 43e7d2addb946851046c20f78f21bf403c50ae6d (plain)
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
define virtual::vserver::cflags($vserver, $flag, $ensure = present) {
  if ! defined(File["/etc/vservers/${vserver}/cflags"]) {
    file { "/etc/vservers/${vserver}/cflags":
      ensure  => present,
    }
  }

  line {"vs_cflags-${vserver}-${flag}":
    ensure  => $ensure,
    file    => "/etc/vservers/${vserver}/cflags",
    line    => "${flag}",
    require => Exec["vserver_instance_${vserver}"],
    notify  => Exec["vattribute-${vserver}-${flag}"],
  }

  case $ensure {
    present: {
      exec { "/usr/sbin/vattribute-${vserver}-${flag}":
        command     => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ${flag}",
        refreshonly => true, 
        require     => Exec["vserver_instance_${vserver}"],
        alias       => "vattribute-${vserver}-${flag}",
      }
    }
    default: {
      exec { "/usr/sbin/vattribute-${vserver}-${flag}":
        command     => "vattribute --set --xid `cat /etc/vservers/$vserver/context` --flag ~${flag}",
        refreshonly => true, 
        require     => Exec["vserver_instance_${vserver}"],
        alias       => "vattribute-${vserver}-${flag}",
      }
    }
  }
}