Skip to content

Commit 60790cd

Browse files
authored
Merge pull request #160 from EmersonPrado/Issue_77
[Issue #77] Move nested defined types to their own manifests
2 parents e11bf05 + 5a23de6 commit 60790cd

File tree

5 files changed

+46
-48
lines changed

5 files changed

+46
-48
lines changed

Rakefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ PuppetLint.configuration.send("disable_80chars")
55
PuppetLint.configuration.send('disable_class_parameter_defaults')
66
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
77
PuppetLint.configuration.send('disable_documentation')
8-
PuppetLint.configuration.send('disable_autoloader_layout')
9-
PuppetLint.configuration.send('disable_nested_classes_or_defines')
108
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
119
PuppetLint.configuration.fail_on_warnings = true
1210

manifests/acl.pp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,3 @@
2828
}
2929
}
3030
}
31-
32-
define varnish::acl_member(
33-
$varnish_fqdn,
34-
$acl,
35-
$host,
36-
) {
37-
unless defined(Concat::Fragment["${acl}-acl_head"]) {
38-
concat::fragment { "${acl}-acl_head":
39-
target => "${varnish::vcl::includedir}/acls.vcl",
40-
content => "acl ${acl} {\n",
41-
order => "02-${acl}-1-0",
42-
notify => Service['varnish'],
43-
} -> concat::fragment { "${acl}-acl_tail":
44-
target => "${varnish::vcl::includedir}/acls.vcl",
45-
content => "}\n",
46-
order => "02-${acl}-3-0",
47-
notify => Service['varnish'],
48-
}
49-
}
50-
$hosts = [$host]
51-
concat::fragment { "${acl}-acl_${host}":
52-
target => "${varnish::vcl::includedir}/acls.vcl",
53-
content => template('varnish/includes/acls_body.vcl.erb'),
54-
order => "02-${acl}-2-${host}",
55-
notify => Service['varnish'],
56-
}
57-
}

manifests/acl_member.pp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Defined type varnish::acl_member
2+
define varnish::acl_member(
3+
$varnish_fqdn,
4+
$acl,
5+
$host,
6+
) {
7+
unless defined(Concat::Fragment["${acl}-acl_head"]) {
8+
concat::fragment { "${acl}-acl_head":
9+
target => "${varnish::vcl::includedir}/acls.vcl",
10+
content => "acl ${acl} {\n",
11+
order => "02-${acl}-1-0",
12+
notify => Service['varnish'],
13+
} -> concat::fragment { "${acl}-acl_tail":
14+
target => "${varnish::vcl::includedir}/acls.vcl",
15+
content => "}\n",
16+
order => "02-${acl}-3-0",
17+
notify => Service['varnish'],
18+
}
19+
}
20+
$hosts = [$host]
21+
concat::fragment { "${acl}-acl_${host}":
22+
target => "${varnish::vcl::includedir}/acls.vcl",
23+
content => template('varnish/includes/acls_body.vcl.erb'),
24+
order => "02-${acl}-2-${host}",
25+
notify => Service['varnish'],
26+
}
27+
}

manifests/vcl.pp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,6 @@
6767
validate_array($unset_headers)
6868
validate_array($unset_headers_debugips)
6969

70-
# define include file type
71-
define includefile {
72-
$selectors = $varnish::vcl::selectors
73-
concat { "${varnish::vcl::includedir}/${title}.vcl":
74-
owner => 'root',
75-
group => 'root',
76-
mode => '0444',
77-
notify => Service['varnish'],
78-
require => File[$varnish::vcl::includedir],
79-
before => Exec['restart-varnish'],
80-
}
81-
82-
concat::fragment { "${title}-header":
83-
target => "${varnish::vcl::includedir}/${title}.vcl",
84-
content => "# File managed by Puppet\n",
85-
order => '01',
86-
}
87-
}
88-
8970
# select template to use
9071
if $template {
9172
$template_vcl = $template

manifests/vcl/includefile.pp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Defined type varnish::vcl::includefile
2+
#
3+
define varnish::vcl::includefile {
4+
$selectors = $varnish::vcl::selectors
5+
concat { "${varnish::vcl::includedir}/${title}.vcl":
6+
owner => 'root',
7+
group => 'root',
8+
mode => '0444',
9+
notify => Service['varnish'],
10+
require => File[$varnish::vcl::includedir],
11+
before => Exec['restart-varnish'],
12+
}
13+
14+
concat::fragment { "${title}-header":
15+
target => "${varnish::vcl::includedir}/${title}.vcl",
16+
content => "# File managed by Puppet\n",
17+
order => '01',
18+
}
19+
}

0 commit comments

Comments
 (0)