service_kiosk 0.5.0

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 (241) hide show
  1. data/Vagrantfile +25 -0
  2. data/bin/kiosk +55 -0
  3. data/bin/start_kiosk.sh +3 -0
  4. data/lib/Procfile.kiosk +1 -0
  5. data/lib/internal_service.rb +59 -0
  6. data/lib/json-simple-1.1.1.jar +0 -0
  7. data/lib/kiosk.rb +57 -0
  8. data/lib/kiosks/logger/output_logger.rb +16 -0
  9. data/lib/mall.rb +77 -0
  10. data/lib/mallcop.rb +9 -0
  11. data/lib/remote_service.rb +61 -0
  12. data/lib/tasks/local_mall.rake +93 -0
  13. data/provision/bootstrap.sh +21 -0
  14. data/provision/manifests/default.pp +49 -0
  15. data/provision/modules/apt/CHANGELOG +83 -0
  16. data/provision/modules/apt/LICENSE +19 -0
  17. data/provision/modules/apt/Modulefile +14 -0
  18. data/provision/modules/apt/README.md +119 -0
  19. data/provision/modules/apt/Rakefile +1 -0
  20. data/provision/modules/apt/manifests/backports.pp +48 -0
  21. data/provision/modules/apt/manifests/builddep.pp +16 -0
  22. data/provision/modules/apt/manifests/conf.pp +18 -0
  23. data/provision/modules/apt/manifests/debian/testing.pp +21 -0
  24. data/provision/modules/apt/manifests/debian/unstable.pp +21 -0
  25. data/provision/modules/apt/manifests/force.pp +24 -0
  26. data/provision/modules/apt/manifests/init.pp +114 -0
  27. data/provision/modules/apt/manifests/key.pp +80 -0
  28. data/provision/modules/apt/manifests/params.pp +23 -0
  29. data/provision/modules/apt/manifests/pin.pp +48 -0
  30. data/provision/modules/apt/manifests/ppa.pp +49 -0
  31. data/provision/modules/apt/manifests/release.pp +17 -0
  32. data/provision/modules/apt/manifests/source.pp +83 -0
  33. data/provision/modules/apt/manifests/update.pp +9 -0
  34. data/provision/modules/apt/spec/classes/apt_spec.rb +129 -0
  35. data/provision/modules/apt/spec/classes/backports_spec.rb +71 -0
  36. data/provision/modules/apt/spec/classes/debian_testing_spec.rb +14 -0
  37. data/provision/modules/apt/spec/classes/debian_unstable_spec.rb +14 -0
  38. data/provision/modules/apt/spec/classes/params_spec.rb +13 -0
  39. data/provision/modules/apt/spec/classes/release_spec.rb +22 -0
  40. data/provision/modules/apt/spec/defines/builddep_spec.rb +18 -0
  41. data/provision/modules/apt/spec/defines/conf_spec.rb +57 -0
  42. data/provision/modules/apt/spec/defines/force_spec.rb +41 -0
  43. data/provision/modules/apt/spec/defines/key_spec.rb +123 -0
  44. data/provision/modules/apt/spec/defines/pin_spec.rb +58 -0
  45. data/provision/modules/apt/spec/defines/ppa_spec.rb +92 -0
  46. data/provision/modules/apt/spec/defines/source_spec.rb +158 -0
  47. data/provision/modules/apt/spec/fixtures/manifests/site.pp +0 -0
  48. data/provision/modules/apt/spec/spec_helper.rb +1 -0
  49. data/provision/modules/apt/templates/pin.pref.erb +5 -0
  50. data/provision/modules/apt/templates/source.list.erb +5 -0
  51. data/provision/modules/apt/tests/builddep.pp +2 -0
  52. data/provision/modules/apt/tests/debian/testing.pp +2 -0
  53. data/provision/modules/apt/tests/debian/unstable.pp +2 -0
  54. data/provision/modules/apt/tests/force.pp +7 -0
  55. data/provision/modules/apt/tests/init.pp +1 -0
  56. data/provision/modules/apt/tests/key.pp +5 -0
  57. data/provision/modules/apt/tests/params.pp +1 -0
  58. data/provision/modules/apt/tests/pin.pp +5 -0
  59. data/provision/modules/apt/tests/ppa.pp +4 -0
  60. data/provision/modules/apt/tests/release.pp +4 -0
  61. data/provision/modules/apt/tests/source.pp +29 -0
  62. data/provision/modules/stdlib/CHANGELOG +177 -0
  63. data/provision/modules/stdlib/LICENSE +19 -0
  64. data/provision/modules/stdlib/Modulefile +11 -0
  65. data/provision/modules/stdlib/README.markdown +929 -0
  66. data/provision/modules/stdlib/README_DEVELOPER.markdown +35 -0
  67. data/provision/modules/stdlib/RELEASE_PROCESS.markdown +24 -0
  68. data/provision/modules/stdlib/Rakefile +2 -0
  69. data/provision/modules/stdlib/lib/facter/pe_version.rb +53 -0
  70. data/provision/modules/stdlib/lib/facter/puppet_vardir.rb +26 -0
  71. data/provision/modules/stdlib/lib/facter/root_home.rb +19 -0
  72. data/provision/modules/stdlib/lib/facter/util/puppet_settings.rb +21 -0
  73. data/provision/modules/stdlib/lib/puppet/parser/functions/abs.rb +36 -0
  74. data/provision/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +49 -0
  75. data/provision/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +34 -0
  76. data/provision/modules/stdlib/lib/puppet/parser/functions/chomp.rb +35 -0
  77. data/provision/modules/stdlib/lib/puppet/parser/functions/chop.rb +37 -0
  78. data/provision/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +35 -0
  79. data/provision/modules/stdlib/lib/puppet/parser/functions/delete.rb +46 -0
  80. data/provision/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +49 -0
  81. data/provision/modules/stdlib/lib/puppet/parser/functions/downcase.rb +33 -0
  82. data/provision/modules/stdlib/lib/puppet/parser/functions/empty.rb +28 -0
  83. data/provision/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +24 -0
  84. data/provision/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +35 -0
  85. data/provision/modules/stdlib/lib/puppet/parser/functions/flatten.rb +33 -0
  86. data/provision/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +46 -0
  87. data/provision/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +17 -0
  88. data/provision/modules/stdlib/lib/puppet/parser/functions/getvar.rb +26 -0
  89. data/provision/modules/stdlib/lib/puppet/parser/functions/grep.rb +33 -0
  90. data/provision/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +52 -0
  91. data/provision/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +25 -0
  92. data/provision/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +25 -0
  93. data/provision/modules/stdlib/lib/puppet/parser/functions/has_key.rb +28 -0
  94. data/provision/modules/stdlib/lib/puppet/parser/functions/hash.rb +41 -0
  95. data/provision/modules/stdlib/lib/puppet/parser/functions/is_array.rb +22 -0
  96. data/provision/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +47 -0
  97. data/provision/modules/stdlib/lib/puppet/parser/functions/is_float.rb +27 -0
  98. data/provision/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +22 -0
  99. data/provision/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +27 -0
  100. data/provision/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +32 -0
  101. data/provision/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +27 -0
  102. data/provision/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +27 -0
  103. data/provision/modules/stdlib/lib/puppet/parser/functions/is_string.rb +26 -0
  104. data/provision/modules/stdlib/lib/puppet/parser/functions/join.rb +41 -0
  105. data/provision/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +47 -0
  106. data/provision/modules/stdlib/lib/puppet/parser/functions/keys.rb +26 -0
  107. data/provision/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +20 -0
  108. data/provision/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +33 -0
  109. data/provision/modules/stdlib/lib/puppet/parser/functions/max.rb +13 -0
  110. data/provision/modules/stdlib/lib/puppet/parser/functions/member.rb +44 -0
  111. data/provision/modules/stdlib/lib/puppet/parser/functions/merge.rb +33 -0
  112. data/provision/modules/stdlib/lib/puppet/parser/functions/min.rb +13 -0
  113. data/provision/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +40 -0
  114. data/provision/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +24 -0
  115. data/provision/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +24 -0
  116. data/provision/modules/stdlib/lib/puppet/parser/functions/pick.rb +29 -0
  117. data/provision/modules/stdlib/lib/puppet/parser/functions/prefix.rb +45 -0
  118. data/provision/modules/stdlib/lib/puppet/parser/functions/range.rb +80 -0
  119. data/provision/modules/stdlib/lib/puppet/parser/functions/reject.rb +31 -0
  120. data/provision/modules/stdlib/lib/puppet/parser/functions/reverse.rb +28 -0
  121. data/provision/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +32 -0
  122. data/provision/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +46 -0
  123. data/provision/modules/stdlib/lib/puppet/parser/functions/size.rb +48 -0
  124. data/provision/modules/stdlib/lib/puppet/parser/functions/sort.rb +27 -0
  125. data/provision/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +36 -0
  126. data/provision/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +41 -0
  127. data/provision/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +32 -0
  128. data/provision/modules/stdlib/lib/puppet/parser/functions/strftime.rb +107 -0
  129. data/provision/modules/stdlib/lib/puppet/parser/functions/strip.rb +39 -0
  130. data/provision/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +39 -0
  131. data/provision/modules/stdlib/lib/puppet/parser/functions/time.rb +49 -0
  132. data/provision/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +28 -0
  133. data/provision/modules/stdlib/lib/puppet/parser/functions/type.rb +50 -0
  134. data/provision/modules/stdlib/lib/puppet/parser/functions/unique.rb +51 -0
  135. data/provision/modules/stdlib/lib/puppet/parser/functions/upcase.rb +41 -0
  136. data/provision/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +36 -0
  137. data/provision/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +56 -0
  138. data/provision/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +33 -0
  139. data/provision/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +34 -0
  140. data/provision/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +33 -0
  141. data/provision/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +40 -0
  142. data/provision/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +52 -0
  143. data/provision/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +33 -0
  144. data/provision/modules/stdlib/lib/puppet/parser/functions/values.rb +39 -0
  145. data/provision/modules/stdlib/lib/puppet/parser/functions/values_at.rb +98 -0
  146. data/provision/modules/stdlib/lib/puppet/parser/functions/zip.rb +65 -0
  147. data/provision/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +59 -0
  148. data/provision/modules/stdlib/lib/puppet/type/anchor.rb +41 -0
  149. data/provision/modules/stdlib/lib/puppet/type/file_line.rb +70 -0
  150. data/provision/modules/stdlib/manifests/init.pp +20 -0
  151. data/provision/modules/stdlib/manifests/stages.pp +43 -0
  152. data/provision/modules/stdlib/spec/functions/defined_with_params_spec.rb +37 -0
  153. data/provision/modules/stdlib/spec/functions/ensure_packages_spec.rb +42 -0
  154. data/provision/modules/stdlib/spec/functions/ensure_resource_spec.rb +40 -0
  155. data/provision/modules/stdlib/spec/monkey_patches/alias_should_to_must.rb +8 -0
  156. data/provision/modules/stdlib/spec/monkey_patches/publicize_methods.rb +10 -0
  157. data/provision/modules/stdlib/spec/spec.opts +6 -0
  158. data/provision/modules/stdlib/spec/spec_helper.rb +28 -0
  159. data/provision/modules/stdlib/spec/unit/facter/pe_version_spec.rb +76 -0
  160. data/provision/modules/stdlib/spec/unit/facter/root_home_spec.rb +40 -0
  161. data/provision/modules/stdlib/spec/unit/facter/util/puppet_settings_spec.rb +35 -0
  162. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/abs_spec.rb +25 -0
  163. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/bool2num_spec.rb +24 -0
  164. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/capitalize_spec.rb +19 -0
  165. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/chomp_spec.rb +19 -0
  166. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/chop_spec.rb +19 -0
  167. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/delete_at_spec.rb +19 -0
  168. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/delete_spec.rb +38 -0
  169. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/downcase_spec.rb +24 -0
  170. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/empty_spec.rb +23 -0
  171. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/flatten_spec.rb +23 -0
  172. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/fqdn_rotate_spec.rb +33 -0
  173. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/get_module_path_spec.rb +46 -0
  174. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/getvar_spec.rb +37 -0
  175. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/grep_spec.rb +19 -0
  176. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/has_interface_with_spec.rb +64 -0
  177. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_address_spec.rb +39 -0
  178. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/has_ip_network_spec.rb +36 -0
  179. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/has_key_spec.rb +42 -0
  180. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/hash_spec.rb +19 -0
  181. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_array_spec.rb +29 -0
  182. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_domain_name_spec.rb +64 -0
  183. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_float_spec.rb +29 -0
  184. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_hash_spec.rb +29 -0
  185. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_integer_spec.rb +29 -0
  186. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_ip_address_spec.rb +39 -0
  187. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_mac_address_spec.rb +29 -0
  188. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_numeric_spec.rb +29 -0
  189. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/is_string_spec.rb +34 -0
  190. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/join_keys_to_values_spec.rb +40 -0
  191. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/join_spec.rb +19 -0
  192. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/keys_spec.rb +21 -0
  193. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/lstrip_spec.rb +19 -0
  194. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/max_spec.rb +23 -0
  195. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/member_spec.rb +24 -0
  196. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/merge_spec.rb +47 -0
  197. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/min_spec.rb +23 -0
  198. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/num2bool_spec.rb +24 -0
  199. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/parsejson_spec.rb +22 -0
  200. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/parseyaml_spec.rb +24 -0
  201. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/pick_spec.rb +34 -0
  202. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/prefix_spec.rb +19 -0
  203. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/range_spec.rb +34 -0
  204. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/reject_spec.rb +20 -0
  205. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/reverse_spec.rb +19 -0
  206. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/rstrip_spec.rb +24 -0
  207. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/shuffle_spec.rb +24 -0
  208. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/size_spec.rb +24 -0
  209. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/sort_spec.rb +24 -0
  210. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/squeeze_spec.rb +24 -0
  211. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/str2bool_spec.rb +24 -0
  212. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/str2saltedsha512_spec.rb +45 -0
  213. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/strftime_spec.rb +29 -0
  214. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/strip_spec.rb +18 -0
  215. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/swapcase_spec.rb +19 -0
  216. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/time_spec.rb +29 -0
  217. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/to_bytes_spec.rb +58 -0
  218. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/type_spec.rb +43 -0
  219. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/unique_spec.rb +24 -0
  220. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/upcase_spec.rb +24 -0
  221. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/uriescape_spec.rb +24 -0
  222. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/validate_absolute_path_spec.rb +83 -0
  223. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/validate_array_spec.rb +38 -0
  224. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/validate_bool_spec.rb +51 -0
  225. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/validate_hash_spec.rb +43 -0
  226. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/validate_re_spec.rb +76 -0
  227. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/validate_slength_spec.rb +48 -0
  228. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/validate_string_spec.rb +60 -0
  229. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/values_at_spec.rb +38 -0
  230. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/values_spec.rb +31 -0
  231. data/provision/modules/stdlib/spec/unit/puppet/parser/functions/zip_spec.rb +15 -0
  232. data/provision/modules/stdlib/spec/unit/puppet/provider/file_line/ruby_spec.rb +127 -0
  233. data/provision/modules/stdlib/spec/unit/puppet/type/anchor_spec.rb +11 -0
  234. data/provision/modules/stdlib/spec/unit/puppet/type/file_line_spec.rb +69 -0
  235. data/provision/modules/stdlib/spec/watchr.rb +86 -0
  236. data/provision/modules/stdlib/tests/file_line.pp +9 -0
  237. data/provision/modules/stdlib/tests/has_interface_with.pp +10 -0
  238. data/provision/modules/stdlib/tests/has_ip_address.pp +3 -0
  239. data/provision/modules/stdlib/tests/has_ip_network.pp +4 -0
  240. data/provision/modules/stdlib/tests/init.pp +1 -0
  241. metadata +291 -0
@@ -0,0 +1,929 @@
1
+ # Puppet Labs Standard Library #
2
+
3
+ This module provides a "standard library" of resources for developing Puppet
4
+ Modules. This modules will include the following additions to Puppet
5
+
6
+ * Stages
7
+ * Facts
8
+ * Functions
9
+ * Defined resource types
10
+ * Types
11
+ * Providers
12
+
13
+ This module is officially curated and provided by Puppet Labs. The modules
14
+ Puppet Labs writes and distributes will make heavy use of this standard
15
+ library.
16
+
17
+ To report or research a bug with any part of this module, please go to
18
+ [http://projects.puppetlabs.com/projects/stdlib](http://projects.puppetlabs.com/projects/stdlib)
19
+
20
+ # Versions #
21
+
22
+ This module follows semver.org (v1.0.0) versioning guidelines. The standard
23
+ library module is released as part of [Puppet
24
+ Enterprise](http://puppetlabs.com/puppet/puppet-enterprise/) and as a result
25
+ older versions of Puppet Enterprise that Puppet Labs still supports will have
26
+ bugfix maintenance branches periodically "merged up" into master. The current
27
+ list of integration branches are:
28
+
29
+ * v2.1.x (v2.1.1 released in PE 1.2, 1.2.1, 1.2.3, 1.2.4)
30
+ * v2.2.x (Never released as part of PE, only to the Forge)
31
+ * v2.3.x (Released in PE 2.5.x)
32
+ * master (mainline development branch)
33
+
34
+ The first Puppet Enterprise version including the stdlib module is Puppet
35
+ Enterprise 1.2.
36
+
37
+ # Compatibility #
38
+
39
+ The stdlib module does not work with Puppet versions released prior to Puppet
40
+ 2.6.0.
41
+
42
+ ## stdlib 2.x ##
43
+
44
+ All stdlib releases in the 2.0 major version support Puppet 2.6 and Puppet 2.7.
45
+
46
+ ## stdlib 3.x ##
47
+
48
+ The 3.0 major release of stdlib drops support for Puppet 2.6. Stdlib 3.x
49
+ supports Puppet 2 and Puppet 3.
50
+
51
+ # Functions #
52
+
53
+ abs
54
+ ---
55
+ Returns the absolute value of a number, for example -34.56 becomes 34.56. Takes
56
+ a single integer and float value as an argument.
57
+
58
+
59
+ - *Type*: rvalue
60
+
61
+ bool2num
62
+ --------
63
+ Converts a boolean to a number. Converts the values:
64
+ false, f, 0, n, and no to 0
65
+ true, t, 1, y, and yes to 1
66
+ Requires a single boolean or string as an input.
67
+
68
+
69
+ - *Type*: rvalue
70
+
71
+ capitalize
72
+ ----------
73
+ Capitalizes the first letter of a string or array of strings.
74
+ Requires either a single string or an array as an input.
75
+
76
+
77
+ - *Type*: rvalue
78
+
79
+ chomp
80
+ -----
81
+ Removes the record separator from the end of a string or an array of strings,
82
+ for example `hello\n` becomes `hello`. Requires a single string or array as an
83
+ input.
84
+
85
+
86
+ - *Type*: rvalue
87
+
88
+ chop
89
+ ----
90
+ Returns a new string with the last character removed. If the string ends
91
+ with `\r\n`, both characters are removed. Applying chop to an empty
92
+ string returns an empty string. If you wish to merely remove record
93
+ separators then you should use the `chomp` function.
94
+ Requires a string or array of strings as input.
95
+
96
+
97
+ - *Type*: rvalue
98
+
99
+ defined_with_params
100
+ -------------------
101
+ Takes a resource reference and an optional hash of attributes.
102
+
103
+ Returns true if a resource with the specified attributes has already been added
104
+ to the catalog, and false otherwise.
105
+
106
+ user { 'dan':
107
+ ensure => present,
108
+ }
109
+
110
+ if ! defined_with_params(User[dan], {'ensure' => 'present' }) {
111
+ user { 'dan': ensure => present, }
112
+ }
113
+
114
+
115
+ - *Type*: rvalue
116
+
117
+ delete
118
+ ------
119
+ Deletes a selected element from an array.
120
+
121
+ *Examples:*
122
+
123
+ delete(['a','b','c'], 'b')
124
+
125
+ Would return: ['a','c']
126
+
127
+
128
+ - *Type*: rvalue
129
+
130
+ delete_at
131
+ ---------
132
+ Deletes a determined indexed value from an array.
133
+
134
+ *Examples:*
135
+
136
+ delete_at(['a','b','c'], 1)
137
+
138
+ Would return: ['a','c']
139
+
140
+
141
+ - *Type*: rvalue
142
+
143
+ downcase
144
+ --------
145
+ Converts the case of a string or all strings in an array to lower case.
146
+
147
+
148
+ - *Type*: rvalue
149
+
150
+ empty
151
+ -----
152
+ Returns true if the variable is empty.
153
+
154
+
155
+ - *Type*: rvalue
156
+
157
+ ensure_resource
158
+ ---------------
159
+ Takes a resource type, title, and a list of attributes that describe a
160
+ resource.
161
+
162
+ user { 'dan':
163
+ ensure => present,
164
+ }
165
+
166
+ This example only creates the resource if it does not already exist:
167
+
168
+ ensure_resource('user, 'dan', {'ensure' => 'present' })
169
+
170
+ If the resource already exists but does not match the specified parameters,
171
+ this function will attempt to recreate the resource leading to a duplicate
172
+ resource definition error.
173
+
174
+
175
+
176
+ - *Type*: statement
177
+
178
+ flatten
179
+ -------
180
+ This function flattens any deeply nested arrays and returns a single flat array
181
+ as a result.
182
+
183
+ *Examples:*
184
+
185
+ flatten(['a', ['b', ['c']]])
186
+
187
+ Would return: ['a','b','c']
188
+
189
+
190
+ - *Type*: rvalue
191
+
192
+ fqdn_rotate
193
+ -----------
194
+ Rotates an array a random number of times based on a nodes fqdn.
195
+
196
+
197
+ - *Type*: rvalue
198
+
199
+ get_module_path
200
+ ---------------
201
+ Returns the absolute path of the specified module for the current
202
+ environment.
203
+
204
+ Example:
205
+ $module_path = get_module_path('stdlib')
206
+
207
+
208
+ - *Type*: rvalue
209
+
210
+ getvar
211
+ ------
212
+ Lookup a variable in a remote namespace.
213
+
214
+ For example:
215
+
216
+ $foo = getvar('site::data::foo')
217
+ # Equivalent to $foo = $site::data::foo
218
+
219
+ This is useful if the namespace itself is stored in a string:
220
+
221
+ $datalocation = 'site::data'
222
+ $bar = getvar("${datalocation}::bar")
223
+ # Equivalent to $bar = $site::data::bar
224
+
225
+
226
+ - *Type*: rvalue
227
+
228
+ grep
229
+ ----
230
+ This function searches through an array and returns any elements that match
231
+ the provided regular expression.
232
+
233
+ *Examples:*
234
+
235
+ grep(['aaa','bbb','ccc','aaaddd'], 'aaa')
236
+
237
+ Would return:
238
+
239
+ ['aaa','aaaddd']
240
+
241
+
242
+ - *Type*: rvalue
243
+
244
+ has_key
245
+ -------
246
+ Determine if a hash has a certain key value.
247
+
248
+ Example:
249
+
250
+ $my_hash = {'key_one' => 'value_one'}
251
+ if has_key($my_hash, 'key_two') {
252
+ notice('we will not reach here')
253
+ }
254
+ if has_key($my_hash, 'key_one') {
255
+ notice('this will be printed')
256
+ }
257
+
258
+
259
+
260
+ - *Type*: rvalue
261
+
262
+ hash
263
+ ----
264
+ This function converts and array into a hash.
265
+
266
+ *Examples:*
267
+
268
+ hash(['a',1,'b',2,'c',3])
269
+
270
+ Would return: {'a'=>1,'b'=>2,'c'=>3}
271
+
272
+
273
+ - *Type*: rvalue
274
+
275
+ is_array
276
+ --------
277
+ Returns true if the variable passed to this function is an array.
278
+
279
+
280
+ - *Type*: rvalue
281
+
282
+ is_domain_name
283
+ --------------
284
+ Returns true if the string passed to this function is a syntactically correct domain name.
285
+
286
+
287
+ - *Type*: rvalue
288
+
289
+ is_float
290
+ --------
291
+ Returns true if the variable passed to this function is a float.
292
+
293
+
294
+ - *Type*: rvalue
295
+
296
+ is_hash
297
+ -------
298
+ Returns true if the variable passed to this function is a hash.
299
+
300
+
301
+ - *Type*: rvalue
302
+
303
+ is_integer
304
+ ----------
305
+ Returns true if the variable returned to this string is an integer.
306
+
307
+
308
+ - *Type*: rvalue
309
+
310
+ is_ip_address
311
+ -------------
312
+ Returns true if the string passed to this function is a valid IP address.
313
+
314
+
315
+ - *Type*: rvalue
316
+
317
+ is_mac_address
318
+ --------------
319
+ Returns true if the string passed to this function is a valid mac address.
320
+
321
+
322
+ - *Type*: rvalue
323
+
324
+ is_numeric
325
+ ----------
326
+ Returns true if the variable passed to this function is a number.
327
+
328
+
329
+ - *Type*: rvalue
330
+
331
+ is_string
332
+ ---------
333
+ Returns true if the variable passed to this function is a string.
334
+
335
+
336
+ - *Type*: rvalue
337
+
338
+ join
339
+ ----
340
+ This function joins an array into a string using a seperator.
341
+
342
+ *Examples:*
343
+
344
+ join(['a','b','c'], ",")
345
+
346
+ Would result in: "a,b,c"
347
+
348
+
349
+ - *Type*: rvalue
350
+
351
+ keys
352
+ ----
353
+ Returns the keys of a hash as an array.
354
+
355
+
356
+ - *Type*: rvalue
357
+
358
+ loadyaml
359
+ --------
360
+ Load a YAML file containing an array, string, or hash, and return the data
361
+ in the corresponding native data type.
362
+
363
+ For example:
364
+
365
+ $myhash = loadyaml('/etc/puppet/data/myhash.yaml')
366
+
367
+
368
+ - *Type*: rvalue
369
+
370
+ lstrip
371
+ ------
372
+ Strips leading spaces to the left of a string.
373
+
374
+
375
+ - *Type*: rvalue
376
+
377
+ member
378
+ ------
379
+ This function determines if a variable is a member of an array.
380
+
381
+ *Examples:*
382
+
383
+ member(['a','b'], 'b')
384
+
385
+ Would return: true
386
+
387
+ member(['a','b'], 'c')
388
+
389
+ Would return: false
390
+
391
+
392
+ - *Type*: rvalue
393
+
394
+ merge
395
+ -----
396
+ Merges two or more hashes together and returns the resulting hash.
397
+
398
+ For example:
399
+
400
+ $hash1 = {'one' => 1, 'two', => 2}
401
+ $hash2 = {'two' => 'dos', 'three', => 'tres'}
402
+ $merged_hash = merge($hash1, $hash2)
403
+ # The resulting hash is equivalent to:
404
+ # $merged_hash = {'one' => 1, 'two' => 'dos', 'three' => 'tres'}
405
+
406
+ When there is a duplicate key, the key in the rightmost hash will "win."
407
+
408
+
409
+
410
+ - *Type*: rvalue
411
+
412
+ num2bool
413
+ --------
414
+ This function converts a number into a true boolean. Zero becomes false. Numbers
415
+ higher then 0 become true.
416
+
417
+
418
+ - *Type*: rvalue
419
+
420
+ parsejson
421
+ ---------
422
+ This function accepts JSON as a string and converts into the correct Puppet
423
+ structure.
424
+
425
+
426
+ - *Type*: rvalue
427
+
428
+ parseyaml
429
+ ---------
430
+ This function accepts YAML as a string and converts it into the correct
431
+ Puppet structure.
432
+
433
+
434
+ - *Type*: rvalue
435
+
436
+ prefix
437
+ ------
438
+ This function applies a prefix to all elements in an array.
439
+
440
+ *Examles:*
441
+
442
+ prefix(['a','b','c'], 'p')
443
+
444
+ Will return: ['pa','pb','pc']
445
+
446
+
447
+ - *Type*: rvalue
448
+
449
+ range
450
+ -----
451
+ When given range in the form of (start, stop) it will extrapolate a range as
452
+ an array.
453
+
454
+ *Examples:*
455
+
456
+ range("0", "9")
457
+
458
+ Will return: [0,1,2,3,4,5,6,7,8,9]
459
+
460
+ range("00", "09")
461
+
462
+ Will return: [0,1,2,3,4,5,6,7,8,9] (Zero padded strings are converted to
463
+ integers automatically)
464
+
465
+ range("a", "c")
466
+
467
+ Will return: ["a","b","c"]
468
+
469
+ range("host01", "host10")
470
+
471
+ Will return: ["host01", "host02", ..., "host09", "host10"]
472
+
473
+
474
+ - *Type*: rvalue
475
+
476
+ reverse
477
+ -------
478
+ Reverses the order of a string or array.
479
+
480
+
481
+ - *Type*: rvalue
482
+
483
+ rstrip
484
+ ------
485
+ Strips leading spaces to the right of the string.
486
+
487
+
488
+ - *Type*: rvalue
489
+
490
+ shuffle
491
+ -------
492
+ Randomizes the order of a string or array elements.
493
+
494
+
495
+ - *Type*: rvalue
496
+
497
+ size
498
+ ----
499
+ Returns the number of elements in a string or array.
500
+
501
+
502
+ - *Type*: rvalue
503
+
504
+ sort
505
+ ----
506
+ Sorts strings and arrays lexically.
507
+
508
+
509
+ - *Type*: rvalue
510
+
511
+ squeeze
512
+ -------
513
+ Returns a new string where runs of the same character that occur in this set
514
+ are replaced by a single character.
515
+
516
+
517
+ - *Type*: rvalue
518
+
519
+ str2bool
520
+ --------
521
+ This converts a string to a boolean. This attempt to convert strings that
522
+ contain things like: y, 1, t, true to 'true' and strings that contain things
523
+ like: 0, f, n, false, no to 'false'.
524
+
525
+
526
+ - *Type*: rvalue
527
+
528
+ str2saltedsha512
529
+ ----------------
530
+ This converts a string to a salted-SHA512 password hash (which is used for OS X
531
+ versions >= 10.7). Given any simple string, you will get a hex version of a
532
+ salted-SHA512 password hash that can be inserted into your Puppet manifests as
533
+ a valid password attribute.
534
+
535
+
536
+ - *Type*: rvalue
537
+
538
+ strftime
539
+ --------
540
+ This function returns formatted time.
541
+
542
+ *Examples:*
543
+
544
+ To return the time since epoch:
545
+
546
+ strftime("%s")
547
+
548
+ To return the date:
549
+
550
+ strftime("%Y-%m-%d")
551
+
552
+ *Format meaning:*
553
+
554
+ %a - The abbreviated weekday name (``Sun'')
555
+ %A - The full weekday name (``Sunday'')
556
+ %b - The abbreviated month name (``Jan'')
557
+ %B - The full month name (``January'')
558
+ %c - The preferred local date and time representation
559
+ %C - Century (20 in 2009)
560
+ %d - Day of the month (01..31)
561
+ %D - Date (%m/%d/%y)
562
+ %e - Day of the month, blank-padded ( 1..31)
563
+ %F - Equivalent to %Y-%m-%d (the ISO 8601 date format)
564
+ %h - Equivalent to %b
565
+ %H - Hour of the day, 24-hour clock (00..23)
566
+ %I - Hour of the day, 12-hour clock (01..12)
567
+ %j - Day of the year (001..366)
568
+ %k - hour, 24-hour clock, blank-padded ( 0..23)
569
+ %l - hour, 12-hour clock, blank-padded ( 0..12)
570
+ %L - Millisecond of the second (000..999)
571
+ %m - Month of the year (01..12)
572
+ %M - Minute of the hour (00..59)
573
+ %n - Newline (
574
+ )
575
+ %N - Fractional seconds digits, default is 9 digits (nanosecond)
576
+ %3N millisecond (3 digits)
577
+ %6N microsecond (6 digits)
578
+ %9N nanosecond (9 digits)
579
+ %p - Meridian indicator (``AM'' or ``PM'')
580
+ %P - Meridian indicator (``am'' or ``pm'')
581
+ %r - time, 12-hour (same as %I:%M:%S %p)
582
+ %R - time, 24-hour (%H:%M)
583
+ %s - Number of seconds since 1970-01-01 00:00:00 UTC.
584
+ %S - Second of the minute (00..60)
585
+ %t - Tab character ( )
586
+ %T - time, 24-hour (%H:%M:%S)
587
+ %u - Day of the week as a decimal, Monday being 1. (1..7)
588
+ %U - Week number of the current year,
589
+ starting with the first Sunday as the first
590
+ day of the first week (00..53)
591
+ %v - VMS date (%e-%b-%Y)
592
+ %V - Week number of year according to ISO 8601 (01..53)
593
+ %W - Week number of the current year,
594
+ starting with the first Monday as the first
595
+ day of the first week (00..53)
596
+ %w - Day of the week (Sunday is 0, 0..6)
597
+ %x - Preferred representation for the date alone, no time
598
+ %X - Preferred representation for the time alone, no date
599
+ %y - Year without a century (00..99)
600
+ %Y - Year with century
601
+ %z - Time zone as hour offset from UTC (e.g. +0900)
602
+ %Z - Time zone name
603
+ %% - Literal ``%'' character
604
+
605
+
606
+ - *Type*: rvalue
607
+
608
+ strip
609
+ -----
610
+ This function removes leading and trailing whitespace from a string or from
611
+ every string inside an array.
612
+
613
+ *Examples:*
614
+
615
+ strip(" aaa ")
616
+
617
+ Would result in: "aaa"
618
+
619
+
620
+ - *Type*: rvalue
621
+
622
+ swapcase
623
+ --------
624
+ This function will swap the existing case of a string.
625
+
626
+ *Examples:*
627
+
628
+ swapcase("aBcD")
629
+
630
+ Would result in: "AbCd"
631
+
632
+
633
+ - *Type*: rvalue
634
+
635
+ time
636
+ ----
637
+ This function will return the current time since epoch as an integer.
638
+
639
+ *Examples:*
640
+
641
+ time()
642
+
643
+ Will return something like: 1311972653
644
+
645
+
646
+ - *Type*: rvalue
647
+
648
+ to_bytes
649
+ --------
650
+ Converts the argument into bytes, for example 4 kB becomes 4096.
651
+ Takes a single string value as an argument.
652
+
653
+
654
+ - *Type*: rvalue
655
+
656
+ type
657
+ ----
658
+ Returns the type when passed a variable. Type can be one of:
659
+
660
+ * string
661
+ * array
662
+ * hash
663
+ * float
664
+ * integer
665
+ * boolean
666
+
667
+
668
+ - *Type*: rvalue
669
+
670
+ unique
671
+ ------
672
+ This function will remove duplicates from strings and arrays.
673
+
674
+ *Examples:*
675
+
676
+ unique("aabbcc")
677
+
678
+ Will return:
679
+
680
+ abc
681
+
682
+ You can also use this with arrays:
683
+
684
+ unique(["a","a","b","b","c","c"])
685
+
686
+ This returns:
687
+
688
+ ["a","b","c"]
689
+
690
+
691
+ - *Type*: rvalue
692
+
693
+ upcase
694
+ ------
695
+ Converts a string or an array of strings to uppercase.
696
+
697
+ *Examples:*
698
+
699
+ upcase("abcd")
700
+
701
+ Will return:
702
+
703
+ ABCD
704
+
705
+
706
+ - *Type*: rvalue
707
+
708
+ validate_absolute_path
709
+ ----------------------
710
+ Validate the string represents an absolute path in the filesystem. This function works
711
+ for windows and unix style paths.
712
+
713
+ The following values will pass:
714
+
715
+ $my_path = "C:/Program Files (x86)/Puppet Labs/Puppet"
716
+ validate_absolute_path($my_path)
717
+ $my_path2 = "/var/lib/puppet"
718
+ validate_absolute_path($my_path2)
719
+
720
+
721
+ The following values will fail, causing compilation to abort:
722
+
723
+ validate_absolute_path(true)
724
+ validate_absolute_path([ 'var/lib/puppet', '/var/foo' ])
725
+ validate_absolute_path([ '/var/lib/puppet', 'var/foo' ])
726
+ $undefined = undef
727
+ validate_absolute_path($undefined)
728
+
729
+
730
+
731
+ - *Type*: statement
732
+
733
+ validate_array
734
+ --------------
735
+ Validate that all passed values are array data structures. Abort catalog
736
+ compilation if any value fails this check.
737
+
738
+ The following values will pass:
739
+
740
+ $my_array = [ 'one', 'two' ]
741
+ validate_array($my_array)
742
+
743
+ The following values will fail, causing compilation to abort:
744
+
745
+ validate_array(true)
746
+ validate_array('some_string')
747
+ $undefined = undef
748
+ validate_array($undefined)
749
+
750
+
751
+
752
+ - *Type*: statement
753
+
754
+ validate_bool
755
+ -------------
756
+ Validate that all passed values are either true or false. Abort catalog
757
+ compilation if any value fails this check.
758
+
759
+ The following values will pass:
760
+
761
+ $iamtrue = true
762
+ validate_bool(true)
763
+ validate_bool(true, true, false, $iamtrue)
764
+
765
+ The following values will fail, causing compilation to abort:
766
+
767
+ $some_array = [ true ]
768
+ validate_bool("false")
769
+ validate_bool("true")
770
+ validate_bool($some_array)
771
+
772
+
773
+
774
+ - *Type*: statement
775
+
776
+ validate_hash
777
+ -------------
778
+ Validate that all passed values are hash data structures. Abort catalog
779
+ compilation if any value fails this check.
780
+
781
+ The following values will pass:
782
+
783
+ $my_hash = { 'one' => 'two' }
784
+ validate_hash($my_hash)
785
+
786
+ The following values will fail, causing compilation to abort:
787
+
788
+ validate_hash(true)
789
+ validate_hash('some_string')
790
+ $undefined = undef
791
+ validate_hash($undefined)
792
+
793
+
794
+
795
+ - *Type*: statement
796
+
797
+ validate_re
798
+ -----------
799
+ Perform simple validation of a string against one or more regular
800
+ expressions. The first argument of this function should be a string to
801
+ test, and the second argument should be a stringified regular expression
802
+ (without the // delimiters) or an array of regular expressions. If none
803
+ of the regular expressions match the string passed in, compilation will
804
+ abort with a parse error.
805
+
806
+ If a third argument is specified, this will be the error message raised and
807
+ seen by the user.
808
+
809
+ The following strings will validate against the regular expressions:
810
+
811
+ validate_re('one', '^one$')
812
+ validate_re('one', [ '^one', '^two' ])
813
+
814
+ The following strings will fail to validate, causing compilation to abort:
815
+
816
+ validate_re('one', [ '^two', '^three' ])
817
+
818
+ A helpful error message can be returned like this:
819
+
820
+ validate_re($::puppetversion, '^2.7', 'The $puppetversion fact value does not match 2.7')
821
+
822
+
823
+
824
+ - *Type*: statement
825
+
826
+ validate_slength
827
+ ----------------
828
+ Validate that the first argument is a string (or an array of strings), and
829
+ less/equal to than the length of the second argument. It fails if the first
830
+ argument is not a string or array of strings, and if arg 2 is not convertable
831
+ to a number.
832
+
833
+ The following values will pass:
834
+
835
+ validate_slength("discombobulate",17)
836
+ validate_slength(["discombobulate","moo"],17)
837
+
838
+ The following valueis will not:
839
+
840
+ validate_slength("discombobulate",1)
841
+ validate_slength(["discombobulate","thermometer"],5)
842
+
843
+
844
+
845
+ - *Type*: statement
846
+
847
+ validate_string
848
+ ---------------
849
+ Validate that all passed values are string data structures. Abort catalog
850
+ compilation if any value fails this check.
851
+
852
+ The following values will pass:
853
+
854
+ $my_string = "one two"
855
+ validate_string($my_string, 'three')
856
+
857
+ The following values will fail, causing compilation to abort:
858
+
859
+ validate_string(true)
860
+ validate_string([ 'some', 'array' ])
861
+ $undefined = undef
862
+ validate_string($undefined)
863
+
864
+
865
+
866
+ - *Type*: statement
867
+
868
+ values
869
+ ------
870
+ When given a hash this function will return the values of that hash.
871
+
872
+ *Examples:*
873
+
874
+ $hash = {
875
+ 'a' => 1,
876
+ 'b' => 2,
877
+ 'c' => 3,
878
+ }
879
+ values($hash)
880
+
881
+ This example would return:
882
+
883
+ [1,2,3]
884
+
885
+
886
+ - *Type*: rvalue
887
+
888
+ values_at
889
+ ---------
890
+ Finds value inside an array based on location.
891
+
892
+ The first argument is the array you want to analyze, and the second element can
893
+ be a combination of:
894
+
895
+ * A single numeric index
896
+ * A range in the form of 'start-stop' (eg. 4-9)
897
+ * An array combining the above
898
+
899
+ *Examples*:
900
+
901
+ values_at(['a','b','c'], 2)
902
+
903
+ Would return ['c'].
904
+
905
+ values_at(['a','b','c'], ["0-1"])
906
+
907
+ Would return ['a','b'].
908
+
909
+ values_at(['a','b','c','d','e'], [0, "2-3"])
910
+
911
+ Would return ['a','c','d'].
912
+
913
+
914
+ - *Type*: rvalue
915
+
916
+ zip
917
+ ---
918
+ 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.
919
+
920
+ *Example:*
921
+
922
+ zip(['1','2','3'],['4','5','6'])
923
+
924
+ Would result in:
925
+
926
+ ["1", "4"], ["2", "5"], ["3", "6"]
927
+
928
+
929
+ - *Type*: rvalue