diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-09-12 12:58:45 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-09-12 12:58:45 -0300 |
commit | ed057f5ac019dd8bf523e3af9843362cbe48f80e (patch) | |
tree | c95fe4fce058d630dc69b50f4314a785bb251485 | |
parent | 2cd029f433e377b1d629cdaf7146b7e90546df33 (diff) | |
download | puppet-virtual-ed057f5ac019dd8bf523e3af9843362cbe48f80e.tar.gz puppet-virtual-ed057f5ac019dd8bf523e3af9843362cbe48f80e.tar.bz2 |
Cleanup virtual::vserver::instance
-rw-r--r-- | manifests/vserver/cflags.pp | 1 | ||||
-rw-r--r-- | manifests/vserver/instance.pp | 83 | ||||
-rw-r--r-- | manifests/vserver/rlimit.pp | 1 |
3 files changed, 41 insertions, 44 deletions
diff --git a/manifests/vserver/cflags.pp b/manifests/vserver/cflags.pp index c6df50f..43e7d2a 100644 --- a/manifests/vserver/cflags.pp +++ b/manifests/vserver/cflags.pp @@ -32,4 +32,3 @@ define virtual::vserver::cflags($vserver, $flag, $ensure = present) { } } } - diff --git a/manifests/vserver/instance.pp b/manifests/vserver/instance.pp index 3ec9130..5e6e6ae 100644 --- a/manifests/vserver/instance.pp +++ b/manifests/vserver/instance.pp @@ -24,7 +24,7 @@ define virtual::vserver::instance( false: { exec { "/usr/local/bin/build_vserver \"${vs_name}\" ${context} ${distro} ${debootstrap_mirror} ${vs_hostname} ${vs_interface} ${memory_limit}": creates => "/etc/vservers/${vs_name}", - require => File["/usr/local/bin/build_vserver","/etc/vservers/.defaults/vdirbase"], + require => File["/usr/local/bin/build_vserver", "/etc/vservers/.defaults/vdirbase"], alias => "vserver_instance_${vs_name}", # TODO: change when this is fixed: http://projects.puppetlabs.com/issues/4769 timeout => $lsbdistcodename ? { @@ -42,48 +42,47 @@ define virtual::vserver::instance( require => Exec["vserver_instance_${vs_name}"], } - case $memory_limit { - false: { - file { "/etc/vservers/${vs_name}/rlimits/rss.hard": - mode => 0644, owner => root, group => root, - ensure => absent, - } - - file { "/etc/vservers/${vs_name}/rlimits/rss.soft": - mode => 0644, owner => root, group => root, - ensure => absent, - } - - virtual::vserver::cflags { "${vs_name}-virt_mem": - vserver => $vs_name, - flag => "virt_mem", - ensure => absent, - } - } - default: { - file { "/etc/vservers/${vs_name}/rlimits/rss.hard": - mode => 0644, - owner => root, - group => root, - content => template("virtual/rss.hard.erb"), - require => File["/etc/vservers/${vs_name}/rlimits"], - } + file { "/etc/vservers/${vs_name}/rlimits/rss.hard": + mode => 0644, + owner => root, + group => root, + content => template("virtual/rss.hard.erb"), + require => $memory_limit ? { + false => undef, + default => File["/etc/vservers/${vs_name}/rlimits"], + }, + ensure => $memory_limit ? { + false => absent, + default => present, + }, + } - file { "/etc/vservers/${vs_name}/rlimits/rss.soft": - mode => 0644, - owner => root, - group => root, - content => template("virtual/rss.soft.erb"), - require => File["/etc/vservers/${vs_name}/rlimits"], - } + file { "/etc/vservers/${vs_name}/rlimits/rss.soft": + mode => 0644, + owner => root, + group => root, + content => template("virtual/rss.soft.erb"), + require => $memory_limit ? { + false => undef, + default => File["/etc/vservers/${vs_name}/rlimits"], + }, + ensure => $memory_limit ? { + false => absent, + default => present, + }, + } - vs_cflags { "${vs_name}-virt_mem": - vserver => $vs_name, - flag => "virt_mem", - ensure => present, - require => Exec["vserver_instance_${vs_name}"], - } - } + virtual::vserver::cflags { "${vs_name}-virt_mem": + vserver => $vs_name, + flag => "virt_mem", + ensure => present, + require => $memory_limit ? { + false => undef, + default => Exec["vserver_instance_${vs_name}"], + }, + ensure => $memory_limit ? { + false => absent, + default => present, + }, } } - diff --git a/manifests/vserver/rlimit.pp b/manifests/vserver/rlimit.pp index 0218359..0369750 100644 --- a/manifests/vserver/rlimit.pp +++ b/manifests/vserver/rlimit.pp @@ -45,4 +45,3 @@ define virtual::vserver::rlimit( notify => Exec["vs_restart_${vserver}"], } } - |