freighthop 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +7 -0
  2. data/Puppetfile +1 -1
  3. data/Puppetfile.lock +4 -5
  4. data/README.md +18 -7
  5. data/Vagrantfile +4 -0
  6. data/lib/freighthop/cli/help.rb +1 -0
  7. data/lib/freighthop/cli/init.rb +10 -10
  8. data/lib/freighthop/cli/version.rb +17 -0
  9. data/lib/freighthop/cli.rb +3 -1
  10. data/lib/freighthop/version.rb +1 -1
  11. data/lib/freighthop.rb +4 -0
  12. data/modules/apt/CHANGELOG +2 -36
  13. data/modules/apt/Gemfile +5 -6
  14. data/modules/apt/Gemfile.lock +7 -40
  15. data/modules/apt/Modulefile +1 -1
  16. data/modules/apt/README.md +1 -2
  17. data/modules/apt/Rakefile +0 -1
  18. data/modules/apt/manifests/init.pp +2 -5
  19. data/modules/apt/manifests/params.pp +1 -4
  20. data/modules/apt/manifests/pin.pp +1 -1
  21. data/modules/apt/manifests/ppa.pp +10 -24
  22. data/modules/apt/manifests/update.pp +0 -1
  23. data/modules/apt/metadata.json +19 -32
  24. data/modules/apt/spec/defines/ppa_spec.rb +2 -53
  25. data/modules/apt/spec/defines/source_spec.rb +2 -2
  26. data/modules/apt/templates/source.list.erb +2 -2
  27. data/modules/apt/tests/key.pp +3 -3
  28. data/modules/concat/CHANGELOG +73 -0
  29. data/modules/concat/Gemfile +20 -0
  30. data/modules/concat/Gemfile.lock +104 -0
  31. data/modules/concat/Modulefile +7 -6
  32. data/modules/concat/README.md +440 -0
  33. data/modules/concat/Rakefile +5 -1
  34. data/modules/concat/files/concatfragments.rb +137 -0
  35. data/modules/concat/files/concatfragments.sh +15 -4
  36. data/modules/concat/lib/facter/concat_basedir.rb +9 -3
  37. data/modules/concat/manifests/fragment.pp +108 -48
  38. data/modules/concat/manifests/init.pp +191 -210
  39. data/modules/concat/manifests/setup.pp +31 -31
  40. data/modules/concat/metadata.json +40 -21
  41. data/modules/{apt → concat}/spec/spec_helper_system.rb +11 -6
  42. data/modules/{firewall → concat}/spec/system/basic_spec.rb +1 -1
  43. data/modules/concat/spec/system/concat_spec.rb +154 -0
  44. data/modules/concat/spec/system/deprecation_warnings_spec.rb +247 -0
  45. data/modules/concat/spec/system/empty_spec.rb +27 -0
  46. data/modules/concat/spec/system/fragment_source_spec.rb +142 -0
  47. data/modules/concat/spec/system/replace_spec.rb +257 -0
  48. data/modules/concat/spec/system/symbolic_name_spec.rb +35 -0
  49. data/modules/concat/spec/system/warn_spec.rb +106 -0
  50. data/modules/concat/spec/unit/classes/concat_setup_spec.rb +42 -0
  51. data/modules/concat/spec/unit/defines/concat_fragment_spec.rb +267 -0
  52. data/modules/concat/spec/unit/defines/concat_spec.rb +380 -0
  53. data/modules/concat/spec/unit/facts/concat_basedir_spec.rb +18 -0
  54. data/modules/concat/tests/fragment.pp +19 -0
  55. data/modules/concat/tests/init.pp +7 -0
  56. data/modules/firewall/Changelog +38 -0
  57. data/modules/firewall/Gemfile +5 -2
  58. data/modules/firewall/Gemfile.lock +76 -26
  59. data/modules/firewall/Modulefile +1 -1
  60. data/modules/firewall/README.markdown +47 -15
  61. data/modules/firewall/Rakefile +0 -7
  62. data/modules/firewall/lib/puppet/provider/firewall/ip6tables.rb +50 -7
  63. data/modules/firewall/lib/puppet/provider/firewall/iptables.rb +147 -31
  64. data/modules/firewall/lib/puppet/provider/firewallchain/iptables_chain.rb +19 -8
  65. data/modules/firewall/lib/puppet/type/firewall.rb +207 -3
  66. data/modules/firewall/lib/puppet/type/firewallchain.rb +73 -2
  67. data/modules/firewall/lib/puppet/util/firewall.rb +14 -0
  68. data/modules/firewall/metadata.json +181 -76
  69. data/modules/firewall/spec/acceptance/basic_spec.rb +8 -0
  70. data/modules/firewall/spec/acceptance/change_source_spec.rb +77 -0
  71. data/modules/firewall/spec/acceptance/class_spec.rb +27 -0
  72. data/modules/firewall/spec/acceptance/firewall_spec.rb +1608 -0
  73. data/modules/firewall/spec/acceptance/firewallchain_spec.rb +125 -0
  74. data/modules/firewall/spec/acceptance/ip6_fragment_spec.rb +94 -0
  75. data/modules/firewall/spec/acceptance/isfragment_spec.rb +92 -0
  76. data/modules/firewall/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
  77. data/modules/firewall/spec/acceptance/nodesets/centos-64-x64-fusion.yml +10 -0
  78. data/modules/firewall/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
  79. data/modules/firewall/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
  80. data/modules/firewall/spec/acceptance/nodesets/debian-607-x64.yml +10 -0
  81. data/modules/firewall/spec/acceptance/nodesets/debian-70rc1-x64.yml +10 -0
  82. data/modules/firewall/spec/acceptance/nodesets/default.yml +10 -0
  83. data/modules/firewall/spec/acceptance/nodesets/fedora-18-x64.yml +10 -0
  84. data/modules/firewall/spec/acceptance/nodesets/sles-11sp1-x64.yml +10 -0
  85. data/modules/firewall/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
  86. data/modules/firewall/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
  87. data/modules/firewall/spec/{system → acceptance}/params_spec.rb +44 -52
  88. data/modules/firewall/spec/acceptance/purge_spec.rb +124 -0
  89. data/modules/firewall/spec/acceptance/resource_cmd_spec.rb +93 -0
  90. data/modules/firewall/spec/acceptance/rules_spec.rb +248 -0
  91. data/modules/firewall/spec/acceptance/socket_spec.rb +96 -0
  92. data/modules/firewall/spec/{system → acceptance}/standard_usage_spec.rb +6 -10
  93. data/modules/firewall/spec/fixtures/ip6tables/conversion_hash.rb +107 -0
  94. data/modules/firewall/spec/fixtures/iptables/conversion_hash.rb +56 -2
  95. data/modules/firewall/spec/spec_helper_acceptance.rb +38 -0
  96. data/modules/firewall/spec/unit/classes/firewall_spec.rb +2 -2
  97. data/modules/firewall/spec/unit/facter/iptables_persistent_version_spec.rb +8 -5
  98. data/modules/firewall/spec/unit/facter/iptables_spec.rb +6 -4
  99. data/modules/firewall/spec/unit/puppet/provider/iptables_chain_spec.rb +14 -4
  100. data/modules/firewall/spec/unit/puppet/provider/iptables_spec.rb +246 -5
  101. data/modules/firewall/spec/unit/puppet/type/firewall_spec.rb +99 -8
  102. data/modules/firewall/spec/unit/puppet/type/firewallchain_spec.rb +50 -6
  103. data/modules/firewall/spec/unit/puppet/util/firewall_spec.rb +21 -0
  104. data/modules/mysql/CHANGELOG +0 -30
  105. data/modules/mysql/Gemfile +0 -1
  106. data/modules/mysql/Gemfile.lock +30 -31
  107. data/modules/mysql/Modulefile +1 -1
  108. data/modules/mysql/README.md +2 -49
  109. data/modules/mysql/files/mysqltuner.pl +1 -1
  110. data/modules/mysql/lib/puppet/provider/database/mysql.rb +1 -1
  111. data/modules/mysql/lib/puppet/provider/database_grant/mysql.rb +1 -1
  112. data/modules/mysql/lib/puppet/provider/database_user/mysql.rb +1 -1
  113. data/modules/mysql/lib/puppet/provider/mysql.rb +1 -2
  114. data/modules/mysql/lib/puppet/provider/mysql_database/mysql.rb +13 -2
  115. data/modules/mysql/lib/puppet/provider/mysql_user/mysql.rb +12 -0
  116. data/modules/mysql/lib/puppet/type/database_user.rb +1 -1
  117. data/modules/mysql/lib/puppet/type/mysql_grant.rb +3 -5
  118. data/modules/mysql/manifests/client.pp +0 -7
  119. data/modules/mysql/manifests/server/root_password.pp +0 -2
  120. data/modules/mysql/manifests/server.pp +0 -6
  121. data/modules/mysql/metadata.json +79 -81
  122. data/modules/mysql/spec/classes/mysql_server_spec.rb +0 -74
  123. data/modules/mysql/spec/system/mysql_server_root_password_spec.rb +1 -7
  124. data/modules/mysql/spec/system/mysql_server_spec.rb +3 -6
  125. data/modules/mysql/spec/system/types/mysql_grant_spec.rb +0 -27
  126. data/modules/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb +1 -1
  127. data/modules/mysql/spec/unit/puppet/provider/database/mysql_spec.rb +4 -4
  128. data/modules/mysql/spec/unit/puppet/provider/database_grant/mysql_spec.rb +15 -15
  129. data/modules/mysql/spec/unit/puppet/provider/database_user/mysql_spec.rb +4 -4
  130. data/modules/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb +3 -3
  131. data/modules/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb +3 -3
  132. data/modules/mysql/templates/my.cnf.erb +2 -4
  133. data/modules/mysql/tests/mysql_grant.pp +1 -1
  134. data/modules/postgresql/Changelog +31 -0
  135. data/modules/postgresql/Gemfile +4 -2
  136. data/modules/postgresql/Modulefile +1 -1
  137. data/modules/postgresql/README.md +10 -4
  138. data/modules/postgresql/Rakefile +0 -1
  139. data/modules/postgresql/lib/puppet/provider/postgresql_psql/ruby.rb +25 -3
  140. data/modules/postgresql/manifests/globals.pp +2 -0
  141. data/modules/postgresql/manifests/params.pp +21 -0
  142. data/modules/postgresql/manifests/server/config.pp +0 -5
  143. data/modules/postgresql/manifests/server/config_entry.pp +1 -1
  144. data/modules/postgresql/manifests/server/database.pp +2 -1
  145. data/modules/postgresql/manifests/server/db.pp +2 -0
  146. data/modules/postgresql/manifests/server/grant.pp +20 -16
  147. data/modules/postgresql/manifests/server/initdb.pp +27 -3
  148. data/modules/postgresql/manifests/server/pg_hba_rule.pp +2 -4
  149. data/modules/postgresql/manifests/server/role.pp +8 -2
  150. data/modules/postgresql/manifests/server/service.pp +5 -0
  151. data/modules/postgresql/manifests/server.pp +2 -0
  152. data/modules/postgresql/metadata.json +88 -65
  153. data/modules/postgresql/spec/acceptance/client_spec.rb +18 -0
  154. data/modules/postgresql/spec/{system → acceptance}/common_patterns_spec.rb +8 -14
  155. data/modules/postgresql/spec/{system → acceptance}/contrib_spec.rb +4 -9
  156. data/modules/postgresql/spec/acceptance/lib/devel_spec.rb +17 -0
  157. data/modules/postgresql/spec/acceptance/lib/java_spec.rb +20 -0
  158. data/modules/postgresql/spec/acceptance/lib/python_spec.rb +19 -0
  159. data/modules/postgresql/spec/acceptance/nodesets/centos-510-x64.yml +10 -0
  160. data/modules/postgresql/spec/acceptance/nodesets/centos-59-x64.yml +10 -0
  161. data/modules/postgresql/spec/acceptance/nodesets/centos-64-x64-pe.yml +12 -0
  162. data/modules/postgresql/spec/acceptance/nodesets/centos-64-x64.yml +10 -0
  163. data/modules/postgresql/spec/acceptance/nodesets/debian-607-x64.yml +10 -0
  164. data/modules/postgresql/spec/acceptance/nodesets/debian-73-x64.yml +10 -0
  165. data/modules/postgresql/spec/acceptance/nodesets/default.yml +10 -0
  166. data/modules/postgresql/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +10 -0
  167. data/modules/postgresql/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +10 -0
  168. data/modules/postgresql/spec/{system → acceptance}/postgresql_psql_spec.rb +6 -14
  169. data/modules/postgresql/spec/{system → acceptance}/server/config_entry_spec.rb +6 -12
  170. data/modules/postgresql/spec/{system → acceptance}/server/database_grant_spec.rb +6 -12
  171. data/modules/postgresql/spec/{system → acceptance}/server/database_spec.rb +6 -12
  172. data/modules/postgresql/spec/{system → acceptance}/server/db_spec.rb +47 -42
  173. data/modules/postgresql/spec/{system → acceptance}/server/grant_spec.rb +6 -12
  174. data/modules/postgresql/spec/{system → acceptance}/server/pg_hba_rule_spec.rb +10 -23
  175. data/modules/postgresql/spec/{system → acceptance}/server/plperl_spec.rb +6 -10
  176. data/modules/postgresql/spec/{system → acceptance}/server/role_spec.rb +13 -28
  177. data/modules/postgresql/spec/acceptance/server/table_grant_spec.rb +124 -0
  178. data/modules/postgresql/spec/{system → acceptance}/server/tablespace_spec.rb +8 -22
  179. data/modules/postgresql/spec/{system → acceptance}/server_spec.rb +38 -61
  180. data/modules/postgresql/spec/{system → acceptance}/validate_db_connection_spec.rb +8 -20
  181. data/modules/postgresql/spec/spec_helper_acceptance.rb +70 -0
  182. data/modules/postgresql/spec/unit/classes/globals_spec.rb +2 -2
  183. data/modules/postgresql/spec/unit/classes/lib/devel_spec.rb +1 -1
  184. data/modules/postgresql/spec/unit/classes/params_spec.rb +1 -1
  185. data/modules/postgresql/spec/unit/classes/repo_spec.rb +1 -1
  186. data/modules/postgresql/spec/unit/classes/server/initdb_spec.rb +2 -1
  187. data/modules/postgresql/spec/unit/classes/server/plperl_spec.rb +2 -2
  188. data/modules/postgresql/spec/unit/classes/server_spec.rb +9 -2
  189. data/modules/postgresql/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb +15 -17
  190. data/modules/rbenv/bin/autospec +0 -0
  191. data/modules/rbenv/bin/facter +0 -0
  192. data/modules/rbenv/bin/filebucket +0 -0
  193. data/modules/rbenv/bin/hiera +0 -0
  194. data/modules/rbenv/bin/htmldiff +0 -0
  195. data/modules/rbenv/bin/ldiff +0 -0
  196. data/modules/rbenv/bin/pi +0 -0
  197. data/modules/rbenv/bin/puppet +0 -0
  198. data/modules/rbenv/bin/puppet-lint +0 -0
  199. data/modules/rbenv/bin/puppet-module +0 -0
  200. data/modules/rbenv/bin/puppetca +0 -0
  201. data/modules/rbenv/bin/puppetd +0 -0
  202. data/modules/rbenv/bin/puppetdoc +0 -0
  203. data/modules/rbenv/bin/puppetmasterd +0 -0
  204. data/modules/rbenv/bin/puppetqd +0 -0
  205. data/modules/rbenv/bin/puppetrun +0 -0
  206. data/modules/rbenv/bin/rake +0 -0
  207. data/modules/rbenv/bin/ralsh +0 -0
  208. data/modules/rbenv/bin/rspec +0 -0
  209. data/modules/rbenv/bin/rspec-puppet-init +0 -0
  210. data/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb +0 -0
  211. data/modules/stdlib/spec/monkey_patches/publicize_methods.rb +0 -0
  212. data/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb +0 -0
  213. data/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb +0 -0
  214. data/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb +0 -0
  215. data/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb +0 -0
  216. data/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb +0 -0
  217. data/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb +0 -0
  218. data/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb +0 -0
  219. data/modules/stdlib/spec/unit/puppet/parser/functions/dirname_spec.rb +0 -0
  220. data/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb +0 -0
  221. data/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb +0 -0
  222. data/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb +0 -0
  223. data/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb +0 -0
  224. data/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb +0 -0
  225. data/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb +0 -0
  226. data/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb +0 -0
  227. data/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb +0 -0
  228. data/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb +0 -0
  229. data/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb +0 -0
  230. data/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb +0 -0
  231. data/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb +0 -0
  232. metadata +92 -77
  233. data/modules/apt/manifests/unattended_upgrades.pp +0 -68
  234. data/modules/apt/spec/classes/unattended_upgrades_spec.rb +0 -204
  235. data/modules/apt/spec/system/apt_builddep_spec.rb +0 -38
  236. data/modules/apt/spec/system/apt_key_spec.rb +0 -53
  237. data/modules/apt/spec/system/apt_ppa_spec.rb +0 -59
  238. data/modules/apt/spec/system/apt_source_spec.rb +0 -51
  239. data/modules/apt/spec/system/basic_spec.rb +0 -10
  240. data/modules/apt/spec/system/class_spec.rb +0 -20
  241. data/modules/apt/templates/10periodic.erb +0 -12
  242. data/modules/apt/templates/50unattended-upgrades.erb +0 -53
  243. data/modules/apt/tests/unattended-upgrades.pp +0 -1
  244. data/modules/concat/README.markdown +0 -150
  245. data/modules/concat/spec/defines/init_spec.rb +0 -115
  246. data/modules/concat/spec/fixtures/manifests/site.pp +0 -0
  247. data/modules/firewall/spec/spec_helper_system.rb +0 -49
  248. data/modules/firewall/spec/system/class_spec.rb +0 -39
  249. data/modules/firewall/spec/system/purge_spec.rb +0 -29
  250. data/modules/firewall/spec/system/resource_cmd_spec.rb +0 -53
  251. data/modules/mysql/manifests/server/providers.pp +0 -8
  252. data/modules/mysql/tests/bindings.pp +0 -3
  253. data/modules/postgresql/Gemfile.lock +0 -74
  254. data/modules/postgresql/spec/spec_helper_system.rb +0 -66
  255. data/modules/postgresql/spec/system/client_spec.rb +0 -22
  256. data/modules/postgresql/spec/system/lib/devel_spec.rb +0 -22
  257. data/modules/postgresql/spec/system/lib/java_spec.rb +0 -25
  258. data/modules/postgresql/spec/system/lib/python_spec.rb +0 -24
  259. data/modules/postgresql/spec/system/server/table_grant_spec.rb +0 -72
@@ -0,0 +1,440 @@
1
+ #Concat
2
+
3
+ [![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-concat.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-concat)
4
+
5
+ ####Table of Contents
6
+
7
+ 1. [Overview](#overview)
8
+ 2. [Module Description - What the module does and why it is useful](#module-description)
9
+ 3. [Setup - The basics of getting started with concat](#setup)
10
+ * [What concat affects](#what-concat-affects)
11
+ * [Setup requirements](#setup-requirements)
12
+ * [Beginning with concat](#beginning-with-concat)
13
+ 4. [Usage - Configuration options and additional functionality](#usage)
14
+ * [API _deprecations_](#api-deprecations)
15
+ 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
16
+ 5. [Limitations - OS compatibility, etc.](#limitations)
17
+ 6. [Development - Guide for contributing to the module](#development)
18
+
19
+ ##Overview
20
+
21
+ This module constructs files from multiple fragments in an ordered way.
22
+
23
+ ##Module Description
24
+
25
+ This module lets you use many concat::fragment{} resources throughout
26
+ your modules to construct a single file at the end. It does this through
27
+ a shell (or ruby) script and a temporary holding space for the fragments.
28
+
29
+ ##Setup
30
+
31
+ ###What concat affects
32
+
33
+ * Installs concatfragments.[sh|rb] based on platform.
34
+ * Adds a concat/ directory into Puppets `vardir`.
35
+
36
+ ###Beginning with concat
37
+
38
+ To start using concat you need to create:
39
+
40
+ * A concat{} resource for the final file.
41
+ * One or more concat::fragment{}'s.
42
+
43
+ A minimal example might be:
44
+
45
+ ```puppet
46
+ concat { '/tmp/file':
47
+ ensure => present,
48
+ }
49
+
50
+ concat::fragment { 'tmpfile':
51
+ target => '/tmp/file'
52
+ content => 'test contents',
53
+ order => '01'
54
+ }
55
+ ```
56
+
57
+ ##Usage
58
+
59
+ Please be aware that there have been a number of [API
60
+ _deprecations_](#api-deprecations).
61
+
62
+ If you wanted a /etc/motd file that listed all the major modules
63
+ on the machine. And that would be maintained automatically even
64
+ if you just remove the include lines for other modules you could
65
+ use code like below, a sample /etc/motd would be:
66
+
67
+ <pre>
68
+ Puppet modules on this server:
69
+
70
+ -- Apache
71
+ -- MySQL
72
+ </pre>
73
+
74
+ Local sysadmins can also append to the file by just editing /etc/motd.local
75
+ their changes will be incorporated into the puppet managed motd.
76
+
77
+ ```puppet
78
+ class motd {
79
+ $motd = '/etc/motd'
80
+
81
+ concat { $motd:
82
+ owner => 'root',
83
+ group => 'root',
84
+ mode => '0644'
85
+ }
86
+
87
+ concat::fragment{ 'motd_header':
88
+ target => $motd,
89
+ content => "\nPuppet modules on this server:\n\n",
90
+ order => '01'
91
+ }
92
+
93
+ # local users on the machine can append to motd by just creating
94
+ # /etc/motd.local
95
+ concat::fragment{ 'motd_local':
96
+ target => $motd,
97
+ source => '/etc/motd.local',
98
+ order => '15'
99
+ }
100
+ }
101
+
102
+ # used by other modules to register themselves in the motd
103
+ define motd::register($content="", $order=10) {
104
+ if $content == "" {
105
+ $body = $name
106
+ } else {
107
+ $body = $content
108
+ }
109
+
110
+ concat::fragment{ "motd_fragment_$name":
111
+ target => '/etc/motd',
112
+ content => " -- $body\n"
113
+ }
114
+ }
115
+ ```
116
+
117
+ To use this you'd then do something like:
118
+
119
+ ```puppet
120
+ class apache {
121
+ include apache::install, apache::config, apache::service
122
+
123
+ motd::register{ 'Apache': }
124
+ }
125
+ ```
126
+
127
+ ##Reference
128
+
129
+ ###Classes
130
+
131
+ ####Public classes
132
+
133
+ ####Private classes
134
+ * `concat::setup`: Sets up the concat script/directories.
135
+
136
+ ###Parameters
137
+
138
+ ###Defines
139
+
140
+ ####concat
141
+
142
+ #####`ensure`
143
+ Controls if the combined file is present or absent.
144
+
145
+ ######Example
146
+ - ensure => present
147
+ - ensure => absent
148
+
149
+ #####`path`
150
+ Controls the destination of the file to create.
151
+
152
+ ######Example
153
+ - path => '/tmp/filename'
154
+
155
+ #####`owner`
156
+ Set the owner of the combined file.
157
+
158
+ ######Example
159
+ - owner => 'root'
160
+
161
+ #####`group`
162
+ Set the group of the combined file.
163
+
164
+ ######Example
165
+ - group => 'root'
166
+
167
+ #####`mode`
168
+ Set the mode of the combined file.
169
+
170
+ ######Example
171
+ - mode => '0644'
172
+
173
+ #####`warn`
174
+ Determine if a warning message should be added at the top of the file to let
175
+ users know it was autogenerated by Puppet.
176
+
177
+ ######Example
178
+ - warn => true
179
+ - warn => false
180
+
181
+ #####`warn_message`
182
+ Set the contents of the warning message.
183
+
184
+ ######Example
185
+ - warn_message => 'This file is autogenerated!'
186
+
187
+ #####`force`
188
+ Determine if empty files are allowed when no fragments were added.
189
+
190
+ ######Example
191
+ - force => true
192
+ - force => false
193
+
194
+ #####`backup`
195
+ Controls the filebucket behavior used for the file.
196
+
197
+ ######Example
198
+ - backup => 'puppet'
199
+
200
+ #####`replace`
201
+ Controls if Puppet should replace the destination file if it already exists.
202
+
203
+ ######Example
204
+ - replace => true
205
+ - replace => false
206
+
207
+ #####`order`
208
+ Controls the way in which the shell script chooses to sort the files. It's
209
+ rare you'll need to adjust this.
210
+
211
+ ######Allowed Values
212
+ - order => 'alpha'
213
+ - order => 'numeric'
214
+
215
+ #####`ensure_newline`
216
+ Ensure there's a newline at the end of the fragments.
217
+
218
+ ######Example
219
+ - ensure_newline => true
220
+ - ensure_newline => false
221
+
222
+ ####concat::fragment
223
+
224
+ #####`target`
225
+ Choose the destination file of the fragment.
226
+
227
+ ######Example
228
+ - target => '/tmp/testfile'
229
+
230
+ #####`content`
231
+ Create the content of the fragment.
232
+
233
+ ######Example
234
+ - content => 'test file contents'
235
+
236
+ #####`source`
237
+ Find the sources within Puppet of the fragment.
238
+
239
+ ######Example
240
+ - source => 'puppet:///modules/test/testfile'
241
+ - source => ['puppet:///modules/test/1', 'puppet:///modules/test/2']
242
+
243
+ #####`order`
244
+ Order the fragments.
245
+
246
+ ######Example
247
+ - order => '01'
248
+
249
+ #####`ensure`
250
+ Control the file of fragment created.
251
+
252
+ ######Example
253
+ - ensure => 'present'
254
+ - ensure => 'absent'
255
+ - ensure => 'file'
256
+ - ensure => 'directory'
257
+
258
+ #####`mode`
259
+ Set the mode of the fragment.
260
+
261
+ ######Example
262
+ - mode => '0644'
263
+
264
+ #####`owner`
265
+ Set the owner of the fragment.
266
+
267
+ ######Example
268
+ - owner => 'root'
269
+
270
+ #####`group`
271
+ Set the group of the fragment.
272
+
273
+ ######Example
274
+ - group => 'root'
275
+
276
+ #####`backup`
277
+ Control the filebucket behavior for the fragment.
278
+
279
+ ######Example
280
+ - backup => 'puppet'
281
+
282
+ ### API _deprecations_
283
+
284
+ #### Since version `1.0.0`
285
+
286
+ ##### `concat{}` `warn` parameter
287
+
288
+ ```puppet
289
+ concat { '/tmp/file':
290
+ ensure => present,
291
+ warn => 'true', # generates stringified boolean value warning
292
+ }
293
+ ```
294
+
295
+ Using stringified Boolean values as the `warn` parameter to `concat` is
296
+ deprecated, generates a catalog compile time warning, and will be silently
297
+ treated as the concatenated file header/warning message in a future release.
298
+
299
+ The following strings are considered a stringified Boolean value:
300
+
301
+ * `'true'`
302
+ * `'yes'`
303
+ * `'on'`
304
+ * `'false'`
305
+ * `'no'`
306
+ * `'off'`
307
+
308
+ Please migrate to using the Puppet DSL's native [Boolean data
309
+ type](http://docs.puppetlabs.com/puppet/3/reference/lang_datatypes.html#booleans).
310
+
311
+ ##### `concat{}` `gnu` parameter
312
+
313
+ ```puppet
314
+ concat { '/tmp/file':
315
+ ensure => present,
316
+ gnu => $foo, # generates deprecation warning
317
+ }
318
+ ```
319
+
320
+ The `gnu` parameter to `concat` is deprecated, generates a catalog compile time
321
+ warning, and has no effect. This parameter will be removed in a future
322
+ release.
323
+
324
+ Note that this parameter was silently ignored in the `1.0.0` release.
325
+
326
+ ##### `concat::fragment{}` `ensure` parameter
327
+
328
+ ```puppet
329
+ concat::fragment { 'cpuinfo':
330
+ ensure => '/proc/cpuinfo', # generates deprecation warning
331
+ target => '/tmp/file',
332
+ }
333
+ ```
334
+
335
+ Passing a value other than `'present'` or `'absent'` as the `ensure` parameter
336
+ to `concat::fragment` is deprecated and generates a catalog compile time
337
+ warning. The warning will become a catalog compilation failure in a future
338
+ release.
339
+
340
+ This type emulates the Puppet core `file` type's disfavored [`ensure`
341
+ semantics](http://docs.puppetlabs.com/references/latest/type.html#file-attribute-ensure)
342
+ of treating a file path as a directive to create a symlink. This feature is
343
+ problematic in several ways. It copies an API semantic of another type that is
344
+ both frowned upon and not generally well known. It's behavior may be
345
+ surprising in that the target concatenated file will not be a symlink nor is
346
+ there any common file system that has a concept of a section of a plain file
347
+ being symbolically linked to another file. Additionally, the behavior is
348
+ generally inconsistent with most Puppet types in that a missing source file
349
+ will be silently ignored.
350
+
351
+ If you want to use the content of a file as a fragment please use the `source`
352
+ parameter.
353
+
354
+ ##### `concat::fragment{}` `mode/owner/group` parameters
355
+
356
+ ```puppet
357
+ concat::fragment { 'foo':
358
+ target => '/tmp/file',
359
+ content => 'foo',
360
+ mode => $mode, # generates deprecation warning
361
+ owner => $owner, # generates deprecation warning
362
+ group => $group, # generates deprecation warning
363
+ }
364
+ ```
365
+
366
+ The `mode` parameter to `concat::fragment` is deprecated, generates a catalog compile time warning, and has no effect.
367
+
368
+ The `owner` parameter to `concat::fragment` is deprecated, generates a catalog
369
+ compile time warning, and has no effect.
370
+
371
+ The `group` parameter to `concat::fragment` is deprecated, generates a catalog
372
+ compile time warning, and has no effect.
373
+
374
+ These parameters had no user visible effect in version `1.0.0` and will be
375
+ removed in a future release.
376
+
377
+ ##### `concat::fragment{}` `backup` parameter
378
+
379
+ ```puppet
380
+ concat::fragment { 'foo':
381
+ target => '/tmp/file',
382
+ content => 'foo',
383
+ backup => 'bar', # generates deprecation warning
384
+ }
385
+ ```
386
+
387
+ The `backup` parameter to `concat::fragment` is deprecated, generates a catalog
388
+ compile time warning, and has no effect. It will be removed in a future
389
+ release.
390
+
391
+ In the `1.0.0` release this parameter controlled file bucketing of the file
392
+ fragment. Bucketting the fragment(s) is redundant with bucketting the final
393
+ concatenated file and this feature has been removed.
394
+
395
+ ##### `class { 'concat::setup': }`
396
+
397
+ ```puppet
398
+ include concat::setup # generates deprecation warning
399
+
400
+ class { 'concat::setup: } # generates deprecation warning
401
+ ```
402
+
403
+ The `concat::setup` class is deprecated as a public API of this module and
404
+ should no longer be directly included in the manifest. This class may be
405
+ removed in a future release.
406
+
407
+ ##### Parameter validation
408
+
409
+ While not an API depreciation, users should be aware that all public parameters
410
+ in this module are now validated for at least variable type. This may cause
411
+ validation errors in a manifest that was previously silently misbehaving.
412
+
413
+ ##Limitations
414
+
415
+ This module has been tested on:
416
+
417
+ * RedHat Enterprise Linux (and Centos) 5/6
418
+ * Debian 6/7
419
+ * Ubuntu 12.04
420
+
421
+ Testing on other platforms has been light and cannot be guaranteed.
422
+
423
+ #Development
424
+
425
+ Puppet Labs modules on the Puppet Forge are open projects, and community
426
+ contributions are essential for keeping them great. We can’t access the
427
+ huge number of platforms and myriad of hardware, software, and deployment
428
+ configurations that Puppet is intended to serve.
429
+
430
+ We want to keep it as easy as possible to contribute changes so that our
431
+ modules work in your environment. There are a few guidelines that we need
432
+ contributors to follow so that we can have a chance of keeping on top of things.
433
+
434
+ You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing)
435
+
436
+ ###Contributors
437
+
438
+ The list of contributors can be found at:
439
+
440
+ https://github.com/puppetlabs/puppetlabs-concat/graphs/contributors
@@ -1,2 +1,6 @@
1
- require 'rubygems'
2
1
  require 'puppetlabs_spec_helper/rake_tasks'
2
+ require 'rspec-system/rake_task'
3
+ require 'puppet-lint/tasks/puppet-lint'
4
+
5
+ PuppetLint.configuration.send('disable_80chars')
6
+ PuppetLint.configuration.send('disable_quoted_booleans')
@@ -0,0 +1,137 @@
1
+ # Script to concat files to a config file.
2
+ #
3
+ # Given a directory like this:
4
+ # /path/to/conf.d
5
+ # |-- fragments
6
+ # | |-- 00_named.conf
7
+ # | |-- 10_domain.net
8
+ # | `-- zz_footer
9
+ #
10
+ # The script supports a test option that will build the concat file to a temp location and
11
+ # use /usr/bin/cmp to verify if it should be run or not. This would result in the concat happening
12
+ # twice on each run but gives you the option to have an unless option in your execs to inhibit rebuilds.
13
+ #
14
+ # Without the test option and the unless combo your services that depend on the final file would end up
15
+ # restarting on each run, or in other manifest models some changes might get missed.
16
+ #
17
+ # OPTIONS:
18
+ # -o The file to create from the sources
19
+ # -d The directory where the fragments are kept
20
+ # -t Test to find out if a build is needed, basically concats the files to a temp
21
+ # location and compare with what's in the final location, return codes are designed
22
+ # for use with unless on an exec resource
23
+ # -w Add a shell style comment at the top of the created file to warn users that it
24
+ # is generated by puppet
25
+ # -f Enables the creation of empty output files when no fragments are found
26
+ # -n Sort the output numerically rather than the default alpha sort
27
+ #
28
+ # the command:
29
+ #
30
+ # concatfragments.rb -o /path/to/conffile.cfg -d /path/to/conf.d
31
+ #
32
+ # creates /path/to/conf.d/fragments.concat and copies the resulting
33
+ # file to /path/to/conffile.cfg. The files will be sorted alphabetically
34
+ # pass the -n switch to sort numerically.
35
+ #
36
+ # The script does error checking on the various dirs and files to make
37
+ # sure things don't fail.
38
+ require 'optparse'
39
+ require 'fileutils'
40
+
41
+ settings = {
42
+ :outfile => "",
43
+ :workdir => "",
44
+ :test => false,
45
+ :force => false,
46
+ :warn => "",
47
+ :sortarg => ""
48
+ }
49
+
50
+ OptionParser.new do |opts|
51
+ opts.banner = "Usage: #{$0} [options]"
52
+ opts.separator "Specific options:"
53
+
54
+ opts.on("-o", "--outfile OUTFILE", String, "The file to create from the sources") do |o|
55
+ settings[:outfile] = o
56
+ end
57
+
58
+ opts.on("-d", "--workdir WORKDIR", String, "The directory where the fragments are kept") do |d|
59
+ settings[:workdir] = d
60
+ end
61
+
62
+ opts.on("-t", "--test", "Test to find out if a build is needed") do
63
+ settings[:test] = true
64
+ end
65
+
66
+ opts.separator "Other options:"
67
+ opts.on("-w", "--warn WARNMSG", String,
68
+ "Add a shell style comment at the top of the created file to warn users that it is generated by puppet") do |w|
69
+ settings[:warn] = w
70
+ end
71
+
72
+ opts.on("-f", "--force", "Enables the creation of empty output files when no fragments are found") do
73
+ settings[:force] = true
74
+ end
75
+
76
+ opts.on("-n", "--sort", "Sort the output numerically rather than the default alpha sort") do
77
+ settings[:sortarg] = "-n"
78
+ end
79
+ end.parse!
80
+
81
+ # do we have -o?
82
+ raise 'Please specify an output file with -o' unless !settings[:outfile].empty?
83
+
84
+ # do we have -d?
85
+ raise 'Please specify fragments directory with -d' unless !settings[:workdir].empty?
86
+
87
+ # can we write to -o?
88
+ if File.file?(settings[:outfile])
89
+ if !File.writable?(settings[:outfile])
90
+ raise "Cannot write to #{settings[:outfile]}"
91
+ end
92
+ else
93
+ if !File.writable?(File.dirname(settings[:outfile]))
94
+ raise "Cannot write to dirname #{File.dirname(settings[:outfile])} to create #{settings[:outfile]}"
95
+ end
96
+ end
97
+
98
+ # do we have a fragments subdir inside the work dir?
99
+ if !File.directory?(File.join(settings[:workdir], "fragments")) && !File.executable?(File.join(settings[:workdir], "fragments"))
100
+ raise "Cannot access the fragments directory"
101
+ end
102
+
103
+ # are there actually any fragments?
104
+ if (Dir.entries(File.join(settings[:workdir], "fragments")) - %w{ . .. }).empty?
105
+ if !settings[:force]
106
+ raise "The fragments directory is empty, cowardly refusing to make empty config files"
107
+ end
108
+ end
109
+
110
+ Dir.chdir(settings[:workdir])
111
+
112
+ if settings[:warn].empty?
113
+ File.open("fragments.concat", 'w') {|f| f.write("") }
114
+ else
115
+ File.open("fragments.concat", 'w') {|f| f.write("#{settings[:warn]}\n") }
116
+ end
117
+
118
+ # find all the files in the fragments directory, sort them numerically and concat to fragments.concat in the working dir
119
+ open('fragments.concat', 'a') do |f|
120
+ Dir.entries("fragments").sort.each{ |entry|
121
+ if File.file?(File.join("fragments", entry))
122
+ f << File.read(File.join("fragments", entry))
123
+ end
124
+ }
125
+ end
126
+
127
+ if !settings[:test]
128
+ # This is a real run, copy the file to outfile
129
+ FileUtils.cp 'fragments.concat', settings[:outfile]
130
+ else
131
+ # Just compare the result to outfile to help the exec decide
132
+ if FileUtils.cmp 'fragments.concat', settings[:outfile]
133
+ exit 0
134
+ else
135
+ exit 1
136
+ end
137
+ end
@@ -44,6 +44,7 @@ TEST=""
44
44
  FORCE=""
45
45
  WARN=""
46
46
  SORTARG=""
47
+ ENSURE_NEWLINE=""
47
48
 
48
49
  PATH=/sbin:/usr/sbin:/bin:/usr/bin
49
50
 
@@ -51,7 +52,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
51
52
  ## http://nexenta.org/projects/site/wiki/Personalities
52
53
  unset SUN_PERSONALITY
53
54
 
54
- while getopts "o:s:d:tnw:f" options; do
55
+ while getopts "o:s:d:tnw:fl" options; do
55
56
  case $options in
56
57
  o ) OUTFILE=$OPTARG;;
57
58
  d ) WORKDIR=$OPTARG;;
@@ -59,6 +60,7 @@ while getopts "o:s:d:tnw:f" options; do
59
60
  w ) WARNMSG="$OPTARG";;
60
61
  f ) FORCE="true";;
61
62
  t ) TEST="true";;
63
+ l ) ENSURE_NEWLINE="true";;
62
64
  * ) echo "Specify output file with -o and fragments directory with -d"
63
65
  exit 1;;
64
66
  esac
@@ -105,16 +107,25 @@ fi
105
107
 
106
108
  cd ${WORKDIR}
107
109
 
108
- if [ x${WARNMSG} = "x" ]; then
110
+ if [ "x${WARNMSG}" = "x" ]; then
109
111
  : > "fragments.concat"
110
112
  else
111
113
  printf '%s\n' "$WARNMSG" > "fragments.concat"
112
114
  fi
113
115
 
116
+ if [ x${ENSURE_NEWLINE} != x ]; then
117
+ find fragments/ -type f -follow -print0 | xargs -0 -I '{}' sh -c 'if [ -n "$(tail -c 1 < {} )" ]; then echo >> {} ; fi'
118
+ fi
119
+
114
120
  # find all the files in the fragments directory, sort them numerically and concat to fragments.concat in the working dir
115
- find fragments/ -type f -follow | sort ${SORTARG} | while read fragfile; do
116
- cat "$fragfile" >> "fragments.concat"
121
+ IFS_BACKUP=$IFS
122
+ IFS='
123
+ '
124
+ for fragfile in `find fragments/ -type f -follow | LC_ALL=C sort ${SORTARG}`
125
+ do
126
+ cat $fragfile >> "fragments.concat"
117
127
  done
128
+ IFS=$IFS_BACKUP
118
129
 
119
130
  if [ x${TEST} = "x" ]; then
120
131
  # This is a real run, copy the file to outfile
@@ -1,5 +1,11 @@
1
+ # == Fact: concat_basedir
2
+ #
3
+ # A custom fact that sets the default location for fragments
4
+ #
5
+ # "${::vardir}/concat/"
6
+ #
1
7
  Facter.add("concat_basedir") do
2
- setcode do
3
- File.join(Puppet[:vardir],"concat")
4
- end
8
+ setcode do
9
+ File.join(Puppet[:vardir],"concat")
10
+ end
5
11
  end