bebox 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +78 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +163 -0
  5. data/LICENSE +21 -0
  6. data/README.md +372 -0
  7. data/Rakefile +8 -0
  8. data/bebox.gemspec +40 -0
  9. data/bin/bebox +5 -0
  10. data/lib/bebox/cli.rb +42 -0
  11. data/lib/bebox/commands/commands_helper.rb +33 -0
  12. data/lib/bebox/commands/environment_commands.rb +46 -0
  13. data/lib/bebox/commands/general_commands.rb +24 -0
  14. data/lib/bebox/commands/node_commands.rb +68 -0
  15. data/lib/bebox/commands/prepare_commands.rb +59 -0
  16. data/lib/bebox/commands/project_commands.rb +44 -0
  17. data/lib/bebox/commands/provision_commands.rb +145 -0
  18. data/lib/bebox/environment.rb +114 -0
  19. data/lib/bebox/logger.rb +51 -0
  20. data/lib/bebox/node.rb +308 -0
  21. data/lib/bebox/profile.rb +102 -0
  22. data/lib/bebox/project.rb +259 -0
  23. data/lib/bebox/provision.rb +257 -0
  24. data/lib/bebox/role.rb +103 -0
  25. data/lib/bebox/version.rb +3 -0
  26. data/lib/bebox/wizards/environment_wizard.rb +45 -0
  27. data/lib/bebox/wizards/node_wizard.rb +163 -0
  28. data/lib/bebox/wizards/profile_wizard.rb +91 -0
  29. data/lib/bebox/wizards/project_wizard.rb +175 -0
  30. data/lib/bebox/wizards/provision_wizard.rb +80 -0
  31. data/lib/bebox/wizards/role_wizard.rb +97 -0
  32. data/lib/bebox.rb +2 -0
  33. data/lib/deb/puppet_3.6.0/augeas-lenses_0.10.0-0ubuntu4_all.deb +0 -0
  34. data/lib/deb/puppet_3.6.0/debconf-utils_1.5.42ubuntu1_all.deb +0 -0
  35. data/lib/deb/puppet_3.6.0/facter_2.0.1-1puppetlabs1_amd64.deb +0 -0
  36. data/lib/deb/puppet_3.6.0/hiera_1.3.2-1puppetlabs1_all.deb +0 -0
  37. data/lib/deb/puppet_3.6.0/libaugeas-ruby1.8_0.3.0-1.1ubuntu4_amd64.deb +0 -0
  38. data/lib/deb/puppet_3.6.0/libaugeas-ruby_0.3.0-1.1ubuntu4_all.deb +0 -0
  39. data/lib/deb/puppet_3.6.0/libaugeas0_0.10.0-0ubuntu4_amd64.deb +0 -0
  40. data/lib/deb/puppet_3.6.0/libjson-ruby_1.6.3-1_all.deb +0 -0
  41. data/lib/deb/puppet_3.6.0/libruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
  42. data/lib/deb/puppet_3.6.0/libruby_4.8_all.deb +0 -0
  43. data/lib/deb/puppet_3.6.0/libshadow-ruby1.8_1.4.1-8build1_amd64.deb +0 -0
  44. data/lib/deb/puppet_3.6.0/puppet-common_3.6.0-1puppetlabs1_all.deb +0 -0
  45. data/lib/deb/puppet_3.6.0/puppet_3.6.0-1puppetlabs1_all.deb +0 -0
  46. data/lib/deb/puppet_3.6.0/ruby-json_1.6.3-1_amd64.deb +0 -0
  47. data/lib/deb/puppet_3.6.0/ruby-rgen_0.6.5-1puppetlabs1_all.deb +0 -0
  48. data/lib/deb/puppet_3.6.0/ruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
  49. data/lib/deb/puppet_3.6.0/ruby_4.8_all.deb +0 -0
  50. data/lib/deb/puppet_3.6.0/virt-what_1.11-1_amd64.deb +0 -0
  51. data/lib/templates/node/Vagrantfile.erb +18 -0
  52. data/lib/templates/node/deploy_vagrant_node.erb +3 -0
  53. data/lib/templates/node/node.yml.erb +3 -0
  54. data/lib/templates/node/prepared_node.yml.erb +4 -0
  55. data/lib/templates/node/provisioned_node.yml.erb +4 -0
  56. data/lib/templates/project/Capfile.erb +2 -0
  57. data/lib/templates/project/Gemfile.erb +5 -0
  58. data/lib/templates/project/config/deploy/environment.erb +40 -0
  59. data/lib/templates/project/config/deploy/vagrant.erb +42 -0
  60. data/lib/templates/project/config/deploy.erb +120 -0
  61. data/lib/templates/project/dot_bebox.erb +4 -0
  62. data/lib/templates/project/gitignore.erb +7 -0
  63. data/lib/templates/project/ubuntu_dependencies +10 -0
  64. data/lib/templates/puppet/default_profiles/base/fundamental/ruby/Puppetfile +0 -0
  65. data/lib/templates/puppet/default_profiles/base/fundamental/ruby/manifests/init.pp +24 -0
  66. data/lib/templates/puppet/default_profiles/base/fundamental/sudo/Puppetfile +0 -0
  67. data/lib/templates/puppet/default_profiles/base/fundamental/sudo/manifests/init.pp +22 -0
  68. data/lib/templates/puppet/default_profiles/base/fundamental/users/Puppetfile +0 -0
  69. data/lib/templates/puppet/default_profiles/base/fundamental/users/manifests/init.pp +18 -0
  70. data/lib/templates/puppet/default_profiles/base/security/fail2ban/Puppetfile +2 -0
  71. data/lib/templates/puppet/default_profiles/base/security/fail2ban/manifests/init.pp +28 -0
  72. data/lib/templates/puppet/default_profiles/base/security/iptables/Puppetfile +2 -0
  73. data/lib/templates/puppet/default_profiles/base/security/iptables/manifests/init.pp +27 -0
  74. data/lib/templates/puppet/default_profiles/base/security/ssh/Puppetfile +2 -0
  75. data/lib/templates/puppet/default_profiles/base/security/ssh/manifests/init.pp +30 -0
  76. data/lib/templates/puppet/default_profiles/base/security/sysctl/Puppetfile +2 -0
  77. data/lib/templates/puppet/default_profiles/base/security/sysctl/manifests/init.pp +20 -0
  78. data/lib/templates/puppet/default_profiles/base/users/ssh/Puppetfile +2 -0
  79. data/lib/templates/puppet/default_profiles/base/users/ssh/manifests/init.pp +47 -0
  80. data/lib/templates/puppet/default_profiles/base/users/users/Puppetfile +0 -0
  81. data/lib/templates/puppet/default_profiles/base/users/users/manifests/init.pp +18 -0
  82. data/lib/templates/puppet/default_roles/fundamental/manifests/init.pp +16 -0
  83. data/lib/templates/puppet/default_roles/security/manifests/init.pp +17 -0
  84. data/lib/templates/puppet/default_roles/users/manifests/init.pp +15 -0
  85. data/lib/templates/puppet/profiles/Puppetfile.erb +24 -0
  86. data/lib/templates/puppet/profiles/manifests/init.pp.erb +17 -0
  87. data/lib/templates/puppet/roles/manifests/init.pp.erb +14 -0
  88. data/lib/templates/puppet/step-0/Puppetfile.erb +5 -0
  89. data/lib/templates/puppet/step-0/hiera/data/common.yaml.erb +26 -0
  90. data/lib/templates/puppet/step-0/hiera/data/environment.yaml.erb +26 -0
  91. data/lib/templates/puppet/step-0/hiera/data/node.yaml.erb +26 -0
  92. data/lib/templates/puppet/step-0/hiera/hiera.yaml.erb +11 -0
  93. data/lib/templates/puppet/step-0/manifests/node.erb +5 -0
  94. data/lib/templates/puppet/step-0/manifests/site.pp.erb +15 -0
  95. data/lib/templates/puppet/step-0/modules/rbenv/AUTHORS +11 -0
  96. data/lib/templates/puppet/step-0/modules/rbenv/CHANGELOG.md +70 -0
  97. data/lib/templates/puppet/step-0/modules/rbenv/Gemfile +8 -0
  98. data/lib/templates/puppet/step-0/modules/rbenv/Gemfile.lock +28 -0
  99. data/lib/templates/puppet/step-0/modules/rbenv/Modulefile +7 -0
  100. data/lib/templates/puppet/step-0/modules/rbenv/README.md +173 -0
  101. data/lib/templates/puppet/step-0/modules/rbenv/Rakefile +22 -0
  102. data/lib/templates/puppet/step-0/modules/rbenv/TODO +10 -0
  103. data/lib/templates/puppet/step-0/modules/rbenv/bin/autospec +16 -0
  104. data/lib/templates/puppet/step-0/modules/rbenv/bin/facter +16 -0
  105. data/lib/templates/puppet/step-0/modules/rbenv/bin/filebucket +16 -0
  106. data/lib/templates/puppet/step-0/modules/rbenv/bin/hiera +16 -0
  107. data/lib/templates/puppet/step-0/modules/rbenv/bin/htmldiff +16 -0
  108. data/lib/templates/puppet/step-0/modules/rbenv/bin/ldiff +16 -0
  109. data/lib/templates/puppet/step-0/modules/rbenv/bin/pi +16 -0
  110. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet +16 -0
  111. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-lint +16 -0
  112. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-module +16 -0
  113. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetca +16 -0
  114. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetd +16 -0
  115. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetdoc +16 -0
  116. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetmasterd +16 -0
  117. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetqd +16 -0
  118. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetrun +16 -0
  119. data/lib/templates/puppet/step-0/modules/rbenv/bin/rake +16 -0
  120. data/lib/templates/puppet/step-0/modules/rbenv/bin/ralsh +16 -0
  121. data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec +16 -0
  122. data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec-puppet-init +16 -0
  123. data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +50 -0
  124. data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/type/rbenvgem.rb +62 -0
  125. data/lib/templates/puppet/step-0/modules/rbenv/manifests/bundle.pp +36 -0
  126. data/lib/templates/puppet/step-0/modules/rbenv/manifests/client.pp +48 -0
  127. data/lib/templates/puppet/step-0/modules/rbenv/manifests/compile.pp +102 -0
  128. data/lib/templates/puppet/step-0/modules/rbenv/manifests/definition.pp +31 -0
  129. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/centos.pp +25 -0
  130. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/suse.pp +28 -0
  131. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/ubuntu.pp +17 -0
  132. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies.pp +8 -0
  133. data/lib/templates/puppet/step-0/modules/rbenv/manifests/gem.pp +29 -0
  134. data/lib/templates/puppet/step-0/modules/rbenv/manifests/install.pp +55 -0
  135. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rbenvvars.pp +16 -0
  136. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rubybuild.pp +16 -0
  137. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin.pp +40 -0
  138. data/lib/templates/puppet/step-0/modules/rbenv/metadata.json +109 -0
  139. data/lib/templates/puppet/step-0/modules/rbenv/templates/Gemfile.erb +5 -0
  140. data/lib/templates/puppet/step-0/modules/rbenv/templates/dot.rbenvrc.erb +8 -0
  141. data/lib/templates/puppet/step-0/modules/stdlib/CHANGELOG.md +418 -0
  142. data/lib/templates/puppet/step-0/modules/stdlib/CONTRIBUTING.md +65 -0
  143. data/lib/templates/puppet/step-0/modules/stdlib/Gemfile +33 -0
  144. data/lib/templates/puppet/step-0/modules/stdlib/Gemfile.lock +166 -0
  145. data/lib/templates/puppet/step-0/modules/stdlib/LICENSE +19 -0
  146. data/lib/templates/puppet/step-0/modules/stdlib/Modulefile +11 -0
  147. data/lib/templates/puppet/step-0/modules/stdlib/README.markdown +1304 -0
  148. data/lib/templates/puppet/step-0/modules/stdlib/README_DEVELOPER.markdown +35 -0
  149. data/lib/templates/puppet/step-0/modules/stdlib/README_SPECS.markdown +7 -0
  150. data/lib/templates/puppet/step-0/modules/stdlib/RELEASE_PROCESS.markdown +24 -0
  151. data/lib/templates/puppet/step-0/modules/stdlib/Rakefile +18 -0
  152. data/lib/templates/puppet/step-0/modules/stdlib/checksums.json +349 -0
  153. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/facter_dot_d.rb +202 -0
  154. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/pe_version.rb +53 -0
  155. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/puppet_vardir.rb +26 -0
  156. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/root_home.rb +32 -0
  157. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/util/puppet_settings.rb +21 -0
  158. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/abs.rb +36 -0
  159. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/any2array.rb +33 -0
  160. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/base64.rb +37 -0
  161. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +49 -0
  162. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +34 -0
  163. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chomp.rb +35 -0
  164. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chop.rb +37 -0
  165. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/concat.rb +41 -0
  166. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/count.rb +22 -0
  167. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +44 -0
  168. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +35 -0
  169. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete.rb +46 -0
  170. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +49 -0
  171. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb +34 -0
  172. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +26 -0
  173. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/difference.rb +36 -0
  174. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/dirname.rb +15 -0
  175. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/downcase.rb +33 -0
  176. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/empty.rb +28 -0
  177. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +35 -0
  178. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +45 -0
  179. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/flatten.rb +33 -0
  180. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/floor.rb +25 -0
  181. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +46 -0
  182. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +17 -0
  183. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getparam.rb +35 -0
  184. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getvar.rb +26 -0
  185. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/grep.rb +33 -0
  186. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +52 -0
  187. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +25 -0
  188. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +25 -0
  189. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_key.rb +28 -0
  190. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/hash.rb +41 -0
  191. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/intersection.rb +34 -0
  192. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_array.rb +22 -0
  193. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_bool.rb +22 -0
  194. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +50 -0
  195. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_float.rb +30 -0
  196. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +26 -0
  197. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +22 -0
  198. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +45 -0
  199. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +32 -0
  200. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +27 -0
  201. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +75 -0
  202. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_string.rb +26 -0
  203. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join.rb +41 -0
  204. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +47 -0
  205. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/keys.rb +26 -0
  206. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +20 -0
  207. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +33 -0
  208. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/max.rb +21 -0
  209. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/member.rb +44 -0
  210. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/merge.rb +34 -0
  211. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/min.rb +21 -0
  212. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +43 -0
  213. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +24 -0
  214. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +24 -0
  215. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick.rb +29 -0
  216. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick_default.rb +35 -0
  217. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/prefix.rb +45 -0
  218. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/range.rb +88 -0
  219. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reject.rb +31 -0
  220. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reverse.rb +28 -0
  221. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +32 -0
  222. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +46 -0
  223. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/size.rb +48 -0
  224. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/sort.rb +27 -0
  225. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +36 -0
  226. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +46 -0
  227. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +32 -0
  228. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strftime.rb +107 -0
  229. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strip.rb +39 -0
  230. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/suffix.rb +45 -0
  231. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +39 -0
  232. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/time.rb +49 -0
  233. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +28 -0
  234. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/type.rb +50 -0
  235. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/union.rb +34 -0
  236. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/unique.rb +51 -0
  237. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/upcase.rb +41 -0
  238. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +35 -0
  239. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +56 -0
  240. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +33 -0
  241. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +81 -0
  242. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +34 -0
  243. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +48 -0
  244. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +33 -0
  245. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb +48 -0
  246. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb +49 -0
  247. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +40 -0
  248. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +71 -0
  249. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +33 -0
  250. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values.rb +39 -0
  251. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values_at.rb +98 -0
  252. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/zip.rb +65 -0
  253. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +83 -0
  254. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/anchor.rb +46 -0
  255. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/file_line.rb +79 -0
  256. data/lib/templates/puppet/step-0/modules/stdlib/manifests/init.pp +20 -0
  257. data/lib/templates/puppet/step-0/modules/stdlib/manifests/stages.pp +43 -0
  258. data/lib/templates/puppet/step-0/modules/stdlib/metadata.json +111 -0
  259. data/lib/templates/puppet/step-0/modules/sudo/.fixtures.yml +5 -0
  260. data/lib/templates/puppet/step-0/modules/sudo/.gemfile +14 -0
  261. data/lib/templates/puppet/step-0/modules/sudo/.gemfile.lock +43 -0
  262. data/lib/templates/puppet/step-0/modules/sudo/.travis.yml +34 -0
  263. data/lib/templates/puppet/step-0/modules/sudo/LICENSE +13 -0
  264. data/lib/templates/puppet/step-0/modules/sudo/Modulefile +9 -0
  265. data/lib/templates/puppet/step-0/modules/sudo/README.md +171 -0
  266. data/lib/templates/puppet/step-0/modules/sudo/Rakefile +1 -0
  267. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.aix +90 -0
  268. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.archlinux +90 -0
  269. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.deb +90 -0
  270. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.freebsd +98 -0
  271. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.omnios +90 -0
  272. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel5 +97 -0
  273. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel6 +115 -0
  274. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.solaris +90 -0
  275. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.suse +81 -0
  276. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.ubuntu +30 -0
  277. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.wheezy +17 -0
  278. data/lib/templates/puppet/step-0/modules/sudo/lib/augeas/lenses/fixedsudoers.aug +520 -0
  279. data/lib/templates/puppet/step-0/modules/sudo/manifests/allow.pp +76 -0
  280. data/lib/templates/puppet/step-0/modules/sudo/manifests/conf.pp +105 -0
  281. data/lib/templates/puppet/step-0/modules/sudo/manifests/configs.pp +24 -0
  282. data/lib/templates/puppet/step-0/modules/sudo/manifests/init.pp +151 -0
  283. data/lib/templates/puppet/step-0/modules/sudo/manifests/package/aix.pp +46 -0
  284. data/lib/templates/puppet/step-0/modules/sudo/manifests/package/solaris.pp +60 -0
  285. data/lib/templates/puppet/step-0/modules/sudo/manifests/package.pp +61 -0
  286. data/lib/templates/puppet/step-0/modules/sudo/manifests/params.pp +127 -0
  287. data/lib/templates/puppet/step-0/modules/sudo/metadata.json +59 -0
  288. data/lib/templates/puppet/step-0/modules/sudo/templates/users_groups.erb +9 -0
  289. data/lib/templates/puppet/step-0/modules/users/manifests/init.pp +15 -0
  290. data/lib/templates/puppet/step-0/modules/users/manifests/user.pp +50 -0
  291. data/lib/templates/puppet/step-1/Puppetfile.erb +5 -0
  292. data/lib/templates/puppet/step-1/hiera/data/common.yaml.erb +11 -0
  293. data/lib/templates/puppet/step-1/hiera/data/environment.yaml.erb +11 -0
  294. data/lib/templates/puppet/step-1/hiera/data/node.yaml.erb +11 -0
  295. data/lib/templates/puppet/step-1/hiera/hiera.yaml.erb +11 -0
  296. data/lib/templates/puppet/step-1/manifests/node.erb +5 -0
  297. data/lib/templates/puppet/step-1/manifests/site.pp.erb +15 -0
  298. data/lib/templates/puppet/step-1/modules/users/manifests/init.pp +15 -0
  299. data/lib/templates/puppet/step-1/modules/users/manifests/user.pp +49 -0
  300. data/lib/templates/puppet/step-2/Puppetfile.erb +5 -0
  301. data/lib/templates/puppet/step-2/hiera/data/common.yaml.erb +1 -0
  302. data/lib/templates/puppet/step-2/hiera/data/environment.yaml.erb +1 -0
  303. data/lib/templates/puppet/step-2/hiera/data/node.yaml.erb +1 -0
  304. data/lib/templates/puppet/step-2/hiera/hiera.yaml.erb +11 -0
  305. data/lib/templates/puppet/step-2/manifests/node.erb +3 -0
  306. data/lib/templates/puppet/step-2/manifests/site.pp.erb +10 -0
  307. data/lib/templates/puppet/step-3/Puppetfile.erb +5 -0
  308. data/lib/templates/puppet/step-3/hiera/data/common.yaml.erb +99 -0
  309. data/lib/templates/puppet/step-3/hiera/data/environment.yaml.erb +99 -0
  310. data/lib/templates/puppet/step-3/hiera/data/node.yaml.erb +99 -0
  311. data/lib/templates/puppet/step-3/hiera/hiera.yaml.erb +11 -0
  312. data/lib/templates/puppet/step-3/manifests/node.erb +5 -0
  313. data/lib/templates/puppet/step-3/manifests/site.pp.erb +15 -0
  314. data/spec/environment_spec.rb +82 -0
  315. data/spec/factories/environment.rb +20 -0
  316. data/spec/factories/node.rb +22 -0
  317. data/spec/factories/profile.rb +10 -0
  318. data/spec/factories/project.rb +17 -0
  319. data/spec/factories/provision.rb +13 -0
  320. data/spec/factories/role.rb +9 -0
  321. data/spec/fixtures/Capfile.test +2 -0
  322. data/spec/fixtures/Gemfile.test +5 -0
  323. data/spec/fixtures/config/deploy/environment.test +35 -0
  324. data/spec/fixtures/config/deploy/production.test +35 -0
  325. data/spec/fixtures/config/deploy/staging.test +35 -0
  326. data/spec/fixtures/config/deploy/vagrant.test +37 -0
  327. data/spec/fixtures/config/deploy.test +120 -0
  328. data/spec/fixtures/dot_bebox.test.erb +4 -0
  329. data/spec/fixtures/dot_gitignore.test +8 -0
  330. data/spec/fixtures/node/Vagrantfile.test.erb +18 -0
  331. data/spec/fixtures/node/node_0.test.erb +3 -0
  332. data/spec/fixtures/node/prepared_node_0.test.erb +4 -0
  333. data/spec/fixtures/node/provisioned_node_0.test.erb +4 -0
  334. data/spec/fixtures/node/vagrant_deploy.test +38 -0
  335. data/spec/fixtures/puppet/hiera/data/node0.server1.test.yaml.test +4 -0
  336. data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile.test +24 -0
  337. data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile_with_modules.test +20 -0
  338. data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init.pp.test +17 -0
  339. data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init_with_content.pp.test +22 -0
  340. data/spec/fixtures/puppet/roles/manifests/init.pp.test +14 -0
  341. data/spec/fixtures/puppet/steps/step-0/hiera/data/common.yaml.test +26 -0
  342. data/spec/fixtures/puppet/steps/step-0/hiera/data/node0.server1.test.yaml.test +0 -0
  343. data/spec/fixtures/puppet/steps/step-0/hiera/data/pname_env.yaml.test +26 -0
  344. data/spec/fixtures/puppet/steps/step-0/hiera/data/production.yaml.test +0 -0
  345. data/spec/fixtures/puppet/steps/step-0/hiera/data/staging.yaml.test +0 -0
  346. data/spec/fixtures/puppet/steps/step-0/hiera/data/vagrant.yaml.test +0 -0
  347. data/spec/fixtures/puppet/steps/step-0/hiera/hiera.yaml.test +11 -0
  348. data/spec/fixtures/puppet/steps/step-0/manifests/site.pp.test +10 -0
  349. data/spec/fixtures/puppet/steps/step-0/manifests/site_with_node.pp.test +15 -0
  350. data/spec/fixtures/puppet/steps/step-1/hiera/data/common.yaml.test +11 -0
  351. data/spec/fixtures/puppet/steps/step-1/hiera/data/node0.server1.test.yaml.test +0 -0
  352. data/spec/fixtures/puppet/steps/step-1/hiera/data/pname_env.yaml.test +11 -0
  353. data/spec/fixtures/puppet/steps/step-1/hiera/data/production.yaml.test +0 -0
  354. data/spec/fixtures/puppet/steps/step-1/hiera/data/staging.yaml.test +0 -0
  355. data/spec/fixtures/puppet/steps/step-1/hiera/data/vagrant.yaml.test +0 -0
  356. data/spec/fixtures/puppet/steps/step-1/hiera/hiera.yaml.test +11 -0
  357. data/spec/fixtures/puppet/steps/step-1/manifests/site.pp.test +10 -0
  358. data/spec/fixtures/puppet/steps/step-1/manifests/site_with_node.pp.test +15 -0
  359. data/spec/fixtures/puppet/steps/step-2/Puppetfile.test +6 -0
  360. data/spec/fixtures/puppet/steps/step-2/hiera/data/common.yaml.test +1 -0
  361. data/spec/fixtures/puppet/steps/step-2/hiera/data/node0.server1.test.yaml.test +1 -0
  362. data/spec/fixtures/puppet/steps/step-2/hiera/data/pname_env.yaml.test +1 -0
  363. data/spec/fixtures/puppet/steps/step-2/hiera/data/production.yaml.test +1 -0
  364. data/spec/fixtures/puppet/steps/step-2/hiera/data/staging.yaml.test +1 -0
  365. data/spec/fixtures/puppet/steps/step-2/hiera/data/vagrant.yaml.test +1 -0
  366. data/spec/fixtures/puppet/steps/step-2/hiera/hiera.yaml.test +11 -0
  367. data/spec/fixtures/puppet/steps/step-2/manifests/site.pp.test +10 -0
  368. data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node.pp.test +13 -0
  369. data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node_role_association.pp.test +16 -0
  370. data/spec/fixtures/puppet/steps/step-2/modules/profiles/manifests/test/profile_0.pp.test +17 -0
  371. data/spec/fixtures/puppet/steps/step-2/modules/roles/manifests/role_0.pp.test +16 -0
  372. data/spec/fixtures/puppet/steps/step-3/hiera/data/common.yaml.test +99 -0
  373. data/spec/fixtures/puppet/steps/step-3/hiera/data/node0.server1.test.yaml.test +1 -0
  374. data/spec/fixtures/puppet/steps/step-3/hiera/data/pname_env.yaml.test +99 -0
  375. data/spec/fixtures/puppet/steps/step-3/hiera/data/production.yaml.test +1 -0
  376. data/spec/fixtures/puppet/steps/step-3/hiera/data/staging.yaml.test +1 -0
  377. data/spec/fixtures/puppet/steps/step-3/hiera/data/vagrant.yaml.test +1 -0
  378. data/spec/fixtures/puppet/steps/step-3/hiera/hiera.yaml.test +11 -0
  379. data/spec/fixtures/puppet/steps/step-3/manifests/site.pp.test +10 -0
  380. data/spec/fixtures/puppet/steps/step-3/manifests/site_with_node.pp.test +15 -0
  381. data/spec/fixtures/puppet/ubuntu_dependencies.test +10 -0
  382. data/spec/node0.server1.test/prepare_phase_spec.rb +53 -0
  383. data/spec/node0.server1.test/provision_step_0_spec.rb +46 -0
  384. data/spec/node0.server1.test/provision_step_1_spec.rb +41 -0
  385. data/spec/node0.server1.test/provision_step_2_spec.rb +79 -0
  386. data/spec/node0.server1.test/provision_step_3_spec.rb +76 -0
  387. data/spec/node_role_spec.rb +20 -0
  388. data/spec/node_spec.rb +71 -0
  389. data/spec/node_wizard_spec.rb +22 -0
  390. data/spec/ordered_phases_spec.rb +55 -0
  391. data/spec/pre_prepare_spec.rb +78 -0
  392. data/spec/pre_provision_steps_spec.rb +40 -0
  393. data/spec/profile_spec.rb +70 -0
  394. data/spec/project_spec.rb +195 -0
  395. data/spec/project_wizard_spec.rb +51 -0
  396. data/spec/puppet_spec_helper.rb +15 -0
  397. data/spec/role_profiles_spec.rb +40 -0
  398. data/spec/role_spec.rb +56 -0
  399. data/spec/spec_helper.rb +37 -0
  400. data/spec/support/config_specs.yaml.example +2 -0
  401. data/spec/vagrant_spec_helper.rb +15 -0
  402. metadata +625 -0
@@ -0,0 +1,1304 @@
1
+ # Puppet Labs Standard Library #
2
+
3
+ [![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-stdlib.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-stdlib)
4
+
5
+ This module provides a "standard library" of resources for developing Puppet
6
+ Modules. This modules will include the following additions to Puppet
7
+
8
+ * Stages
9
+ * Facts
10
+ * Functions
11
+ * Defined resource types
12
+ * Types
13
+ * Providers
14
+
15
+ This module is officially curated and provided by Puppet Labs. The modules
16
+ Puppet Labs writes and distributes will make heavy use of this standard
17
+ library.
18
+
19
+ To report or research a bug with any part of this module, please go to
20
+ [http://tickets.puppetlabs.com/browse/PUP](http://tickets.puppetlabs.com/browse/PUP)
21
+
22
+ # Versions #
23
+
24
+ This module follows semver.org (v1.0.0) versioning guidelines. The standard
25
+ library module is released as part of [Puppet
26
+ Enterprise](http://puppetlabs.com/puppet/puppet-enterprise/) and as a result
27
+ older versions of Puppet Enterprise that Puppet Labs still supports will have
28
+ bugfix maintenance branches periodically "merged up" into master. The current
29
+ list of integration branches are:
30
+
31
+ * v2.1.x (v2.1.1 released in PE 1)
32
+ * v2.2.x (Never released as part of PE, only to the Forge)
33
+ * v2.3.x (Released in PE 2)
34
+ * v3.0.x (Released in PE 3)
35
+ * v4.0.x (Maintains compatibility with v3.x despite the major semantic version bump. Compatible with Puppet 2.7.x)
36
+ * v5.x (To be released when stdlib can drop support for Puppet 2.7.x. Please see [this discussion](https://github.com/puppetlabs/puppetlabs-stdlib/pull/176#issuecomment-30251414))
37
+ * master (mainline development branch)
38
+
39
+ The first Puppet Enterprise version including the stdlib module is Puppet
40
+ Enterprise 1.2.
41
+
42
+ # Compatibility #
43
+
44
+ Puppet Versions | < 2.6 | 2.6 | 2.7 | 3.x |
45
+ :---------------|:-----:|:---:|:---:|:----:
46
+ **stdlib 2.x** | no | **yes** | **yes** | no
47
+ **stdlib 3.x** | no | no | **yes** | **yes**
48
+ **stdlib 4.x** | no | no | **yes** | **yes**
49
+
50
+ The stdlib module does not work with Puppet versions released prior to Puppet
51
+ 2.6.0.
52
+
53
+ ## stdlib 2.x ##
54
+
55
+ All stdlib releases in the 2.0 major version support Puppet 2.6 and Puppet 2.7.
56
+
57
+ ## stdlib 3.x ##
58
+
59
+ The 3.0 major release of stdlib drops support for Puppet 2.6. Stdlib 3.x
60
+ supports Puppet 2 and Puppet 3.
61
+
62
+ ## stdlib 4.x ##
63
+
64
+ The 4.0 major release of stdlib was intended to drop support for Puppet 2.7,
65
+ but the impact on end users was too high. The decision was made to treat
66
+ stdlib 4.x as a continuation of stdlib 3.x support. Stdlib 4.x supports Puppet
67
+ 2.7 and 3. Notably, ruby 1.8.5 is no longer supported though ruby
68
+ 1.8.7, 1.9.3, and 2.0.0 are fully supported.
69
+
70
+ # Functions #
71
+
72
+ abs
73
+ ---
74
+ Returns the absolute value of a number, for example -34.56 becomes
75
+ 34.56. Takes a single integer and float value as an argument.
76
+
77
+
78
+ - *Type*: rvalue
79
+
80
+ any2array
81
+ ---------
82
+ This converts any object to an array containing that object. Empty argument
83
+ lists are converted to an empty array. Arrays are left untouched. Hashes are
84
+ converted to arrays of alternating keys and values.
85
+
86
+
87
+ - *Type*: rvalue
88
+
89
+ base64
90
+ --------
91
+ Converts a string to and from base64 encoding.
92
+ Requires an action ['encode','decode'] and either a plain or base64 encoded
93
+ string
94
+
95
+
96
+ - *Type*: rvalue
97
+
98
+ bool2num
99
+ --------
100
+ Converts a boolean to a number. Converts the values:
101
+ false, f, 0, n, and no to 0
102
+ true, t, 1, y, and yes to 1
103
+ Requires a single boolean or string as an input.
104
+
105
+
106
+ - *Type*: rvalue
107
+
108
+ capitalize
109
+ ----------
110
+ Capitalizes the first letter of a string or array of strings.
111
+ Requires either a single string or an array as an input.
112
+
113
+
114
+ - *Type*: rvalue
115
+
116
+ chomp
117
+ -----
118
+ Removes the record separator from the end of a string or an array of
119
+ strings, for example `hello\n` becomes `hello`.
120
+ Requires a single string or array as an input.
121
+
122
+
123
+ - *Type*: rvalue
124
+
125
+ chop
126
+ ----
127
+ Returns a new string with the last character removed. If the string ends
128
+ with `\r\n`, both characters are removed. Applying chop to an empty
129
+ string returns an empty string. If you wish to merely remove record
130
+ separators then you should use the `chomp` function.
131
+ Requires a string or array of strings as input.
132
+
133
+
134
+ - *Type*: rvalue
135
+
136
+ concat
137
+ ------
138
+ Appends the contents of array 2 onto array 1.
139
+
140
+ *Example:*
141
+
142
+ concat(['1','2','3'],['4','5','6'])
143
+
144
+ Would result in:
145
+
146
+ ['1','2','3','4','5','6']
147
+
148
+ concat(['1','2','3'],'4')
149
+
150
+ Would result in:
151
+
152
+ ['1','2','3','4']
153
+
154
+ - *Type*: rvalue
155
+
156
+ count
157
+ -----
158
+ Takes an array as first argument and an optional second argument.
159
+ Count the number of elements in array that matches second argument.
160
+ If called with only an array it counts the number of elements that are not nil/undef.
161
+
162
+
163
+ - *Type*: rvalue
164
+
165
+ defined_with_params
166
+ -------------------
167
+ Takes a resource reference and an optional hash of attributes.
168
+
169
+ Returns true if a resource with the specified attributes has already been added
170
+ to the catalog, and false otherwise.
171
+
172
+ user { 'dan':
173
+ ensure => present,
174
+ }
175
+
176
+ if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
177
+ user { 'dan': ensure => present, }
178
+ }
179
+
180
+
181
+ - *Type*: rvalue
182
+
183
+ delete
184
+ ------
185
+ Deletes all instances of a given element from an array, substring from a
186
+ string, or key from a hash.
187
+
188
+ *Examples:*
189
+
190
+ delete(['a','b','c','b'], 'b')
191
+ Would return: ['a','c']
192
+
193
+ delete({'a'=>1,'b'=>2,'c'=>3}, 'b')
194
+ Would return: {'a'=>1,'c'=>3}
195
+
196
+ delete('abracadabra', 'bra')
197
+ Would return: 'acada'
198
+
199
+
200
+ - *Type*: rvalue
201
+
202
+ delete_at
203
+ ---------
204
+ Deletes a determined indexed value from an array.
205
+
206
+ *Examples:*
207
+
208
+ delete_at(['a','b','c'], 1)
209
+
210
+ Would return: ['a','c']
211
+
212
+
213
+ - *Type*: rvalue
214
+
215
+ delete_values
216
+ -------------
217
+ Deletes all instances of a given value from a hash.
218
+
219
+ *Examples:*
220
+
221
+ delete_values({'a'=>'A','b'=>'B','c'=>'C','B'=>'D'}, 'B')
222
+
223
+ Would return: {'a'=>'A','c'=>'C','B'=>'D'}
224
+
225
+
226
+ - *Type*: rvalue
227
+
228
+ delete_undef_values
229
+ -------------------
230
+ Deletes all instances of the undef value from an array or hash.
231
+
232
+ *Examples:*
233
+
234
+ $hash = delete_undef_values({a=>'A', b=>'', c=>undef, d => false})
235
+
236
+ Would return: {a => 'A', b => '', d => false}
237
+
238
+ $array = delete_undef_values(['A','',undef,false])
239
+
240
+ Would return: ['A','',false]
241
+
242
+ - *Type*: rvalue
243
+
244
+ difference
245
+ ----------
246
+ This function returns the difference between two arrays.
247
+ The returned array is a copy of the original array, removing any items that
248
+ also appear in the second array.
249
+
250
+ *Examples:*
251
+
252
+ difference(["a","b","c"],["b","c","d"])
253
+
254
+ Would return: ["a"]
255
+
256
+ dirname
257
+ -------
258
+ Returns the `dirname` of a path.
259
+
260
+ *Examples:*
261
+
262
+ dirname('/path/to/a/file.ext')
263
+
264
+ Would return: '/path/to/a'
265
+
266
+ downcase
267
+ --------
268
+ Converts the case of a string or all strings in an array to lower case.
269
+
270
+
271
+ - *Type*: rvalue
272
+
273
+ empty
274
+ -----
275
+ Returns true if the variable is empty.
276
+
277
+
278
+ - *Type*: rvalue
279
+
280
+ ensure_packages
281
+ ---------------
282
+ Takes a list of packages and only installs them if they don't already exist.
283
+ It optionally takes a hash as a second parameter that will be passed as the
284
+ third argument to the ensure_resource() function.
285
+
286
+
287
+ - *Type*: statement
288
+
289
+ ensure_resource
290
+ ---------------
291
+ Takes a resource type, title, and a list of attributes that describe a
292
+ resource.
293
+
294
+ user { 'dan':
295
+ ensure => present,
296
+ }
297
+
298
+ This example only creates the resource if it does not already exist:
299
+
300
+ ensure_resource('user', 'dan', {'ensure' => 'present' })
301
+
302
+ If the resource already exists but does not match the specified parameters,
303
+ this function will attempt to recreate the resource leading to a duplicate
304
+ resource definition error.
305
+
306
+ An array of resources can also be passed in and each will be created with
307
+ the type and parameters specified if it doesn't already exist.
308
+
309
+ ensure_resource('user', ['dan','alex'], {'ensure' => 'present'})
310
+
311
+
312
+
313
+ - *Type*: statement
314
+
315
+ file_line
316
+ ---------
317
+ This resource ensures that a given line is contained within a file. You can also use
318
+ "match" to replace existing lines.
319
+
320
+ *Examples:*
321
+
322
+ file_line { 'sudo_rule':
323
+ path => '/etc/sudoers',
324
+ line => '%sudo ALL=(ALL) ALL',
325
+ }
326
+
327
+ file_line { 'change_mount':
328
+ path => '/etc/fstab',
329
+ line => '10.0.0.1:/vol/data /opt/data nfs defaults 0 0',
330
+ match => '^172.16.17.2:/vol/old',
331
+ }
332
+
333
+ - *Type*: resource
334
+
335
+ flatten
336
+ -------
337
+ This function flattens any deeply nested arrays and returns a single flat array
338
+ as a result.
339
+
340
+ *Examples:*
341
+
342
+ flatten(['a', ['b', ['c']]])
343
+
344
+ Would return: ['a','b','c']
345
+
346
+
347
+ - *Type*: rvalue
348
+
349
+ floor
350
+ -----
351
+ Returns the largest integer less or equal to the argument.
352
+ Takes a single numeric value as an argument.
353
+
354
+
355
+ - *Type*: rvalue
356
+
357
+ fqdn_rotate
358
+ -----------
359
+ Rotates an array a random number of times based on a nodes fqdn.
360
+
361
+
362
+ - *Type*: rvalue
363
+
364
+ get_module_path
365
+ ---------------
366
+ Returns the absolute path of the specified module for the current
367
+ environment.
368
+
369
+ Example:
370
+ $module_path = get_module_path('stdlib')
371
+
372
+
373
+ - *Type*: rvalue
374
+
375
+ getparam
376
+ --------
377
+ Takes a resource reference and name of the parameter and
378
+ returns value of resource's parameter.
379
+
380
+ *Examples:*
381
+
382
+ define example_resource($param) {
383
+ }
384
+
385
+ example_resource { "example_resource_instance":
386
+ param => "param_value"
387
+ }
388
+
389
+ getparam(Example_resource["example_resource_instance"], "param")
390
+
391
+ Would return: param_value
392
+
393
+
394
+ - *Type*: rvalue
395
+
396
+ getvar
397
+ ------
398
+ Lookup a variable in a remote namespace.
399
+
400
+ For example:
401
+
402
+ $foo = getvar('site::data::foo')
403
+ # Equivalent to $foo = $site::data::foo
404
+
405
+ This is useful if the namespace itself is stored in a string:
406
+
407
+ $datalocation = 'site::data'
408
+ $bar = getvar("${datalocation}::bar")
409
+ # Equivalent to $bar = $site::data::bar
410
+
411
+
412
+ - *Type*: rvalue
413
+
414
+ grep
415
+ ----
416
+ This function searches through an array and returns any elements that match
417
+ the provided regular expression.
418
+
419
+ *Examples:*
420
+
421
+ grep(['aaa','bbb','ccc','aaaddd'], 'aaa')
422
+
423
+ Would return:
424
+
425
+ ['aaa','aaaddd']
426
+
427
+
428
+ - *Type*: rvalue
429
+
430
+ has_interface_with
431
+ ------------------
432
+ Returns boolean based on kind and value:
433
+ * macaddress
434
+ * netmask
435
+ * ipaddress
436
+ * network
437
+
438
+ *Examples:*
439
+
440
+ has_interface_with("macaddress", "x:x:x:x:x:x")
441
+ has_interface_with("ipaddress", "127.0.0.1") => true
442
+
443
+ etc.
444
+
445
+ If no "kind" is given, then the presence of the interface is checked:
446
+
447
+ has_interface_with("lo") => true
448
+
449
+
450
+ - *Type*: rvalue
451
+
452
+ has_ip_address
453
+ --------------
454
+ Returns true if the client has the requested IP address on some interface.
455
+
456
+ This function iterates through the 'interfaces' fact and checks the
457
+ 'ipaddress_IFACE' facts, performing a simple string comparison.
458
+
459
+
460
+ - *Type*: rvalue
461
+
462
+ has_ip_network
463
+ --------------
464
+ Returns true if the client has an IP address within the requested network.
465
+
466
+ This function iterates through the 'interfaces' fact and checks the
467
+ 'network_IFACE' facts, performing a simple string comparision.
468
+
469
+
470
+ - *Type*: rvalue
471
+
472
+ has_key
473
+ -------
474
+ Determine if a hash has a certain key value.
475
+
476
+ Example:
477
+
478
+ $my_hash = {'key_one' => 'value_one'}
479
+ if has_key($my_hash, 'key_two') {
480
+ notice('we will not reach here')
481
+ }
482
+ if has_key($my_hash, 'key_one') {
483
+ notice('this will be printed')
484
+ }
485
+
486
+
487
+
488
+ - *Type*: rvalue
489
+
490
+ hash
491
+ ----
492
+ This function converts an array into a hash.
493
+
494
+ *Examples:*
495
+
496
+ hash(['a',1,'b',2,'c',3])
497
+
498
+ Would return: {'a'=>1,'b'=>2,'c'=>3}
499
+
500
+
501
+ - *Type*: rvalue
502
+
503
+ intersection
504
+ -----------
505
+ This function returns an array an intersection of two.
506
+
507
+ *Examples:*
508
+
509
+ intersection(["a","b","c"],["b","c","d"])
510
+
511
+ Would return: ["b","c"]
512
+
513
+ is_array
514
+ --------
515
+ Returns true if the variable passed to this function is an array.
516
+
517
+ - *Type*: rvalue
518
+
519
+ is_bool
520
+ --------
521
+ Returns true if the variable passed to this function is a boolean.
522
+
523
+ - *Type*: rvalue
524
+
525
+ is_domain_name
526
+ --------------
527
+ Returns true if the string passed to this function is a syntactically correct domain name.
528
+
529
+ - *Type*: rvalue
530
+
531
+ is_float
532
+ --------
533
+ Returns true if the variable passed to this function is a float.
534
+
535
+ - *Type*: rvalue
536
+
537
+ is_function_available
538
+ ---------------------
539
+ This function accepts a string as an argument, determines whether the
540
+ Puppet runtime has access to a function by that name. It returns a
541
+ true if the function exists, false if not.
542
+
543
+ - *Type*: rvalue
544
+
545
+ is_hash
546
+ -------
547
+ Returns true if the variable passed to this function is a hash.
548
+
549
+ - *Type*: rvalue
550
+
551
+ is_integer
552
+ ----------
553
+ Returns true if the variable returned to this string is an integer.
554
+
555
+ - *Type*: rvalue
556
+
557
+ is_ip_address
558
+ -------------
559
+ Returns true if the string passed to this function is a valid IP address.
560
+
561
+ - *Type*: rvalue
562
+
563
+ is_mac_address
564
+ --------------
565
+ Returns true if the string passed to this function is a valid mac address.
566
+
567
+ - *Type*: rvalue
568
+
569
+ is_numeric
570
+ ----------
571
+ Returns true if the variable passed to this function is a number.
572
+
573
+ - *Type*: rvalue
574
+
575
+ is_string
576
+ ---------
577
+ Returns true if the variable passed to this function is a string.
578
+
579
+ - *Type*: rvalue
580
+
581
+ join
582
+ ----
583
+ This function joins an array into a string using a separator.
584
+
585
+ *Examples:*
586
+
587
+ join(['a','b','c'], ",")
588
+
589
+ Would result in: "a,b,c"
590
+
591
+ - *Type*: rvalue
592
+
593
+ join_keys_to_values
594
+ -------------------
595
+ This function joins each key of a hash to that key's corresponding value with a
596
+ separator. Keys and values are cast to strings. The return value is an array in
597
+ which each element is one joined key/value pair.
598
+
599
+ *Examples:*
600
+
601
+ join_keys_to_values({'a'=>1,'b'=>2}, " is ")
602
+
603
+ Would result in: ["a is 1","b is 2"]
604
+
605
+ - *Type*: rvalue
606
+
607
+ keys
608
+ ----
609
+ Returns the keys of a hash as an array.
610
+
611
+ - *Type*: rvalue
612
+
613
+ loadyaml
614
+ --------
615
+ Load a YAML file containing an array, string, or hash, and return the data
616
+ in the corresponding native data type.
617
+
618
+ For example:
619
+
620
+ $myhash = loadyaml('/etc/puppet/data/myhash.yaml')
621
+
622
+
623
+ - *Type*: rvalue
624
+
625
+ lstrip
626
+ ------
627
+ Strips leading spaces to the left of a string.
628
+
629
+ - *Type*: rvalue
630
+
631
+ max
632
+ ---
633
+ Returns the highest value of all arguments.
634
+ Requires at least one argument.
635
+
636
+ - *Type*: rvalue
637
+
638
+ member
639
+ ------
640
+ This function determines if a variable is a member of an array.
641
+
642
+ *Examples:*
643
+
644
+ member(['a','b'], 'b')
645
+
646
+ Would return: true
647
+
648
+ member(['a','b'], 'c')
649
+
650
+ Would return: false
651
+
652
+ - *Type*: rvalue
653
+
654
+ merge
655
+ -----
656
+ Merges two or more hashes together and returns the resulting hash.
657
+
658
+ For example:
659
+
660
+ $hash1 = {'one' => 1, 'two' => 2}
661
+ $hash2 = {'two' => 'dos', 'three' => 'tres'}
662
+ $merged_hash = merge($hash1, $hash2)
663
+ # The resulting hash is equivalent to:
664
+ # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'}
665
+
666
+ When there is a duplicate key, the key in the rightmost hash will "win."
667
+
668
+ - *Type*: rvalue
669
+
670
+ min
671
+ ---
672
+ Returns the lowest value of all arguments.
673
+ Requires at least one argument.
674
+
675
+ - *Type*: rvalue
676
+
677
+ num2bool
678
+ --------
679
+ This function converts a number or a string representation of a number into a
680
+ true boolean. Zero or anything non-numeric becomes false. Numbers higher then 0
681
+ become true.
682
+
683
+ - *Type*: rvalue
684
+
685
+ parsejson
686
+ ---------
687
+ This function accepts JSON as a string and converts into the correct Puppet
688
+ structure.
689
+
690
+ - *Type*: rvalue
691
+
692
+ parseyaml
693
+ ---------
694
+ This function accepts YAML as a string and converts it into the correct
695
+ Puppet structure.
696
+
697
+ - *Type*: rvalue
698
+
699
+ pick
700
+ ----
701
+ This function is similar to a coalesce function in SQL in that it will return
702
+ the first value in a list of values that is not undefined or an empty string
703
+ (two things in Puppet that will return a boolean false value). Typically,
704
+ this function is used to check for a value in the Puppet Dashboard/Enterprise
705
+ Console, and failover to a default value like the following:
706
+
707
+ $real_jenkins_version = pick($::jenkins_version, '1.449')
708
+
709
+ The value of $real_jenkins_version will first look for a top-scope variable
710
+ called 'jenkins_version' (note that parameters set in the Puppet Dashboard/
711
+ Enterprise Console are brought into Puppet as top-scope variables), and,
712
+ failing that, will use a default value of 1.449.
713
+
714
+ - *Type*: rvalue
715
+
716
+ prefix
717
+ ------
718
+ This function applies a prefix to all elements in an array.
719
+
720
+ *Examples:*
721
+
722
+ prefix(['a','b','c'], 'p')
723
+
724
+ Will return: ['pa','pb','pc']
725
+
726
+ - *Type*: rvalue
727
+
728
+ range
729
+ -----
730
+ When given range in the form of (start, stop) it will extrapolate a range as
731
+ an array.
732
+
733
+ *Examples:*
734
+
735
+ range("0", "9")
736
+
737
+ Will return: [0,1,2,3,4,5,6,7,8,9]
738
+
739
+ range("00", "09")
740
+
741
+ Will return: [0,1,2,3,4,5,6,7,8,9] - Zero padded strings are converted to
742
+ integers automatically
743
+
744
+ range("a", "c")
745
+
746
+ Will return: ["a","b","c"]
747
+
748
+ range("host01", "host10")
749
+
750
+ Will return: ["host01", "host02", ..., "host09", "host10"]
751
+
752
+ - *Type*: rvalue
753
+
754
+ reject
755
+ ------
756
+ This function searches through an array and rejects all elements that match
757
+ the provided regular expression.
758
+
759
+ *Examples:*
760
+
761
+ reject(['aaa','bbb','ccc','aaaddd'], 'aaa')
762
+
763
+ Would return:
764
+
765
+ ['bbb','ccc']
766
+
767
+
768
+ - *Type*: rvalue
769
+
770
+ reverse
771
+ -------
772
+ Reverses the order of a string or array.
773
+
774
+ - *Type*: rvalue
775
+
776
+ rstrip
777
+ ------
778
+ Strips leading spaces to the right of the string.
779
+
780
+ - *Type*: rvalue
781
+
782
+ shuffle
783
+ -------
784
+ Randomizes the order of a string or array elements.
785
+
786
+ - *Type*: rvalue
787
+
788
+ size
789
+ ----
790
+ Returns the number of elements in a string or array.
791
+
792
+ - *Type*: rvalue
793
+
794
+ sort
795
+ ----
796
+ Sorts strings and arrays lexically.
797
+
798
+ - *Type*: rvalue
799
+
800
+ squeeze
801
+ -------
802
+ Returns a new string where runs of the same character that occur in this set
803
+ are replaced by a single character.
804
+
805
+ - *Type*: rvalue
806
+
807
+ str2bool
808
+ --------
809
+ This converts a string to a boolean. This attempts to convert strings that
810
+ contain things like: y, 1, t, true to 'true' and strings that contain things
811
+ like: 0, f, n, false, no to 'false'.
812
+
813
+
814
+ - *Type*: rvalue
815
+
816
+ str2saltedsha512
817
+ ----------------
818
+ This converts a string to a salted-SHA512 password hash (which is used for
819
+ OS X versions >= 10.7). Given any simple string, you will get a hex version
820
+ of a salted-SHA512 password hash that can be inserted into your Puppet
821
+ manifests as a valid password attribute.
822
+
823
+
824
+ - *Type*: rvalue
825
+
826
+ strftime
827
+ --------
828
+ This function returns formatted time.
829
+
830
+ *Examples:*
831
+
832
+ To return the time since epoch:
833
+
834
+ strftime("%s")
835
+
836
+ To return the date:
837
+
838
+ strftime("%Y-%m-%d")
839
+
840
+ *Format meaning:*
841
+
842
+ %a - The abbreviated weekday name (``Sun'')
843
+ %A - The full weekday name (``Sunday'')
844
+ %b - The abbreviated month name (``Jan'')
845
+ %B - The full month name (``January'')
846
+ %c - The preferred local date and time representation
847
+ %C - Century (20 in 2009)
848
+ %d - Day of the month (01..31)
849
+ %D - Date (%m/%d/%y)
850
+ %e - Day of the month, blank-padded ( 1..31)
851
+ %F - Equivalent to %Y-%m-%d (the ISO 8601 date format)
852
+ %h - Equivalent to %b
853
+ %H - Hour of the day, 24-hour clock (00..23)
854
+ %I - Hour of the day, 12-hour clock (01..12)
855
+ %j - Day of the year (001..366)
856
+ %k - hour, 24-hour clock, blank-padded ( 0..23)
857
+ %l - hour, 12-hour clock, blank-padded ( 0..12)
858
+ %L - Millisecond of the second (000..999)
859
+ %m - Month of the year (01..12)
860
+ %M - Minute of the hour (00..59)
861
+ %n - Newline (\n)
862
+ %N - Fractional seconds digits, default is 9 digits (nanosecond)
863
+ %3N millisecond (3 digits)
864
+ %6N microsecond (6 digits)
865
+ %9N nanosecond (9 digits)
866
+ %p - Meridian indicator (``AM'' or ``PM'')
867
+ %P - Meridian indicator (``am'' or ``pm'')
868
+ %r - time, 12-hour (same as %I:%M:%S %p)
869
+ %R - time, 24-hour (%H:%M)
870
+ %s - Number of seconds since 1970-01-01 00:00:00 UTC.
871
+ %S - Second of the minute (00..60)
872
+ %t - Tab character ( )
873
+ %T - time, 24-hour (%H:%M:%S)
874
+ %u - Day of the week as a decimal, Monday being 1. (1..7)
875
+ %U - Week number of the current year,
876
+ starting with the first Sunday as the first
877
+ day of the first week (00..53)
878
+ %v - VMS date (%e-%b-%Y)
879
+ %V - Week number of year according to ISO 8601 (01..53)
880
+ %W - Week number of the current year,
881
+ starting with the first Monday as the first
882
+ day of the first week (00..53)
883
+ %w - Day of the week (Sunday is 0, 0..6)
884
+ %x - Preferred representation for the date alone, no time
885
+ %X - Preferred representation for the time alone, no date
886
+ %y - Year without a century (00..99)
887
+ %Y - Year with century
888
+ %z - Time zone as hour offset from UTC (e.g. +0900)
889
+ %Z - Time zone name
890
+ %% - Literal ``%'' character
891
+
892
+
893
+ - *Type*: rvalue
894
+
895
+ strip
896
+ -----
897
+ This function removes leading and trailing whitespace from a string or from
898
+ every string inside an array.
899
+
900
+ *Examples:*
901
+
902
+ strip(" aaa ")
903
+
904
+ Would result in: "aaa"
905
+
906
+
907
+ - *Type*: rvalue
908
+
909
+ suffix
910
+ ------
911
+ This function applies a suffix to all elements in an array.
912
+
913
+ *Examples:*
914
+
915
+ suffix(['a','b','c'], 'p')
916
+
917
+ Will return: ['ap','bp','cp']
918
+
919
+
920
+ - *Type*: rvalue
921
+
922
+ swapcase
923
+ --------
924
+ This function will swap the existing case of a string.
925
+
926
+ *Examples:*
927
+
928
+ swapcase("aBcD")
929
+
930
+ Would result in: "AbCd"
931
+
932
+
933
+ - *Type*: rvalue
934
+
935
+ time
936
+ ----
937
+ This function will return the current time since epoch as an integer.
938
+
939
+ *Examples:*
940
+
941
+ time()
942
+
943
+ Will return something like: 1311972653
944
+
945
+
946
+ - *Type*: rvalue
947
+
948
+ to_bytes
949
+ --------
950
+ Converts the argument into bytes, for example 4 kB becomes 4096.
951
+ Takes a single string value as an argument.
952
+
953
+
954
+ - *Type*: rvalue
955
+
956
+ type
957
+ ----
958
+ Returns the type when passed a variable. Type can be one of:
959
+
960
+ * string
961
+ * array
962
+ * hash
963
+ * float
964
+ * integer
965
+ * boolean
966
+
967
+
968
+ - *Type*: rvalue
969
+
970
+ union
971
+ -----
972
+ This function returns a union of two arrays.
973
+
974
+ *Examples:*
975
+
976
+ union(["a","b","c"],["b","c","d"])
977
+
978
+ Would return: ["a","b","c","d"]
979
+
980
+
981
+ unique
982
+ ------
983
+ This function will remove duplicates from strings and arrays.
984
+
985
+ *Examples:*
986
+
987
+ unique("aabbcc")
988
+
989
+ Will return:
990
+
991
+ abc
992
+
993
+ You can also use this with arrays:
994
+
995
+ unique(["a","a","b","b","c","c"])
996
+
997
+ This returns:
998
+
999
+ ["a","b","c"]
1000
+
1001
+
1002
+ - *Type*: rvalue
1003
+
1004
+ upcase
1005
+ ------
1006
+ Converts a string or an array of strings to uppercase.
1007
+
1008
+ *Examples:*
1009
+
1010
+ upcase("abcd")
1011
+
1012
+ Will return:
1013
+
1014
+ ABCD
1015
+
1016
+
1017
+ - *Type*: rvalue
1018
+
1019
+ uriescape
1020
+ ---------
1021
+ Urlencodes a string or array of strings.
1022
+ Requires either a single string or an array as an input.
1023
+
1024
+
1025
+ - *Type*: rvalue
1026
+
1027
+ validate_absolute_path
1028
+ ----------------------
1029
+ Validate the string represents an absolute path in the filesystem. This function works
1030
+ for windows and unix style paths.
1031
+
1032
+ The following values will pass:
1033
+
1034
+ $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet"
1035
+ validate_absolute_path($my_path)
1036
+ $my_path2 = "/var/lib/puppet"
1037
+ validate_absolute_path($my_path2)
1038
+
1039
+
1040
+ The following values will fail, causing compilation to abort:
1041
+
1042
+ validate_absolute_path(true)
1043
+ validate_absolute_path([ 'var/lib/puppet', '/var/foo' ])
1044
+ validate_absolute_path([ '/var/lib/puppet', 'var/foo' ])
1045
+ $undefined = undef
1046
+ validate_absolute_path($undefined)
1047
+
1048
+
1049
+
1050
+ - *Type*: statement
1051
+
1052
+ validate_array
1053
+ --------------
1054
+ Validate that all passed values are array data structures. Abort catalog
1055
+ compilation if any value fails this check.
1056
+
1057
+ The following values will pass:
1058
+
1059
+ $my_array = [ 'one', 'two' ]
1060
+ validate_array($my_array)
1061
+
1062
+ The following values will fail, causing compilation to abort:
1063
+
1064
+ validate_array(true)
1065
+ validate_array('some_string')
1066
+ $undefined = undef
1067
+ validate_array($undefined)
1068
+
1069
+
1070
+
1071
+ - *Type*: statement
1072
+
1073
+ validate_augeas
1074
+ ---------------
1075
+ Perform validation of a string using an Augeas lens
1076
+ The first argument of this function should be a string to
1077
+ test, and the second argument should be the name of the Augeas lens to use.
1078
+ If Augeas fails to parse the string with the lens, the compilation will
1079
+ abort with a parse error.
1080
+
1081
+ A third argument can be specified, listing paths which should
1082
+ not be found in the file. The `$file` variable points to the location
1083
+ of the temporary file being tested in the Augeas tree.
1084
+
1085
+ For example, if you want to make sure your passwd content never contains
1086
+ a user `foo`, you could write:
1087
+
1088
+ validate_augeas($passwdcontent, 'Passwd.lns', ['$file/foo'])
1089
+
1090
+ Or if you wanted to ensure that no users used the '/bin/barsh' shell,
1091
+ you could use:
1092
+
1093
+ validate_augeas($passwdcontent, 'Passwd.lns', ['$file/*[shell="/bin/barsh"]']
1094
+
1095
+ If a fourth argument is specified, this will be the error message raised and
1096
+ seen by the user.
1097
+
1098
+ A helpful error message can be returned like this:
1099
+
1100
+ validate_augeas($sudoerscontent, 'Sudoers.lns', [], 'Failed to validate sudoers content with Augeas')
1101
+
1102
+
1103
+
1104
+ - *Type*: statement
1105
+
1106
+ validate_bool
1107
+ -------------
1108
+ Validate that all passed values are either true or false. Abort catalog
1109
+ compilation if any value fails this check.
1110
+
1111
+ The following values will pass:
1112
+
1113
+ $iamtrue = true
1114
+ validate_bool(true)
1115
+ validate_bool(true, true, false, $iamtrue)
1116
+
1117
+ The following values will fail, causing compilation to abort:
1118
+
1119
+ $some_array = [ true ]
1120
+ validate_bool("false")
1121
+ validate_bool("true")
1122
+ validate_bool($some_array)
1123
+
1124
+
1125
+
1126
+ - *Type*: statement
1127
+
1128
+ validate_cmd
1129
+ ------------
1130
+ Perform validation of a string with an external command.
1131
+ The first argument of this function should be a string to
1132
+ test, and the second argument should be a path to a test command
1133
+ taking a file as last argument. If the command, launched against
1134
+ a tempfile containing the passed string, returns a non-null value,
1135
+ compilation will abort with a parse error.
1136
+
1137
+ If a third argument is specified, this will be the error message raised and
1138
+ seen by the user.
1139
+
1140
+ A helpful error message can be returned like this:
1141
+
1142
+ Example:
1143
+
1144
+ validate_cmd($sudoerscontent, '/usr/sbin/visudo -c -f', 'Visudo failed to validate sudoers content')
1145
+
1146
+
1147
+
1148
+ - *Type*: statement
1149
+
1150
+ validate_hash
1151
+ -------------
1152
+ Validate that all passed values are hash data structures. Abort catalog
1153
+ compilation if any value fails this check.
1154
+
1155
+ The following values will pass:
1156
+
1157
+ $my_hash = { 'one' => 'two' }
1158
+ validate_hash($my_hash)
1159
+
1160
+ The following values will fail, causing compilation to abort:
1161
+
1162
+ validate_hash(true)
1163
+ validate_hash('some_string')
1164
+ $undefined = undef
1165
+ validate_hash($undefined)
1166
+
1167
+
1168
+
1169
+ - *Type*: statement
1170
+
1171
+ validate_re
1172
+ -----------
1173
+ Perform simple validation of a string against one or more regular
1174
+ expressions. The first argument of this function should be a string to
1175
+ test, and the second argument should be a stringified regular expression
1176
+ (without the // delimiters) or an array of regular expressions. If none
1177
+ of the regular expressions match the string passed in, compilation will
1178
+ abort with a parse error.
1179
+
1180
+ If a third argument is specified, this will be the error message raised and
1181
+ seen by the user.
1182
+
1183
+ The following strings will validate against the regular expressions:
1184
+
1185
+ validate_re('one', '^one$')
1186
+ validate_re('one', [ '^one', '^two' ])
1187
+
1188
+ The following strings will fail to validate, causing compilation to abort:
1189
+
1190
+ validate_re('one', [ '^two', '^three' ])
1191
+
1192
+ A helpful error message can be returned like this:
1193
+
1194
+ validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7')
1195
+
1196
+
1197
+
1198
+ - *Type*: statement
1199
+
1200
+ validate_slength
1201
+ ----------------
1202
+ Validate that the first argument is a string (or an array of strings), and
1203
+ less/equal to than the length of the second argument. It fails if the first
1204
+ argument is not a string or array of strings, and if arg 2 is not convertable
1205
+ to a number.
1206
+
1207
+ The following values will pass:
1208
+
1209
+ validate_slength("discombobulate",17)
1210
+ validate_slength(["discombobulate","moo"],17)
1211
+
1212
+ The following values will not:
1213
+
1214
+ validate_slength("discombobulate",1)
1215
+ validate_slength(["discombobulate","thermometer"],5)
1216
+
1217
+
1218
+
1219
+ - *Type*: statement
1220
+
1221
+ validate_string
1222
+ ---------------
1223
+ Validate that all passed values are string data structures. Abort catalog
1224
+ compilation if any value fails this check.
1225
+
1226
+ The following values will pass:
1227
+
1228
+ $my_string = "one two"
1229
+ validate_string($my_string, 'three')
1230
+
1231
+ The following values will fail, causing compilation to abort:
1232
+
1233
+ validate_string(true)
1234
+ validate_string([ 'some', 'array' ])
1235
+ $undefined = undef
1236
+ validate_string($undefined)
1237
+
1238
+
1239
+ - *Type*: statement
1240
+
1241
+ values
1242
+ ------
1243
+ When given a hash this function will return the values of that hash.
1244
+
1245
+ *Examples:*
1246
+
1247
+ $hash = {
1248
+ 'a' => 1,
1249
+ 'b' => 2,
1250
+ 'c' => 3,
1251
+ }
1252
+ values($hash)
1253
+
1254
+ This example would return:
1255
+
1256
+ [1,2,3]
1257
+
1258
+
1259
+ - *Type*: rvalue
1260
+
1261
+ values_at
1262
+ ---------
1263
+ Finds value inside an array based on location.
1264
+
1265
+ The first argument is the array you want to analyze, and the second element can
1266
+ be a combination of:
1267
+
1268
+ * A single numeric index
1269
+ * A range in the form of 'start-stop' (eg. 4-9)
1270
+ * An array combining the above
1271
+
1272
+ *Examples*:
1273
+
1274
+ values_at(['a','b','c'], 2)
1275
+
1276
+ Would return ['c'].
1277
+
1278
+ values_at(['a','b','c'], ["0-1"])
1279
+
1280
+ Would return ['a','b'].
1281
+
1282
+ values_at(['a','b','c','d','e'], [0, "2-3"])
1283
+
1284
+ Would return ['a','c','d'].
1285
+
1286
+
1287
+ - *Type*: rvalue
1288
+
1289
+ zip
1290
+ ---
1291
+ Takes one element from first array and merges corresponding elements from second array. This generates a sequence of n-element arrays, where n is one more than the count of arguments.
1292
+
1293
+ *Example:*
1294
+
1295
+ zip(['1','2','3'],['4','5','6'])
1296
+
1297
+ Would result in:
1298
+
1299
+ ["1", "4"], ["2", "5"], ["3", "6"]
1300
+
1301
+
1302
+ - *Type*: rvalue
1303
+
1304
+ *This page autogenerated on 2013-04-11 13:54:25 -0700*