summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2014-06-25 12:36:21 -0400
committerMonty Taylor <mordred@inaugust.com>2014-07-05 15:58:05 -0700
commit6ca8392c2775e4a702ef604c0b7ba54e023d816f (patch)
tree31ae3704f95d2ed9d73360e937f9f9b0a0cbb678
parent593465a104d4e0e383117ba745fdd579c7a354e0 (diff)
Don't manage iptables if we're in a choot
In chroots, as with diskimage-builder, managing service starts is tricky. Also, we don't need to restart the service then, because the service will get started on boot of the image. Change-Id: Iaf90005039b8196ba3a0ac05c96d71e034f0b0b1
-rw-r--r--manifests/init.pp27
1 files changed, 18 insertions, 9 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index c7c9537..576ce16 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -23,12 +23,21 @@ class iptables(
23 name => $::iptables::params::package_name, 23 name => $::iptables::params::package_name,
24 } 24 }
25 25
26 service { 'iptables': 26 if ($::in_chroot) {
27 name => $::iptables::params::service_name, 27 notify { 'iptables in chroot':
28 require => Package['iptables'], 28 message => 'Iptables not refreshed, running in chroot',
29 hasstatus => $::iptables::params::service_has_status, 29 }
30 status => $::iptables::params::service_status_cmd, 30 $notify_iptables = []
31 hasrestart => $::iptables::params::service_has_restart, 31 }
32 else {
33 service { 'iptables':
34 name => $::iptables::params::service_name,
35 require => Package['iptables'],
36 hasstatus => $::iptables::params::service_has_status,
37 status => $::iptables::params::service_status_cmd,
38 hasrestart => $::iptables::params::service_has_restart,
39 }
40 $notify_iptables = Service['iptables']
32 } 41 }
33 42
34 file { $::iptables::params::rules_dir: 43 file { $::iptables::params::rules_dir:
@@ -49,7 +58,7 @@ class iptables(
49 File[$::iptables::params::rules_dir], 58 File[$::iptables::params::rules_dir],
50 ], 59 ],
51 # When this file is updated, make sure the rules get reloaded. 60 # When this file is updated, make sure the rules get reloaded.
52 notify => Service['iptables'], 61 notify => $notify_iptables,
53 } 62 }
54 63
55 file { $::iptables::params::ipv4_rules: 64 file { $::iptables::params::ipv4_rules:
@@ -59,7 +68,7 @@ class iptables(
59 mode => '0640', 68 mode => '0640',
60 target => "${::iptables::params::rules_dir}/rules", 69 target => "${::iptables::params::rules_dir}/rules",
61 require => File["${::iptables::params::rules_dir}/rules"], 70 require => File["${::iptables::params::rules_dir}/rules"],
62 notify => Service['iptables'], 71 notify => $notify_iptables,
63 } 72 }
64 73
65 file { $::iptables::params::ipv6_rules: 74 file { $::iptables::params::ipv6_rules:
@@ -73,7 +82,7 @@ class iptables(
73 File[$::iptables::params::rules_dir], 82 File[$::iptables::params::rules_dir],
74 ], 83 ],
75 # When this file is updated, make sure the rules get reloaded. 84 # When this file is updated, make sure the rules get reloaded.
76 notify => Service['iptables'], 85 notify => $notify_iptables,
77 replace => true, 86 replace => true,
78 } 87 }
79} 88}