bolt 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bolt might be problematic. Click here for more details.

Files changed (1155) hide show
  1. checksums.yaml +4 -4
  2. data/bolt-modules/boltlib/lib/puppet/datatypes/applyresult.rb +19 -0
  3. data/bolt-modules/boltlib/lib/puppet/datatypes/resultset.rb +3 -3
  4. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +2 -1
  5. data/lib/bolt/analytics.rb +0 -1
  6. data/lib/bolt/applicator.rb +7 -54
  7. data/lib/bolt/apply_result.rb +116 -0
  8. data/lib/bolt/outputter/human.rb +13 -8
  9. data/lib/bolt/pal.rb +6 -2
  10. data/lib/bolt/transport/ssh.rb +2 -1
  11. data/lib/bolt/version.rb +1 -1
  12. data/lib/bolt_spec/run.rb +1 -0
  13. data/libexec/apply_catalog.rb +25 -30
  14. metadata +37 -1212
  15. data/vendored/facter/lib/facter.rb +0 -261
  16. data/vendored/facter/lib/facter/Cfkey.rb +0 -42
  17. data/vendored/facter/lib/facter/application.rb +0 -206
  18. data/vendored/facter/lib/facter/architecture.rb +0 -50
  19. data/vendored/facter/lib/facter/augeasversion.rb +0 -28
  20. data/vendored/facter/lib/facter/blockdevices.rb +0 -105
  21. data/vendored/facter/lib/facter/core/aggregate.rb +0 -220
  22. data/vendored/facter/lib/facter/core/directed_graph.rb +0 -46
  23. data/vendored/facter/lib/facter/core/execution.rb +0 -123
  24. data/vendored/facter/lib/facter/core/execution/base.rb +0 -81
  25. data/vendored/facter/lib/facter/core/execution/posix.rb +0 -50
  26. data/vendored/facter/lib/facter/core/execution/windows.rb +0 -57
  27. data/vendored/facter/lib/facter/core/logging.rb +0 -197
  28. data/vendored/facter/lib/facter/core/resolvable.rb +0 -94
  29. data/vendored/facter/lib/facter/core/suitable.rb +0 -113
  30. data/vendored/facter/lib/facter/dhcp_servers.rb +0 -45
  31. data/vendored/facter/lib/facter/domain.rb +0 -99
  32. data/vendored/facter/lib/facter/ec2.rb +0 -68
  33. data/vendored/facter/lib/facter/ec2/rest.rb +0 -137
  34. data/vendored/facter/lib/facter/facterversion.rb +0 -15
  35. data/vendored/facter/lib/facter/filesystems.rb +0 -45
  36. data/vendored/facter/lib/facter/fqdn.rb +0 -24
  37. data/vendored/facter/lib/facter/gce.rb +0 -16
  38. data/vendored/facter/lib/facter/gce/metadata.rb +0 -87
  39. data/vendored/facter/lib/facter/gid.rb +0 -25
  40. data/vendored/facter/lib/facter/hardwareisa.rb +0 -20
  41. data/vendored/facter/lib/facter/hardwaremodel.rb +0 -67
  42. data/vendored/facter/lib/facter/hostname.rb +0 -31
  43. data/vendored/facter/lib/facter/id.rb +0 -21
  44. data/vendored/facter/lib/facter/interfaces.rb +0 -58
  45. data/vendored/facter/lib/facter/ipaddress.rb +0 -169
  46. data/vendored/facter/lib/facter/ipaddress6.rb +0 -82
  47. data/vendored/facter/lib/facter/iphostnumber.rb +0 -29
  48. data/vendored/facter/lib/facter/kernel.rb +0 -22
  49. data/vendored/facter/lib/facter/kernelmajversion.rb +0 -23
  50. data/vendored/facter/lib/facter/kernelrelease.rb +0 -45
  51. data/vendored/facter/lib/facter/kernelversion.rb +0 -22
  52. data/vendored/facter/lib/facter/ldom.rb +0 -51
  53. data/vendored/facter/lib/facter/lsbdistcodename.rb +0 -20
  54. data/vendored/facter/lib/facter/lsbdistdescription.rb +0 -21
  55. data/vendored/facter/lib/facter/lsbdistid.rb +0 -20
  56. data/vendored/facter/lib/facter/lsbdistrelease.rb +0 -20
  57. data/vendored/facter/lib/facter/lsbmajdistrelease.rb +0 -22
  58. data/vendored/facter/lib/facter/lsbminordistrelease.rb +0 -22
  59. data/vendored/facter/lib/facter/lsbrelease.rb +0 -20
  60. data/vendored/facter/lib/facter/macaddress.rb +0 -99
  61. data/vendored/facter/lib/facter/macosx.rb +0 -56
  62. data/vendored/facter/lib/facter/manufacturer.rb +0 -68
  63. data/vendored/facter/lib/facter/memory.rb +0 -168
  64. data/vendored/facter/lib/facter/netmask.rb +0 -43
  65. data/vendored/facter/lib/facter/network.rb +0 -20
  66. data/vendored/facter/lib/facter/operatingsystem.rb +0 -24
  67. data/vendored/facter/lib/facter/operatingsystem/base.rb +0 -61
  68. data/vendored/facter/lib/facter/operatingsystem/cumuluslinux.rb +0 -27
  69. data/vendored/facter/lib/facter/operatingsystem/implementation.rb +0 -33
  70. data/vendored/facter/lib/facter/operatingsystem/linux.rb +0 -484
  71. data/vendored/facter/lib/facter/operatingsystem/osreleaselinux.rb +0 -28
  72. data/vendored/facter/lib/facter/operatingsystem/sunos.rb +0 -54
  73. data/vendored/facter/lib/facter/operatingsystem/vmkernel.rb +0 -11
  74. data/vendored/facter/lib/facter/operatingsystem/windows.rb +0 -43
  75. data/vendored/facter/lib/facter/operatingsystemmajrelease.rb +0 -31
  76. data/vendored/facter/lib/facter/operatingsystemrelease.rb +0 -29
  77. data/vendored/facter/lib/facter/os.rb +0 -98
  78. data/vendored/facter/lib/facter/osfamily.rb +0 -18
  79. data/vendored/facter/lib/facter/partitions.rb +0 -39
  80. data/vendored/facter/lib/facter/path.rb +0 -14
  81. data/vendored/facter/lib/facter/physicalprocessorcount.rb +0 -27
  82. data/vendored/facter/lib/facter/processor.rb +0 -52
  83. data/vendored/facter/lib/facter/processors.rb +0 -66
  84. data/vendored/facter/lib/facter/processors/os.rb +0 -244
  85. data/vendored/facter/lib/facter/ps.rb +0 -31
  86. data/vendored/facter/lib/facter/puppetversion.rb +0 -20
  87. data/vendored/facter/lib/facter/rackspace.rb +0 -37
  88. data/vendored/facter/lib/facter/rubyplatform.rb +0 -12
  89. data/vendored/facter/lib/facter/rubysitedir.rb +0 -15
  90. data/vendored/facter/lib/facter/rubyversion.rb +0 -12
  91. data/vendored/facter/lib/facter/selinux.rb +0 -154
  92. data/vendored/facter/lib/facter/ssh.rb +0 -73
  93. data/vendored/facter/lib/facter/system32.rb +0 -21
  94. data/vendored/facter/lib/facter/system_uptime.rb +0 -44
  95. data/vendored/facter/lib/facter/timezone.rb +0 -14
  96. data/vendored/facter/lib/facter/uniqueid.rb +0 -4
  97. data/vendored/facter/lib/facter/uptime.rb +0 -16
  98. data/vendored/facter/lib/facter/uptime_days.rb +0 -13
  99. data/vendored/facter/lib/facter/uptime_hours.rb +0 -13
  100. data/vendored/facter/lib/facter/uptime_seconds.rb +0 -20
  101. data/vendored/facter/lib/facter/util/architecture.rb +0 -19
  102. data/vendored/facter/lib/facter/util/collection.rb +0 -161
  103. data/vendored/facter/lib/facter/util/composite_loader.rb +0 -12
  104. data/vendored/facter/lib/facter/util/config.rb +0 -88
  105. data/vendored/facter/lib/facter/util/confine.rb +0 -66
  106. data/vendored/facter/lib/facter/util/dhcp_servers.rb +0 -58
  107. data/vendored/facter/lib/facter/util/directory_loader.rb +0 -88
  108. data/vendored/facter/lib/facter/util/ec2.rb +0 -106
  109. data/vendored/facter/lib/facter/util/fact.rb +0 -204
  110. data/vendored/facter/lib/facter/util/file_read.rb +0 -37
  111. data/vendored/facter/lib/facter/util/formatter.rb +0 -39
  112. data/vendored/facter/lib/facter/util/ip.rb +0 -340
  113. data/vendored/facter/lib/facter/util/ip/windows.rb +0 -215
  114. data/vendored/facter/lib/facter/util/loader.rb +0 -155
  115. data/vendored/facter/lib/facter/util/macaddress.rb +0 -43
  116. data/vendored/facter/lib/facter/util/macosx.rb +0 -73
  117. data/vendored/facter/lib/facter/util/manufacturer.rb +0 -99
  118. data/vendored/facter/lib/facter/util/memory.rb +0 -228
  119. data/vendored/facter/lib/facter/util/netmask.rb +0 -40
  120. data/vendored/facter/lib/facter/util/normalization.rb +0 -94
  121. data/vendored/facter/lib/facter/util/nothing_loader.rb +0 -12
  122. data/vendored/facter/lib/facter/util/operatingsystem.rb +0 -21
  123. data/vendored/facter/lib/facter/util/parser.rb +0 -168
  124. data/vendored/facter/lib/facter/util/partitions.rb +0 -47
  125. data/vendored/facter/lib/facter/util/partitions/linux.rb +0 -71
  126. data/vendored/facter/lib/facter/util/partitions/openbsd.rb +0 -40
  127. data/vendored/facter/lib/facter/util/plist.rb +0 -24
  128. data/vendored/facter/lib/facter/util/plist/generator.rb +0 -228
  129. data/vendored/facter/lib/facter/util/plist/parser.rb +0 -226
  130. data/vendored/facter/lib/facter/util/posix.rb +0 -16
  131. data/vendored/facter/lib/facter/util/processor.rb +0 -289
  132. data/vendored/facter/lib/facter/util/registry.rb +0 -11
  133. data/vendored/facter/lib/facter/util/resolution.rb +0 -160
  134. data/vendored/facter/lib/facter/util/solaris_zones.rb +0 -158
  135. data/vendored/facter/lib/facter/util/unix_root.rb +0 -5
  136. data/vendored/facter/lib/facter/util/uptime.rb +0 -83
  137. data/vendored/facter/lib/facter/util/values.rb +0 -109
  138. data/vendored/facter/lib/facter/util/virtual.rb +0 -212
  139. data/vendored/facter/lib/facter/util/vlans.rb +0 -21
  140. data/vendored/facter/lib/facter/util/windows.rb +0 -10
  141. data/vendored/facter/lib/facter/util/windows/api_types.rb +0 -135
  142. data/vendored/facter/lib/facter/util/windows/dir.rb +0 -43
  143. data/vendored/facter/lib/facter/util/windows/error.rb +0 -87
  144. data/vendored/facter/lib/facter/util/windows/process.rb +0 -294
  145. data/vendored/facter/lib/facter/util/windows/user.rb +0 -186
  146. data/vendored/facter/lib/facter/util/windows_root.rb +0 -7
  147. data/vendored/facter/lib/facter/util/wmi.rb +0 -49
  148. data/vendored/facter/lib/facter/util/xendomains.rb +0 -28
  149. data/vendored/facter/lib/facter/version.rb +0 -86
  150. data/vendored/facter/lib/facter/virtual.rb +0 -330
  151. data/vendored/facter/lib/facter/vlans.rb +0 -17
  152. data/vendored/facter/lib/facter/xendomains.rb +0 -20
  153. data/vendored/facter/lib/facter/zfs_version.rb +0 -14
  154. data/vendored/facter/lib/facter/zonename.rb +0 -6
  155. data/vendored/facter/lib/facter/zones.rb +0 -18
  156. data/vendored/facter/lib/facter/zpool_version.rb +0 -10
  157. data/vendored/hiera/lib/hiera.rb +0 -119
  158. data/vendored/hiera/lib/hiera/backend.rb +0 -360
  159. data/vendored/hiera/lib/hiera/backend/json_backend.rb +0 -58
  160. data/vendored/hiera/lib/hiera/backend/yaml_backend.rb +0 -63
  161. data/vendored/hiera/lib/hiera/config.rb +0 -97
  162. data/vendored/hiera/lib/hiera/console_logger.rb +0 -13
  163. data/vendored/hiera/lib/hiera/error.rb +0 -4
  164. data/vendored/hiera/lib/hiera/fallback_logger.rb +0 -41
  165. data/vendored/hiera/lib/hiera/filecache.rb +0 -86
  166. data/vendored/hiera/lib/hiera/interpolate.rb +0 -121
  167. data/vendored/hiera/lib/hiera/noop_logger.rb +0 -8
  168. data/vendored/hiera/lib/hiera/puppet_logger.rb +0 -17
  169. data/vendored/hiera/lib/hiera/recursive_guard.rb +0 -20
  170. data/vendored/hiera/lib/hiera/util.rb +0 -65
  171. data/vendored/hiera/lib/hiera/util/win32.rb +0 -40
  172. data/vendored/hiera/lib/hiera/version.rb +0 -89
  173. data/vendored/puppet/lib/hiera/puppet_function.rb +0 -84
  174. data/vendored/puppet/lib/hiera/scope.rb +0 -83
  175. data/vendored/puppet/lib/hiera_puppet.rb +0 -79
  176. data/vendored/puppet/lib/puppet.rb +0 -299
  177. data/vendored/puppet/lib/puppet/agent.rb +0 -134
  178. data/vendored/puppet/lib/puppet/agent/disabler.rb +0 -53
  179. data/vendored/puppet/lib/puppet/agent/locker.rb +0 -53
  180. data/vendored/puppet/lib/puppet/application.rb +0 -509
  181. data/vendored/puppet/lib/puppet/application/agent.rb +0 -469
  182. data/vendored/puppet/lib/puppet/application/apply.rb +0 -407
  183. data/vendored/puppet/lib/puppet/application/catalog.rb +0 -4
  184. data/vendored/puppet/lib/puppet/application/cert.rb +0 -76
  185. data/vendored/puppet/lib/puppet/application/config.rb +0 -5
  186. data/vendored/puppet/lib/puppet/application/describe.rb +0 -257
  187. data/vendored/puppet/lib/puppet/application/device.rb +0 -386
  188. data/vendored/puppet/lib/puppet/application/doc.rb +0 -232
  189. data/vendored/puppet/lib/puppet/application/epp.rb +0 -5
  190. data/vendored/puppet/lib/puppet/application/face_base.rb +0 -268
  191. data/vendored/puppet/lib/puppet/application/facts.rb +0 -9
  192. data/vendored/puppet/lib/puppet/application/filebucket.rb +0 -300
  193. data/vendored/puppet/lib/puppet/application/generate.rb +0 -5
  194. data/vendored/puppet/lib/puppet/application/help.rb +0 -5
  195. data/vendored/puppet/lib/puppet/application/indirection_base.rb +0 -4
  196. data/vendored/puppet/lib/puppet/application/key.rb +0 -4
  197. data/vendored/puppet/lib/puppet/application/lookup.rb +0 -369
  198. data/vendored/puppet/lib/puppet/application/man.rb +0 -4
  199. data/vendored/puppet/lib/puppet/application/module.rb +0 -4
  200. data/vendored/puppet/lib/puppet/application/node.rb +0 -4
  201. data/vendored/puppet/lib/puppet/application/parser.rb +0 -5
  202. data/vendored/puppet/lib/puppet/application/plugin.rb +0 -3
  203. data/vendored/puppet/lib/puppet/application/report.rb +0 -4
  204. data/vendored/puppet/lib/puppet/application/resource.rb +0 -231
  205. data/vendored/puppet/lib/puppet/application/script.rb +0 -261
  206. data/vendored/puppet/lib/puppet/application/ssl.rb +0 -133
  207. data/vendored/puppet/lib/puppet/application/status.rb +0 -4
  208. data/vendored/puppet/lib/puppet/application_support.rb +0 -61
  209. data/vendored/puppet/lib/puppet/coercion.rb +0 -40
  210. data/vendored/puppet/lib/puppet/compilable_resource_type.rb +0 -15
  211. data/vendored/puppet/lib/puppet/configurer.rb +0 -484
  212. data/vendored/puppet/lib/puppet/configurer/downloader.rb +0 -67
  213. data/vendored/puppet/lib/puppet/configurer/fact_handler.rb +0 -50
  214. data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +0 -48
  215. data/vendored/puppet/lib/puppet/confine.rb +0 -83
  216. data/vendored/puppet/lib/puppet/confine/any.rb +0 -26
  217. data/vendored/puppet/lib/puppet/confine/exists.rb +0 -19
  218. data/vendored/puppet/lib/puppet/confine/false.rb +0 -19
  219. data/vendored/puppet/lib/puppet/confine/feature.rb +0 -17
  220. data/vendored/puppet/lib/puppet/confine/true.rb +0 -20
  221. data/vendored/puppet/lib/puppet/confine/variable.rb +0 -59
  222. data/vendored/puppet/lib/puppet/confine_collection.rb +0 -50
  223. data/vendored/puppet/lib/puppet/confiner.rb +0 -46
  224. data/vendored/puppet/lib/puppet/context.rb +0 -116
  225. data/vendored/puppet/lib/puppet/context/trusted_information.rb +0 -76
  226. data/vendored/puppet/lib/puppet/daemon.rb +0 -195
  227. data/vendored/puppet/lib/puppet/data_binding.rb +0 -14
  228. data/vendored/puppet/lib/puppet/datatypes.rb +0 -213
  229. data/vendored/puppet/lib/puppet/datatypes/error.rb +0 -21
  230. data/vendored/puppet/lib/puppet/datatypes/impl/error.rb +0 -40
  231. data/vendored/puppet/lib/puppet/defaults.rb +0 -2003
  232. data/vendored/puppet/lib/puppet/environments.rb +0 -505
  233. data/vendored/puppet/lib/puppet/error.rb +0 -117
  234. data/vendored/puppet/lib/puppet/etc.rb +0 -160
  235. data/vendored/puppet/lib/puppet/external/dot.rb +0 -325
  236. data/vendored/puppet/lib/puppet/external/pson/common.rb +0 -374
  237. data/vendored/puppet/lib/puppet/external/pson/pure.rb +0 -15
  238. data/vendored/puppet/lib/puppet/external/pson/pure/generator.rb +0 -395
  239. data/vendored/puppet/lib/puppet/external/pson/pure/parser.rb +0 -307
  240. data/vendored/puppet/lib/puppet/external/pson/version.rb +0 -8
  241. data/vendored/puppet/lib/puppet/face.rb +0 -12
  242. data/vendored/puppet/lib/puppet/face/catalog.rb +0 -130
  243. data/vendored/puppet/lib/puppet/face/catalog/select.rb +0 -49
  244. data/vendored/puppet/lib/puppet/face/config.rb +0 -265
  245. data/vendored/puppet/lib/puppet/face/epp.rb +0 -554
  246. data/vendored/puppet/lib/puppet/face/facts.rb +0 -87
  247. data/vendored/puppet/lib/puppet/face/generate.rb +0 -64
  248. data/vendored/puppet/lib/puppet/face/help.rb +0 -215
  249. data/vendored/puppet/lib/puppet/face/key.rb +0 -16
  250. data/vendored/puppet/lib/puppet/face/man.rb +0 -145
  251. data/vendored/puppet/lib/puppet/face/module.rb +0 -19
  252. data/vendored/puppet/lib/puppet/face/module/build.rb +0 -14
  253. data/vendored/puppet/lib/puppet/face/module/changes.rb +0 -42
  254. data/vendored/puppet/lib/puppet/face/module/generate.rb +0 -14
  255. data/vendored/puppet/lib/puppet/face/module/install.rb +0 -146
  256. data/vendored/puppet/lib/puppet/face/module/list.rb +0 -263
  257. data/vendored/puppet/lib/puppet/face/module/search.rb +0 -98
  258. data/vendored/puppet/lib/puppet/face/module/uninstall.rb +0 -89
  259. data/vendored/puppet/lib/puppet/face/module/upgrade.rb +0 -87
  260. data/vendored/puppet/lib/puppet/face/node.rb +0 -43
  261. data/vendored/puppet/lib/puppet/face/node/clean.rb +0 -100
  262. data/vendored/puppet/lib/puppet/face/parser.rb +0 -187
  263. data/vendored/puppet/lib/puppet/face/plugin.rb +0 -56
  264. data/vendored/puppet/lib/puppet/face/report.rb +0 -54
  265. data/vendored/puppet/lib/puppet/face/resource.rb +0 -53
  266. data/vendored/puppet/lib/puppet/face/status.rb +0 -51
  267. data/vendored/puppet/lib/puppet/feature/base.rb +0 -76
  268. data/vendored/puppet/lib/puppet/feature/bolt.rb +0 -3
  269. data/vendored/puppet/lib/puppet/feature/cfpropertylist.rb +0 -3
  270. data/vendored/puppet/lib/puppet/feature/eventlog.rb +0 -5
  271. data/vendored/puppet/lib/puppet/feature/hiera_eyaml.rb +0 -3
  272. data/vendored/puppet/lib/puppet/feature/hocon.rb +0 -3
  273. data/vendored/puppet/lib/puppet/feature/libuser.rb +0 -8
  274. data/vendored/puppet/lib/puppet/feature/msgpack.rb +0 -3
  275. data/vendored/puppet/lib/puppet/feature/pe_license.rb +0 -4
  276. data/vendored/puppet/lib/puppet/feature/selinux.rb +0 -3
  277. data/vendored/puppet/lib/puppet/feature/ssh.rb +0 -3
  278. data/vendored/puppet/lib/puppet/feature/telnet.rb +0 -9
  279. data/vendored/puppet/lib/puppet/feature/zlib.rb +0 -5
  280. data/vendored/puppet/lib/puppet/file_bucket.rb +0 -4
  281. data/vendored/puppet/lib/puppet/file_bucket/dipper.rb +0 -173
  282. data/vendored/puppet/lib/puppet/file_bucket/file.rb +0 -129
  283. data/vendored/puppet/lib/puppet/file_serving.rb +0 -3
  284. data/vendored/puppet/lib/puppet/file_serving/base.rb +0 -86
  285. data/vendored/puppet/lib/puppet/file_serving/configuration.rb +0 -115
  286. data/vendored/puppet/lib/puppet/file_serving/configuration/parser.rb +0 -137
  287. data/vendored/puppet/lib/puppet/file_serving/content.rb +0 -43
  288. data/vendored/puppet/lib/puppet/file_serving/fileset.rb +0 -174
  289. data/vendored/puppet/lib/puppet/file_serving/http_metadata.rb +0 -46
  290. data/vendored/puppet/lib/puppet/file_serving/metadata.rb +0 -164
  291. data/vendored/puppet/lib/puppet/file_serving/mount.rb +0 -39
  292. data/vendored/puppet/lib/puppet/file_serving/mount/file.rb +0 -121
  293. data/vendored/puppet/lib/puppet/file_serving/mount/locales.rb +0 -35
  294. data/vendored/puppet/lib/puppet/file_serving/mount/modules.rb +0 -24
  295. data/vendored/puppet/lib/puppet/file_serving/mount/pluginfacts.rb +0 -35
  296. data/vendored/puppet/lib/puppet/file_serving/mount/plugins.rb +0 -35
  297. data/vendored/puppet/lib/puppet/file_serving/mount/tasks.rb +0 -21
  298. data/vendored/puppet/lib/puppet/file_serving/terminus_helper.rb +0 -31
  299. data/vendored/puppet/lib/puppet/file_serving/terminus_selector.rb +0 -32
  300. data/vendored/puppet/lib/puppet/file_system.rb +0 -404
  301. data/vendored/puppet/lib/puppet/file_system/file_impl.rb +0 -154
  302. data/vendored/puppet/lib/puppet/file_system/memory_file.rb +0 -66
  303. data/vendored/puppet/lib/puppet/file_system/memory_impl.rb +0 -86
  304. data/vendored/puppet/lib/puppet/file_system/path_pattern.rb +0 -98
  305. data/vendored/puppet/lib/puppet/file_system/posix.rb +0 -46
  306. data/vendored/puppet/lib/puppet/file_system/uniquefile.rb +0 -190
  307. data/vendored/puppet/lib/puppet/file_system/windows.rb +0 -130
  308. data/vendored/puppet/lib/puppet/forge.rb +0 -241
  309. data/vendored/puppet/lib/puppet/forge/cache.rb +0 -60
  310. data/vendored/puppet/lib/puppet/forge/errors.rb +0 -114
  311. data/vendored/puppet/lib/puppet/forge/repository.rb +0 -155
  312. data/vendored/puppet/lib/puppet/functions.rb +0 -863
  313. data/vendored/puppet/lib/puppet/functions/abs.rb +0 -61
  314. data/vendored/puppet/lib/puppet/functions/alert.rb +0 -14
  315. data/vendored/puppet/lib/puppet/functions/all.rb +0 -104
  316. data/vendored/puppet/lib/puppet/functions/annotate.rb +0 -108
  317. data/vendored/puppet/lib/puppet/functions/any.rb +0 -109
  318. data/vendored/puppet/lib/puppet/functions/assert_type.rb +0 -93
  319. data/vendored/puppet/lib/puppet/functions/binary_file.rb +0 -32
  320. data/vendored/puppet/lib/puppet/functions/break.rb +0 -47
  321. data/vendored/puppet/lib/puppet/functions/call.rb +0 -79
  322. data/vendored/puppet/lib/puppet/functions/camelcase.rb +0 -62
  323. data/vendored/puppet/lib/puppet/functions/capitalize.rb +0 -61
  324. data/vendored/puppet/lib/puppet/functions/ceiling.rb +0 -37
  325. data/vendored/puppet/lib/puppet/functions/chomp.rb +0 -57
  326. data/vendored/puppet/lib/puppet/functions/chop.rb +0 -67
  327. data/vendored/puppet/lib/puppet/functions/compare.rb +0 -125
  328. data/vendored/puppet/lib/puppet/functions/contain.rb +0 -55
  329. data/vendored/puppet/lib/puppet/functions/convert_to.rb +0 -34
  330. data/vendored/puppet/lib/puppet/functions/crit.rb +0 -14
  331. data/vendored/puppet/lib/puppet/functions/debug.rb +0 -14
  332. data/vendored/puppet/lib/puppet/functions/defined.rb +0 -159
  333. data/vendored/puppet/lib/puppet/functions/dig.rb +0 -67
  334. data/vendored/puppet/lib/puppet/functions/downcase.rb +0 -89
  335. data/vendored/puppet/lib/puppet/functions/each.rb +0 -169
  336. data/vendored/puppet/lib/puppet/functions/emerg.rb +0 -14
  337. data/vendored/puppet/lib/puppet/functions/empty.rb +0 -77
  338. data/vendored/puppet/lib/puppet/functions/epp.rb +0 -48
  339. data/vendored/puppet/lib/puppet/functions/err.rb +0 -14
  340. data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +0 -97
  341. data/vendored/puppet/lib/puppet/functions/filter.rb +0 -144
  342. data/vendored/puppet/lib/puppet/functions/find_file.rb +0 -44
  343. data/vendored/puppet/lib/puppet/functions/flatten.rb +0 -64
  344. data/vendored/puppet/lib/puppet/functions/floor.rb +0 -37
  345. data/vendored/puppet/lib/puppet/functions/get.rb +0 -150
  346. data/vendored/puppet/lib/puppet/functions/getvar.rb +0 -87
  347. data/vendored/puppet/lib/puppet/functions/hiera.rb +0 -88
  348. data/vendored/puppet/lib/puppet/functions/hiera_array.rb +0 -81
  349. data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +0 -92
  350. data/vendored/puppet/lib/puppet/functions/hiera_include.rb +0 -104
  351. data/vendored/puppet/lib/puppet/functions/hocon_data.rb +0 -41
  352. data/vendored/puppet/lib/puppet/functions/import.rb +0 -7
  353. data/vendored/puppet/lib/puppet/functions/include.rb +0 -53
  354. data/vendored/puppet/lib/puppet/functions/info.rb +0 -14
  355. data/vendored/puppet/lib/puppet/functions/inline_epp.rb +0 -59
  356. data/vendored/puppet/lib/puppet/functions/join.rb +0 -56
  357. data/vendored/puppet/lib/puppet/functions/json_data.rb +0 -33
  358. data/vendored/puppet/lib/puppet/functions/keys.rb +0 -25
  359. data/vendored/puppet/lib/puppet/functions/length.rb +0 -44
  360. data/vendored/puppet/lib/puppet/functions/lest.rb +0 -55
  361. data/vendored/puppet/lib/puppet/functions/lookup.rb +0 -224
  362. data/vendored/puppet/lib/puppet/functions/lstrip.rb +0 -58
  363. data/vendored/puppet/lib/puppet/functions/map.rb +0 -136
  364. data/vendored/puppet/lib/puppet/functions/match.rb +0 -131
  365. data/vendored/puppet/lib/puppet/functions/max.rb +0 -183
  366. data/vendored/puppet/lib/puppet/functions/min.rb +0 -182
  367. data/vendored/puppet/lib/puppet/functions/module_directory.rb +0 -41
  368. data/vendored/puppet/lib/puppet/functions/new.rb +0 -1006
  369. data/vendored/puppet/lib/puppet/functions/next.rb +0 -16
  370. data/vendored/puppet/lib/puppet/functions/notice.rb +0 -14
  371. data/vendored/puppet/lib/puppet/functions/reduce.rb +0 -164
  372. data/vendored/puppet/lib/puppet/functions/regsubst.rb +0 -82
  373. data/vendored/puppet/lib/puppet/functions/require.rb +0 -77
  374. data/vendored/puppet/lib/puppet/functions/return.rb +0 -15
  375. data/vendored/puppet/lib/puppet/functions/reverse_each.rb +0 -94
  376. data/vendored/puppet/lib/puppet/functions/round.rb +0 -24
  377. data/vendored/puppet/lib/puppet/functions/rstrip.rb +0 -58
  378. data/vendored/puppet/lib/puppet/functions/scanf.rb +0 -44
  379. data/vendored/puppet/lib/puppet/functions/size.rb +0 -15
  380. data/vendored/puppet/lib/puppet/functions/slice.rb +0 -124
  381. data/vendored/puppet/lib/puppet/functions/sort.rb +0 -74
  382. data/vendored/puppet/lib/puppet/functions/split.rb +0 -49
  383. data/vendored/puppet/lib/puppet/functions/step.rb +0 -98
  384. data/vendored/puppet/lib/puppet/functions/strftime.rb +0 -211
  385. data/vendored/puppet/lib/puppet/functions/strip.rb +0 -58
  386. data/vendored/puppet/lib/puppet/functions/then.rb +0 -77
  387. data/vendored/puppet/lib/puppet/functions/tree_each.rb +0 -200
  388. data/vendored/puppet/lib/puppet/functions/type.rb +0 -72
  389. data/vendored/puppet/lib/puppet/functions/unique.rb +0 -132
  390. data/vendored/puppet/lib/puppet/functions/unwrap.rb +0 -44
  391. data/vendored/puppet/lib/puppet/functions/upcase.rb +0 -89
  392. data/vendored/puppet/lib/puppet/functions/values.rb +0 -25
  393. data/vendored/puppet/lib/puppet/functions/versioncmp.rb +0 -36
  394. data/vendored/puppet/lib/puppet/functions/warning.rb +0 -14
  395. data/vendored/puppet/lib/puppet/functions/with.rb +0 -32
  396. data/vendored/puppet/lib/puppet/functions/yaml_data.rb +0 -43
  397. data/vendored/puppet/lib/puppet/generate/models/type/property.rb +0 -70
  398. data/vendored/puppet/lib/puppet/generate/models/type/type.rb +0 -62
  399. data/vendored/puppet/lib/puppet/generate/type.rb +0 -239
  400. data/vendored/puppet/lib/puppet/gettext/config.rb +0 -275
  401. data/vendored/puppet/lib/puppet/gettext/module_translations.rb +0 -42
  402. data/vendored/puppet/lib/puppet/gettext/stubs.rb +0 -11
  403. data/vendored/puppet/lib/puppet/graph.rb +0 -9
  404. data/vendored/puppet/lib/puppet/graph/key.rb +0 -26
  405. data/vendored/puppet/lib/puppet/graph/prioritizer.rb +0 -29
  406. data/vendored/puppet/lib/puppet/graph/rb_tree_map.rb +0 -388
  407. data/vendored/puppet/lib/puppet/graph/relationship_graph.rb +0 -283
  408. data/vendored/puppet/lib/puppet/graph/sequential_prioritizer.rb +0 -31
  409. data/vendored/puppet/lib/puppet/graph/simple_graph.rb +0 -543
  410. data/vendored/puppet/lib/puppet/indirector.rb +0 -61
  411. data/vendored/puppet/lib/puppet/indirector/catalog/compiler.rb +0 -416
  412. data/vendored/puppet/lib/puppet/indirector/catalog/json.rb +0 -35
  413. data/vendored/puppet/lib/puppet/indirector/catalog/msgpack.rb +0 -6
  414. data/vendored/puppet/lib/puppet/indirector/catalog/rest.rb +0 -6
  415. data/vendored/puppet/lib/puppet/indirector/catalog/store_configs.rb +0 -8
  416. data/vendored/puppet/lib/puppet/indirector/catalog/yaml.rb +0 -6
  417. data/vendored/puppet/lib/puppet/indirector/certificate/file.rb +0 -8
  418. data/vendored/puppet/lib/puppet/indirector/certificate/rest.rb +0 -16
  419. data/vendored/puppet/lib/puppet/indirector/certificate_request/file.rb +0 -8
  420. data/vendored/puppet/lib/puppet/indirector/certificate_request/memory.rb +0 -6
  421. data/vendored/puppet/lib/puppet/indirector/certificate_request/rest.rb +0 -10
  422. data/vendored/puppet/lib/puppet/indirector/code.rb +0 -6
  423. data/vendored/puppet/lib/puppet/indirector/data_binding/hiera.rb +0 -7
  424. data/vendored/puppet/lib/puppet/indirector/data_binding/none.rb +0 -8
  425. data/vendored/puppet/lib/puppet/indirector/direct_file_server.rb +0 -17
  426. data/vendored/puppet/lib/puppet/indirector/envelope.rb +0 -11
  427. data/vendored/puppet/lib/puppet/indirector/errors.rb +0 -5
  428. data/vendored/puppet/lib/puppet/indirector/exec.rb +0 -38
  429. data/vendored/puppet/lib/puppet/indirector/face.rb +0 -153
  430. data/vendored/puppet/lib/puppet/indirector/facts/facter.rb +0 -88
  431. data/vendored/puppet/lib/puppet/indirector/facts/memory.rb +0 -9
  432. data/vendored/puppet/lib/puppet/indirector/facts/network_device.rb +0 -27
  433. data/vendored/puppet/lib/puppet/indirector/facts/rest.rb +0 -21
  434. data/vendored/puppet/lib/puppet/indirector/facts/store_configs.rb +0 -11
  435. data/vendored/puppet/lib/puppet/indirector/facts/yaml.rb +0 -84
  436. data/vendored/puppet/lib/puppet/indirector/file_bucket_file/file.rb +0 -262
  437. data/vendored/puppet/lib/puppet/indirector/file_bucket_file/rest.rb +0 -8
  438. data/vendored/puppet/lib/puppet/indirector/file_bucket_file/selector.rb +0 -53
  439. data/vendored/puppet/lib/puppet/indirector/file_content.rb +0 -5
  440. data/vendored/puppet/lib/puppet/indirector/file_content/file.rb +0 -7
  441. data/vendored/puppet/lib/puppet/indirector/file_content/file_server.rb +0 -7
  442. data/vendored/puppet/lib/puppet/indirector/file_content/http.rb +0 -17
  443. data/vendored/puppet/lib/puppet/indirector/file_content/rest.rb +0 -9
  444. data/vendored/puppet/lib/puppet/indirector/file_content/selector.rb +0 -30
  445. data/vendored/puppet/lib/puppet/indirector/file_metadata.rb +0 -5
  446. data/vendored/puppet/lib/puppet/indirector/file_metadata/file.rb +0 -7
  447. data/vendored/puppet/lib/puppet/indirector/file_metadata/file_server.rb +0 -7
  448. data/vendored/puppet/lib/puppet/indirector/file_metadata/http.rb +0 -27
  449. data/vendored/puppet/lib/puppet/indirector/file_metadata/rest.rb +0 -9
  450. data/vendored/puppet/lib/puppet/indirector/file_metadata/selector.rb +0 -30
  451. data/vendored/puppet/lib/puppet/indirector/file_server.rb +0 -59
  452. data/vendored/puppet/lib/puppet/indirector/generic_http.rb +0 -16
  453. data/vendored/puppet/lib/puppet/indirector/hiera.rb +0 -94
  454. data/vendored/puppet/lib/puppet/indirector/indirection.rb +0 -340
  455. data/vendored/puppet/lib/puppet/indirector/json.rb +0 -75
  456. data/vendored/puppet/lib/puppet/indirector/key/file.rb +0 -45
  457. data/vendored/puppet/lib/puppet/indirector/key/memory.rb +0 -6
  458. data/vendored/puppet/lib/puppet/indirector/memory.rb +0 -34
  459. data/vendored/puppet/lib/puppet/indirector/msgpack.rb +0 -83
  460. data/vendored/puppet/lib/puppet/indirector/node/exec.rb +0 -69
  461. data/vendored/puppet/lib/puppet/indirector/node/memory.rb +0 -10
  462. data/vendored/puppet/lib/puppet/indirector/node/msgpack.rb +0 -7
  463. data/vendored/puppet/lib/puppet/indirector/node/plain.rb +0 -21
  464. data/vendored/puppet/lib/puppet/indirector/node/rest.rb +0 -7
  465. data/vendored/puppet/lib/puppet/indirector/node/store_configs.rb +0 -8
  466. data/vendored/puppet/lib/puppet/indirector/node/yaml.rb +0 -7
  467. data/vendored/puppet/lib/puppet/indirector/none.rb +0 -9
  468. data/vendored/puppet/lib/puppet/indirector/plain.rb +0 -9
  469. data/vendored/puppet/lib/puppet/indirector/report/msgpack.rb +0 -11
  470. data/vendored/puppet/lib/puppet/indirector/report/processor.rb +0 -59
  471. data/vendored/puppet/lib/puppet/indirector/report/rest.rb +0 -28
  472. data/vendored/puppet/lib/puppet/indirector/report/yaml.rb +0 -11
  473. data/vendored/puppet/lib/puppet/indirector/request.rb +0 -278
  474. data/vendored/puppet/lib/puppet/indirector/resource/ral.rb +0 -63
  475. data/vendored/puppet/lib/puppet/indirector/resource/store_configs.rb +0 -12
  476. data/vendored/puppet/lib/puppet/indirector/resource/validator.rb +0 -8
  477. data/vendored/puppet/lib/puppet/indirector/rest.rb +0 -301
  478. data/vendored/puppet/lib/puppet/indirector/ssl_file.rb +0 -160
  479. data/vendored/puppet/lib/puppet/indirector/status.rb +0 -3
  480. data/vendored/puppet/lib/puppet/indirector/status/local.rb +0 -12
  481. data/vendored/puppet/lib/puppet/indirector/status/rest.rb +0 -9
  482. data/vendored/puppet/lib/puppet/indirector/store_configs.rb +0 -30
  483. data/vendored/puppet/lib/puppet/indirector/terminus.rb +0 -169
  484. data/vendored/puppet/lib/puppet/indirector/yaml.rb +0 -63
  485. data/vendored/puppet/lib/puppet/info_service.rb +0 -17
  486. data/vendored/puppet/lib/puppet/info_service/class_information_service.rb +0 -110
  487. data/vendored/puppet/lib/puppet/info_service/task_information_service.rb +0 -36
  488. data/vendored/puppet/lib/puppet/interface.rb +0 -237
  489. data/vendored/puppet/lib/puppet/interface/action.rb +0 -399
  490. data/vendored/puppet/lib/puppet/interface/action_builder.rb +0 -166
  491. data/vendored/puppet/lib/puppet/interface/action_manager.rb +0 -97
  492. data/vendored/puppet/lib/puppet/interface/documentation.rb +0 -353
  493. data/vendored/puppet/lib/puppet/interface/face_collection.rb +0 -134
  494. data/vendored/puppet/lib/puppet/interface/option.rb +0 -171
  495. data/vendored/puppet/lib/puppet/interface/option_builder.rb +0 -105
  496. data/vendored/puppet/lib/puppet/interface/option_manager.rb +0 -104
  497. data/vendored/puppet/lib/puppet/loaders.rb +0 -28
  498. data/vendored/puppet/lib/puppet/metatype/manager.rb +0 -197
  499. data/vendored/puppet/lib/puppet/module.rb +0 -441
  500. data/vendored/puppet/lib/puppet/module/task.rb +0 -258
  501. data/vendored/puppet/lib/puppet/module_tool.rb +0 -193
  502. data/vendored/puppet/lib/puppet/module_tool/applications.rb +0 -13
  503. data/vendored/puppet/lib/puppet/module_tool/applications/application.rb +0 -90
  504. data/vendored/puppet/lib/puppet/module_tool/applications/checksummer.rb +0 -62
  505. data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +0 -354
  506. data/vendored/puppet/lib/puppet/module_tool/applications/searcher.rb +0 -29
  507. data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +0 -120
  508. data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +0 -100
  509. data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +0 -280
  510. data/vendored/puppet/lib/puppet/module_tool/checksums.rb +0 -49
  511. data/vendored/puppet/lib/puppet/module_tool/contents_description.rb +0 -88
  512. data/vendored/puppet/lib/puppet/module_tool/dependency.rb +0 -41
  513. data/vendored/puppet/lib/puppet/module_tool/errors.rb +0 -11
  514. data/vendored/puppet/lib/puppet/module_tool/errors/base.rb +0 -15
  515. data/vendored/puppet/lib/puppet/module_tool/errors/installer.rb +0 -93
  516. data/vendored/puppet/lib/puppet/module_tool/errors/shared.rb +0 -195
  517. data/vendored/puppet/lib/puppet/module_tool/errors/uninstaller.rb +0 -50
  518. data/vendored/puppet/lib/puppet/module_tool/errors/upgrader.rb +0 -63
  519. data/vendored/puppet/lib/puppet/module_tool/install_directory.rb +0 -45
  520. data/vendored/puppet/lib/puppet/module_tool/installed_modules.rb +0 -96
  521. data/vendored/puppet/lib/puppet/module_tool/local_tarball.rb +0 -90
  522. data/vendored/puppet/lib/puppet/module_tool/metadata.rb +0 -222
  523. data/vendored/puppet/lib/puppet/module_tool/shared_behaviors.rb +0 -180
  524. data/vendored/puppet/lib/puppet/module_tool/tar.rb +0 -18
  525. data/vendored/puppet/lib/puppet/module_tool/tar/gnu.rb +0 -19
  526. data/vendored/puppet/lib/puppet/module_tool/tar/mini.rb +0 -106
  527. data/vendored/puppet/lib/puppet/network.rb +0 -3
  528. data/vendored/puppet/lib/puppet/network/auth_config_parser.rb +0 -90
  529. data/vendored/puppet/lib/puppet/network/authconfig.rb +0 -99
  530. data/vendored/puppet/lib/puppet/network/authorization.rb +0 -41
  531. data/vendored/puppet/lib/puppet/network/authstore.rb +0 -282
  532. data/vendored/puppet/lib/puppet/network/client_request.rb +0 -29
  533. data/vendored/puppet/lib/puppet/network/format.rb +0 -110
  534. data/vendored/puppet/lib/puppet/network/format_handler.rb +0 -108
  535. data/vendored/puppet/lib/puppet/network/format_support.rb +0 -139
  536. data/vendored/puppet/lib/puppet/network/formats.rb +0 -260
  537. data/vendored/puppet/lib/puppet/network/http.rb +0 -28
  538. data/vendored/puppet/lib/puppet/network/http/api.rb +0 -35
  539. data/vendored/puppet/lib/puppet/network/http/api/indirected_routes.rb +0 -286
  540. data/vendored/puppet/lib/puppet/network/http/api/indirection_type.rb +0 -32
  541. data/vendored/puppet/lib/puppet/network/http/api/master.rb +0 -2
  542. data/vendored/puppet/lib/puppet/network/http/api/master/v3.rb +0 -28
  543. data/vendored/puppet/lib/puppet/network/http/api/master/v3/authorization.rb +0 -18
  544. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +0 -85
  545. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environments.rb +0 -35
  546. data/vendored/puppet/lib/puppet/network/http/compression.rb +0 -120
  547. data/vendored/puppet/lib/puppet/network/http/connection.rb +0 -319
  548. data/vendored/puppet/lib/puppet/network/http/error.rb +0 -73
  549. data/vendored/puppet/lib/puppet/network/http/factory.rb +0 -55
  550. data/vendored/puppet/lib/puppet/network/http/handler.rb +0 -215
  551. data/vendored/puppet/lib/puppet/network/http/issues.rb +0 -12
  552. data/vendored/puppet/lib/puppet/network/http/memory_response.rb +0 -13
  553. data/vendored/puppet/lib/puppet/network/http/nocache_pool.rb +0 -21
  554. data/vendored/puppet/lib/puppet/network/http/pool.rb +0 -129
  555. data/vendored/puppet/lib/puppet/network/http/request.rb +0 -70
  556. data/vendored/puppet/lib/puppet/network/http/response.rb +0 -23
  557. data/vendored/puppet/lib/puppet/network/http/route.rb +0 -100
  558. data/vendored/puppet/lib/puppet/network/http/session.rb +0 -17
  559. data/vendored/puppet/lib/puppet/network/http/site.rb +0 -39
  560. data/vendored/puppet/lib/puppet/network/http_pool.rb +0 -61
  561. data/vendored/puppet/lib/puppet/network/resolver.rb +0 -158
  562. data/vendored/puppet/lib/puppet/network/rest_controller.rb +0 -2
  563. data/vendored/puppet/lib/puppet/network/rights.rb +0 -209
  564. data/vendored/puppet/lib/puppet/node.rb +0 -281
  565. data/vendored/puppet/lib/puppet/node/environment.rb +0 -575
  566. data/vendored/puppet/lib/puppet/node/facts.rb +0 -147
  567. data/vendored/puppet/lib/puppet/parameter.rb +0 -572
  568. data/vendored/puppet/lib/puppet/parameter/boolean.rb +0 -15
  569. data/vendored/puppet/lib/puppet/parameter/package_options.rb +0 -31
  570. data/vendored/puppet/lib/puppet/parameter/path.rb +0 -57
  571. data/vendored/puppet/lib/puppet/parameter/value.rb +0 -91
  572. data/vendored/puppet/lib/puppet/parameter/value_collection.rb +0 -212
  573. data/vendored/puppet/lib/puppet/parser.rb +0 -20
  574. data/vendored/puppet/lib/puppet/parser/abstract_compiler.rb +0 -36
  575. data/vendored/puppet/lib/puppet/parser/ast.rb +0 -61
  576. data/vendored/puppet/lib/puppet/parser/ast/block_expression.rb +0 -15
  577. data/vendored/puppet/lib/puppet/parser/ast/branch.rb +0 -19
  578. data/vendored/puppet/lib/puppet/parser/ast/hostclass.rb +0 -27
  579. data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +0 -80
  580. data/vendored/puppet/lib/puppet/parser/ast/node.rb +0 -17
  581. data/vendored/puppet/lib/puppet/parser/ast/pops_bridge.rb +0 -291
  582. data/vendored/puppet/lib/puppet/parser/ast/resource.rb +0 -66
  583. data/vendored/puppet/lib/puppet/parser/ast/resource_instance.rb +0 -10
  584. data/vendored/puppet/lib/puppet/parser/ast/resourceparam.rb +0 -31
  585. data/vendored/puppet/lib/puppet/parser/ast/top_level_construct.rb +0 -4
  586. data/vendored/puppet/lib/puppet/parser/catalog_compiler.rb +0 -56
  587. data/vendored/puppet/lib/puppet/parser/compiler.rb +0 -798
  588. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator.rb +0 -33
  589. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +0 -64
  590. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +0 -64
  591. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +0 -20
  592. data/vendored/puppet/lib/puppet/parser/e4_parser_adapter.rb +0 -60
  593. data/vendored/puppet/lib/puppet/parser/environment_compiler.rb +0 -199
  594. data/vendored/puppet/lib/puppet/parser/files.rb +0 -92
  595. data/vendored/puppet/lib/puppet/parser/functions.rb +0 -311
  596. data/vendored/puppet/lib/puppet/parser/functions/assert_type.rb +0 -60
  597. data/vendored/puppet/lib/puppet/parser/functions/binary_file.rb +0 -24
  598. data/vendored/puppet/lib/puppet/parser/functions/break.rb +0 -39
  599. data/vendored/puppet/lib/puppet/parser/functions/contain.rb +0 -30
  600. data/vendored/puppet/lib/puppet/parser/functions/create_resources.rb +0 -106
  601. data/vendored/puppet/lib/puppet/parser/functions/defined.rb +0 -107
  602. data/vendored/puppet/lib/puppet/parser/functions/dig.rb +0 -38
  603. data/vendored/puppet/lib/puppet/parser/functions/digest.rb +0 -5
  604. data/vendored/puppet/lib/puppet/parser/functions/each.rb +0 -104
  605. data/vendored/puppet/lib/puppet/parser/functions/epp.rb +0 -39
  606. data/vendored/puppet/lib/puppet/parser/functions/fail.rb +0 -4
  607. data/vendored/puppet/lib/puppet/parser/functions/file.rb +0 -33
  608. data/vendored/puppet/lib/puppet/parser/functions/filter.rb +0 -78
  609. data/vendored/puppet/lib/puppet/parser/functions/find_file.rb +0 -28
  610. data/vendored/puppet/lib/puppet/parser/functions/fqdn_rand.rb +0 -36
  611. data/vendored/puppet/lib/puppet/parser/functions/generate.rb +0 -36
  612. data/vendored/puppet/lib/puppet/parser/functions/hiera.rb +0 -103
  613. data/vendored/puppet/lib/puppet/parser/functions/hiera_array.rb +0 -92
  614. data/vendored/puppet/lib/puppet/parser/functions/hiera_hash.rb +0 -102
  615. data/vendored/puppet/lib/puppet/parser/functions/hiera_include.rb +0 -101
  616. data/vendored/puppet/lib/puppet/parser/functions/include.rb +0 -34
  617. data/vendored/puppet/lib/puppet/parser/functions/inline_epp.rb +0 -51
  618. data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +0 -26
  619. data/vendored/puppet/lib/puppet/parser/functions/lest.rb +0 -49
  620. data/vendored/puppet/lib/puppet/parser/functions/lookup.rb +0 -132
  621. data/vendored/puppet/lib/puppet/parser/functions/map.rb +0 -76
  622. data/vendored/puppet/lib/puppet/parser/functions/match.rb +0 -43
  623. data/vendored/puppet/lib/puppet/parser/functions/md5.rb +0 -5
  624. data/vendored/puppet/lib/puppet/parser/functions/new.rb +0 -991
  625. data/vendored/puppet/lib/puppet/parser/functions/next.rb +0 -38
  626. data/vendored/puppet/lib/puppet/parser/functions/realize.rb +0 -20
  627. data/vendored/puppet/lib/puppet/parser/functions/reduce.rb +0 -137
  628. data/vendored/puppet/lib/puppet/parser/functions/regsubst.rb +0 -62
  629. data/vendored/puppet/lib/puppet/parser/functions/require.rb +0 -40
  630. data/vendored/puppet/lib/puppet/parser/functions/return.rb +0 -92
  631. data/vendored/puppet/lib/puppet/parser/functions/reverse_each.rb +0 -83
  632. data/vendored/puppet/lib/puppet/parser/functions/scanf.rb +0 -38
  633. data/vendored/puppet/lib/puppet/parser/functions/sha1.rb +0 -5
  634. data/vendored/puppet/lib/puppet/parser/functions/sha256.rb +0 -5
  635. data/vendored/puppet/lib/puppet/parser/functions/shellquote.rb +0 -61
  636. data/vendored/puppet/lib/puppet/parser/functions/slice.rb +0 -39
  637. data/vendored/puppet/lib/puppet/parser/functions/split.rb +0 -28
  638. data/vendored/puppet/lib/puppet/parser/functions/sprintf.rb +0 -61
  639. data/vendored/puppet/lib/puppet/parser/functions/step.rb +0 -84
  640. data/vendored/puppet/lib/puppet/parser/functions/strftime.rb +0 -185
  641. data/vendored/puppet/lib/puppet/parser/functions/tag.rb +0 -12
  642. data/vendored/puppet/lib/puppet/parser/functions/tagged.rb +0 -21
  643. data/vendored/puppet/lib/puppet/parser/functions/template.rb +0 -39
  644. data/vendored/puppet/lib/puppet/parser/functions/then.rb +0 -73
  645. data/vendored/puppet/lib/puppet/parser/functions/type.rb +0 -53
  646. data/vendored/puppet/lib/puppet/parser/functions/versioncmp.rb +0 -30
  647. data/vendored/puppet/lib/puppet/parser/functions/with.rb +0 -28
  648. data/vendored/puppet/lib/puppet/parser/parser_factory.rb +0 -30
  649. data/vendored/puppet/lib/puppet/parser/relationship.rb +0 -83
  650. data/vendored/puppet/lib/puppet/parser/resource.rb +0 -416
  651. data/vendored/puppet/lib/puppet/parser/resource/param.rb +0 -29
  652. data/vendored/puppet/lib/puppet/parser/scope.rb +0 -1123
  653. data/vendored/puppet/lib/puppet/parser/script_compiler.rb +0 -123
  654. data/vendored/puppet/lib/puppet/parser/templatewrapper.rb +0 -102
  655. data/vendored/puppet/lib/puppet/parser/type_loader.rb +0 -149
  656. data/vendored/puppet/lib/puppet/plugins.rb +0 -9
  657. data/vendored/puppet/lib/puppet/plugins/configuration.rb +0 -25
  658. data/vendored/puppet/lib/puppet/plugins/syntax_checkers.rb +0 -98
  659. data/vendored/puppet/lib/puppet/pops.rb +0 -121
  660. data/vendored/puppet/lib/puppet/pops/adaptable.rb +0 -206
  661. data/vendored/puppet/lib/puppet/pops/adapters.rb +0 -152
  662. data/vendored/puppet/lib/puppet/pops/evaluator/access_operator.rb +0 -719
  663. data/vendored/puppet/lib/puppet/pops/evaluator/callable_signature.rb +0 -107
  664. data/vendored/puppet/lib/puppet/pops/evaluator/closure.rb +0 -373
  665. data/vendored/puppet/lib/puppet/pops/evaluator/collector_transformer.rb +0 -234
  666. data/vendored/puppet/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +0 -86
  667. data/vendored/puppet/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +0 -29
  668. data/vendored/puppet/lib/puppet/pops/evaluator/collectors/exported_collector.rb +0 -69
  669. data/vendored/puppet/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +0 -37
  670. data/vendored/puppet/lib/puppet/pops/evaluator/compare_operator.rb +0 -254
  671. data/vendored/puppet/lib/puppet/pops/evaluator/deferred_resolver.rb +0 -130
  672. data/vendored/puppet/lib/puppet/pops/evaluator/epp_evaluator.rb +0 -120
  673. data/vendored/puppet/lib/puppet/pops/evaluator/evaluator_impl.rb +0 -1299
  674. data/vendored/puppet/lib/puppet/pops/evaluator/external_syntax_support.rb +0 -45
  675. data/vendored/puppet/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +0 -82
  676. data/vendored/puppet/lib/puppet/pops/evaluator/literal_evaluator.rb +0 -87
  677. data/vendored/puppet/lib/puppet/pops/evaluator/puppet_proc.rb +0 -69
  678. data/vendored/puppet/lib/puppet/pops/evaluator/relationship_operator.rb +0 -185
  679. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_converter.rb +0 -221
  680. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_resource_support.rb +0 -117
  681. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +0 -534
  682. data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +0 -107
  683. data/vendored/puppet/lib/puppet/pops/functions/dispatcher.rb +0 -71
  684. data/vendored/puppet/lib/puppet/pops/functions/function.rb +0 -141
  685. data/vendored/puppet/lib/puppet/pops/issue_reporter.rb +0 -137
  686. data/vendored/puppet/lib/puppet/pops/issues.rb +0 -921
  687. data/vendored/puppet/lib/puppet/pops/label_provider.rb +0 -90
  688. data/vendored/puppet/lib/puppet/pops/loader/base_loader.rb +0 -166
  689. data/vendored/puppet/lib/puppet/pops/loader/dependency_loader.rb +0 -92
  690. data/vendored/puppet/lib/puppet/pops/loader/gem_support.rb +0 -49
  691. data/vendored/puppet/lib/puppet/pops/loader/loader.rb +0 -209
  692. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +0 -377
  693. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +0 -549
  694. data/vendored/puppet/lib/puppet/pops/loader/null_loader.rb +0 -60
  695. data/vendored/puppet/lib/puppet/pops/loader/predefined_loader.rb +0 -24
  696. data/vendored/puppet/lib/puppet/pops/loader/puppet_function_instantiator.rb +0 -84
  697. data/vendored/puppet/lib/puppet/pops/loader/puppet_plan_instantiator.rb +0 -84
  698. data/vendored/puppet/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +0 -79
  699. data/vendored/puppet/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +0 -39
  700. data/vendored/puppet/lib/puppet/pops/loader/ruby_function_instantiator.rb +0 -45
  701. data/vendored/puppet/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +0 -62
  702. data/vendored/puppet/lib/puppet/pops/loader/runtime3_type_loader.rb +0 -101
  703. data/vendored/puppet/lib/puppet/pops/loader/simple_environment_loader.rb +0 -20
  704. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -127
  705. data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +0 -40
  706. data/vendored/puppet/lib/puppet/pops/loader/type_definition_instantiator.rb +0 -100
  707. data/vendored/puppet/lib/puppet/pops/loader/typed_name.rb +0 -54
  708. data/vendored/puppet/lib/puppet/pops/loader/uri_helper.rb +0 -22
  709. data/vendored/puppet/lib/puppet/pops/loaders.rb +0 -533
  710. data/vendored/puppet/lib/puppet/pops/lookup.rb +0 -96
  711. data/vendored/puppet/lib/puppet/pops/lookup/configured_data_provider.rb +0 -93
  712. data/vendored/puppet/lib/puppet/pops/lookup/context.rb +0 -200
  713. data/vendored/puppet/lib/puppet/pops/lookup/data_adapter.rb +0 -27
  714. data/vendored/puppet/lib/puppet/pops/lookup/data_dig_function_provider.rb +0 -145
  715. data/vendored/puppet/lib/puppet/pops/lookup/data_hash_function_provider.rb +0 -126
  716. data/vendored/puppet/lib/puppet/pops/lookup/data_provider.rb +0 -92
  717. data/vendored/puppet/lib/puppet/pops/lookup/environment_data_provider.rb +0 -35
  718. data/vendored/puppet/lib/puppet/pops/lookup/explainer.rb +0 -595
  719. data/vendored/puppet/lib/puppet/pops/lookup/function_provider.rb +0 -110
  720. data/vendored/puppet/lib/puppet/pops/lookup/global_data_provider.rb +0 -75
  721. data/vendored/puppet/lib/puppet/pops/lookup/hiera_config.rb +0 -761
  722. data/vendored/puppet/lib/puppet/pops/lookup/interpolation.rb +0 -154
  723. data/vendored/puppet/lib/puppet/pops/lookup/invocation.rb +0 -261
  724. data/vendored/puppet/lib/puppet/pops/lookup/location_resolver.rb +0 -99
  725. data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +0 -520
  726. data/vendored/puppet/lib/puppet/pops/lookup/lookup_key.rb +0 -99
  727. data/vendored/puppet/lib/puppet/pops/lookup/lookup_key_function_provider.rb +0 -92
  728. data/vendored/puppet/lib/puppet/pops/lookup/module_data_provider.rb +0 -89
  729. data/vendored/puppet/lib/puppet/pops/lookup/sub_lookup.rb +0 -92
  730. data/vendored/puppet/lib/puppet/pops/merge_strategy.rb +0 -437
  731. data/vendored/puppet/lib/puppet/pops/migration/migration_checker.rb +0 -58
  732. data/vendored/puppet/lib/puppet/pops/model/ast.rb +0 -4964
  733. data/vendored/puppet/lib/puppet/pops/model/ast_transformer.rb +0 -131
  734. data/vendored/puppet/lib/puppet/pops/model/factory.rb +0 -1163
  735. data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +0 -139
  736. data/vendored/puppet/lib/puppet/pops/model/model_tree_dumper.rb +0 -467
  737. data/vendored/puppet/lib/puppet/pops/model/pn_transformer.rb +0 -400
  738. data/vendored/puppet/lib/puppet/pops/model/tree_dumper.rb +0 -59
  739. data/vendored/puppet/lib/puppet/pops/parser/code_merger.rb +0 -29
  740. data/vendored/puppet/lib/puppet/pops/parser/eparser.rb +0 -3361
  741. data/vendored/puppet/lib/puppet/pops/parser/epp_parser.rb +0 -51
  742. data/vendored/puppet/lib/puppet/pops/parser/epp_support.rb +0 -264
  743. data/vendored/puppet/lib/puppet/pops/parser/evaluating_parser.rb +0 -165
  744. data/vendored/puppet/lib/puppet/pops/parser/heredoc_support.rb +0 -143
  745. data/vendored/puppet/lib/puppet/pops/parser/interpolation_support.rb +0 -244
  746. data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +0 -772
  747. data/vendored/puppet/lib/puppet/pops/parser/lexer_support.rb +0 -221
  748. data/vendored/puppet/lib/puppet/pops/parser/locatable.rb +0 -23
  749. data/vendored/puppet/lib/puppet/pops/parser/locator.rb +0 -336
  750. data/vendored/puppet/lib/puppet/pops/parser/parser_support.rb +0 -247
  751. data/vendored/puppet/lib/puppet/pops/parser/pn_parser.rb +0 -316
  752. data/vendored/puppet/lib/puppet/pops/parser/slurp_support.rb +0 -117
  753. data/vendored/puppet/lib/puppet/pops/patterns.rb +0 -60
  754. data/vendored/puppet/lib/puppet/pops/pcore.rb +0 -135
  755. data/vendored/puppet/lib/puppet/pops/pn.rb +0 -236
  756. data/vendored/puppet/lib/puppet/pops/puppet_stack.rb +0 -57
  757. data/vendored/puppet/lib/puppet/pops/resource/param.rb +0 -55
  758. data/vendored/puppet/lib/puppet/pops/resource/resource_type_impl.rb +0 -314
  759. data/vendored/puppet/lib/puppet/pops/semantic_error.rb +0 -29
  760. data/vendored/puppet/lib/puppet/pops/serialization.rb +0 -43
  761. data/vendored/puppet/lib/puppet/pops/serialization/abstract_reader.rb +0 -180
  762. data/vendored/puppet/lib/puppet/pops/serialization/abstract_writer.rb +0 -222
  763. data/vendored/puppet/lib/puppet/pops/serialization/deserializer.rb +0 -80
  764. data/vendored/puppet/lib/puppet/pops/serialization/extension.rb +0 -158
  765. data/vendored/puppet/lib/puppet/pops/serialization/from_data_converter.rb +0 -224
  766. data/vendored/puppet/lib/puppet/pops/serialization/instance_reader.rb +0 -19
  767. data/vendored/puppet/lib/puppet/pops/serialization/instance_writer.rb +0 -14
  768. data/vendored/puppet/lib/puppet/pops/serialization/json.rb +0 -297
  769. data/vendored/puppet/lib/puppet/pops/serialization/json_path.rb +0 -127
  770. data/vendored/puppet/lib/puppet/pops/serialization/object.rb +0 -70
  771. data/vendored/puppet/lib/puppet/pops/serialization/serializer.rb +0 -140
  772. data/vendored/puppet/lib/puppet/pops/serialization/time_factory.rb +0 -67
  773. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +0 -313
  774. data/vendored/puppet/lib/puppet/pops/serialization/to_stringified_converter.rb +0 -226
  775. data/vendored/puppet/lib/puppet/pops/time/timespan.rb +0 -718
  776. data/vendored/puppet/lib/puppet/pops/time/timestamp.rb +0 -160
  777. data/vendored/puppet/lib/puppet/pops/types/annotatable.rb +0 -36
  778. data/vendored/puppet/lib/puppet/pops/types/annotation.rb +0 -71
  779. data/vendored/puppet/lib/puppet/pops/types/class_loader.rb +0 -132
  780. data/vendored/puppet/lib/puppet/pops/types/enumeration.rb +0 -16
  781. data/vendored/puppet/lib/puppet/pops/types/implementation_registry.rb +0 -134
  782. data/vendored/puppet/lib/puppet/pops/types/iterable.rb +0 -339
  783. data/vendored/puppet/lib/puppet/pops/types/p_binary_type.rb +0 -232
  784. data/vendored/puppet/lib/puppet/pops/types/p_init_type.rb +0 -238
  785. data/vendored/puppet/lib/puppet/pops/types/p_meta_type.rb +0 -94
  786. data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +0 -1117
  787. data/vendored/puppet/lib/puppet/pops/types/p_object_type_extension.rb +0 -218
  788. data/vendored/puppet/lib/puppet/pops/types/p_runtime_type.rb +0 -115
  789. data/vendored/puppet/lib/puppet/pops/types/p_sem_ver_range_type.rb +0 -190
  790. data/vendored/puppet/lib/puppet/pops/types/p_sem_ver_type.rb +0 -149
  791. data/vendored/puppet/lib/puppet/pops/types/p_sensitive_type.rb +0 -73
  792. data/vendored/puppet/lib/puppet/pops/types/p_timespan_type.rb +0 -192
  793. data/vendored/puppet/lib/puppet/pops/types/p_timestamp_type.rb +0 -73
  794. data/vendored/puppet/lib/puppet/pops/types/p_type_set_type.rb +0 -383
  795. data/vendored/puppet/lib/puppet/pops/types/p_uri_type.rb +0 -190
  796. data/vendored/puppet/lib/puppet/pops/types/puppet_object.rb +0 -40
  797. data/vendored/puppet/lib/puppet/pops/types/recursion_guard.rb +0 -136
  798. data/vendored/puppet/lib/puppet/pops/types/ruby_generator.rb +0 -472
  799. data/vendored/puppet/lib/puppet/pops/types/ruby_method.rb +0 -31
  800. data/vendored/puppet/lib/puppet/pops/types/string_converter.rb +0 -1123
  801. data/vendored/puppet/lib/puppet/pops/types/tree_iterators.rb +0 -254
  802. data/vendored/puppet/lib/puppet/pops/types/type_acceptor.rb +0 -25
  803. data/vendored/puppet/lib/puppet/pops/types/type_asserter.rb +0 -47
  804. data/vendored/puppet/lib/puppet/pops/types/type_assertion_error.rb +0 -27
  805. data/vendored/puppet/lib/puppet/pops/types/type_calculator.rb +0 -809
  806. data/vendored/puppet/lib/puppet/pops/types/type_conversion_error.rb +0 -15
  807. data/vendored/puppet/lib/puppet/pops/types/type_factory.rb +0 -631
  808. data/vendored/puppet/lib/puppet/pops/types/type_formatter.rb +0 -802
  809. data/vendored/puppet/lib/puppet/pops/types/type_mismatch_describer.rb +0 -1075
  810. data/vendored/puppet/lib/puppet/pops/types/type_parser.rb +0 -685
  811. data/vendored/puppet/lib/puppet/pops/types/type_set_reference.rb +0 -59
  812. data/vendored/puppet/lib/puppet/pops/types/type_with_members.rb +0 -43
  813. data/vendored/puppet/lib/puppet/pops/types/types.rb +0 -3631
  814. data/vendored/puppet/lib/puppet/pops/utils.rb +0 -119
  815. data/vendored/puppet/lib/puppet/pops/validation.rb +0 -466
  816. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +0 -1127
  817. data/vendored/puppet/lib/puppet/pops/validation/tasks_checker.rb +0 -101
  818. data/vendored/puppet/lib/puppet/pops/validation/validator_factory_4_0.rb +0 -43
  819. data/vendored/puppet/lib/puppet/pops/visitable.rb +0 -6
  820. data/vendored/puppet/lib/puppet/pops/visitor.rb +0 -116
  821. data/vendored/puppet/lib/puppet/property.rb +0 -608
  822. data/vendored/puppet/lib/puppet/property/boolean.rb +0 -7
  823. data/vendored/puppet/lib/puppet/property/ensure.rb +0 -105
  824. data/vendored/puppet/lib/puppet/property/keyvalue.rb +0 -157
  825. data/vendored/puppet/lib/puppet/property/list.rb +0 -69
  826. data/vendored/puppet/lib/puppet/property/ordered_list.rb +0 -29
  827. data/vendored/puppet/lib/puppet/provider.rb +0 -624
  828. data/vendored/puppet/lib/puppet/provider/aix_object.rb +0 -483
  829. data/vendored/puppet/lib/puppet/provider/command.rb +0 -25
  830. data/vendored/puppet/lib/puppet/provider/confine.rb +0 -6
  831. data/vendored/puppet/lib/puppet/provider/exec.rb +0 -96
  832. data/vendored/puppet/lib/puppet/provider/exec/posix.rb +0 -48
  833. data/vendored/puppet/lib/puppet/provider/exec/shell.rb +0 -25
  834. data/vendored/puppet/lib/puppet/provider/exec/windows.rb +0 -55
  835. data/vendored/puppet/lib/puppet/provider/file/posix.rb +0 -136
  836. data/vendored/puppet/lib/puppet/provider/file/windows.rb +0 -104
  837. data/vendored/puppet/lib/puppet/provider/group/aix.rb +0 -82
  838. data/vendored/puppet/lib/puppet/provider/group/directoryservice.rb +0 -22
  839. data/vendored/puppet/lib/puppet/provider/group/groupadd.rb +0 -111
  840. data/vendored/puppet/lib/puppet/provider/group/ldap.rb +0 -45
  841. data/vendored/puppet/lib/puppet/provider/group/pw.rb +0 -49
  842. data/vendored/puppet/lib/puppet/provider/group/windows_adsi.rb +0 -106
  843. data/vendored/puppet/lib/puppet/provider/ldap.rb +0 -137
  844. data/vendored/puppet/lib/puppet/provider/nameservice.rb +0 -325
  845. data/vendored/puppet/lib/puppet/provider/nameservice/directoryservice.rb +0 -508
  846. data/vendored/puppet/lib/puppet/provider/nameservice/objectadd.rb +0 -22
  847. data/vendored/puppet/lib/puppet/provider/nameservice/pw.rb +0 -21
  848. data/vendored/puppet/lib/puppet/provider/network_device.rb +0 -72
  849. data/vendored/puppet/lib/puppet/provider/package.rb +0 -56
  850. data/vendored/puppet/lib/puppet/provider/package/aix.rb +0 -152
  851. data/vendored/puppet/lib/puppet/provider/package/appdmg.rb +0 -109
  852. data/vendored/puppet/lib/puppet/provider/package/apple.rb +0 -46
  853. data/vendored/puppet/lib/puppet/provider/package/apt.rb +0 -116
  854. data/vendored/puppet/lib/puppet/provider/package/aptitude.rb +0 -29
  855. data/vendored/puppet/lib/puppet/provider/package/aptrpm.rb +0 -83
  856. data/vendored/puppet/lib/puppet/provider/package/blastwave.rb +0 -111
  857. data/vendored/puppet/lib/puppet/provider/package/dnf.rb +0 -47
  858. data/vendored/puppet/lib/puppet/provider/package/dpkg.rb +0 -165
  859. data/vendored/puppet/lib/puppet/provider/package/fink.rb +0 -79
  860. data/vendored/puppet/lib/puppet/provider/package/freebsd.rb +0 -47
  861. data/vendored/puppet/lib/puppet/provider/package/gem.rb +0 -175
  862. data/vendored/puppet/lib/puppet/provider/package/hpux.rb +0 -44
  863. data/vendored/puppet/lib/puppet/provider/package/macports.rb +0 -107
  864. data/vendored/puppet/lib/puppet/provider/package/nim.rb +0 -282
  865. data/vendored/puppet/lib/puppet/provider/package/openbsd.rb +0 -242
  866. data/vendored/puppet/lib/puppet/provider/package/opkg.rb +0 -81
  867. data/vendored/puppet/lib/puppet/provider/package/pacman.rb +0 -267
  868. data/vendored/puppet/lib/puppet/provider/package/pip.rb +0 -188
  869. data/vendored/puppet/lib/puppet/provider/package/pip3.rb +0 -20
  870. data/vendored/puppet/lib/puppet/provider/package/pkg.rb +0 -255
  871. data/vendored/puppet/lib/puppet/provider/package/pkgdmg.rb +0 -151
  872. data/vendored/puppet/lib/puppet/provider/package/pkgin.rb +0 -87
  873. data/vendored/puppet/lib/puppet/provider/package/pkgng.rb +0 -143
  874. data/vendored/puppet/lib/puppet/provider/package/pkgutil.rb +0 -186
  875. data/vendored/puppet/lib/puppet/provider/package/portage.rb +0 -300
  876. data/vendored/puppet/lib/puppet/provider/package/ports.rb +0 -91
  877. data/vendored/puppet/lib/puppet/provider/package/portupgrade.rb +0 -239
  878. data/vendored/puppet/lib/puppet/provider/package/puppet_gem.rb +0 -17
  879. data/vendored/puppet/lib/puppet/provider/package/rpm.rb +0 -405
  880. data/vendored/puppet/lib/puppet/provider/package/rug.rb +0 -51
  881. data/vendored/puppet/lib/puppet/provider/package/sun.rb +0 -133
  882. data/vendored/puppet/lib/puppet/provider/package/sunfreeware.rb +0 -9
  883. data/vendored/puppet/lib/puppet/provider/package/tdnf.rb +0 -28
  884. data/vendored/puppet/lib/puppet/provider/package/up2date.rb +0 -40
  885. data/vendored/puppet/lib/puppet/provider/package/urpmi.rb +0 -55
  886. data/vendored/puppet/lib/puppet/provider/package/windows.rb +0 -113
  887. data/vendored/puppet/lib/puppet/provider/package/windows/exe_package.rb +0 -71
  888. data/vendored/puppet/lib/puppet/provider/package/windows/msi_package.rb +0 -62
  889. data/vendored/puppet/lib/puppet/provider/package/windows/package.rb +0 -100
  890. data/vendored/puppet/lib/puppet/provider/package/yum.rb +0 -293
  891. data/vendored/puppet/lib/puppet/provider/package/zypper.rb +0 -145
  892. data/vendored/puppet/lib/puppet/provider/parsedfile.rb +0 -459
  893. data/vendored/puppet/lib/puppet/provider/service/base.rb +0 -134
  894. data/vendored/puppet/lib/puppet/provider/service/bsd.rb +0 -51
  895. data/vendored/puppet/lib/puppet/provider/service/daemontools.rb +0 -194
  896. data/vendored/puppet/lib/puppet/provider/service/debian.rb +0 -75
  897. data/vendored/puppet/lib/puppet/provider/service/freebsd.rb +0 -143
  898. data/vendored/puppet/lib/puppet/provider/service/gentoo.rb +0 -45
  899. data/vendored/puppet/lib/puppet/provider/service/init.rb +0 -194
  900. data/vendored/puppet/lib/puppet/provider/service/launchd.rb +0 -345
  901. data/vendored/puppet/lib/puppet/provider/service/openbsd.rb +0 -100
  902. data/vendored/puppet/lib/puppet/provider/service/openrc.rb +0 -71
  903. data/vendored/puppet/lib/puppet/provider/service/openwrt.rb +0 -36
  904. data/vendored/puppet/lib/puppet/provider/service/rcng.rb +0 -51
  905. data/vendored/puppet/lib/puppet/provider/service/redhat.rb +0 -72
  906. data/vendored/puppet/lib/puppet/provider/service/runit.rb +0 -112
  907. data/vendored/puppet/lib/puppet/provider/service/service.rb +0 -42
  908. data/vendored/puppet/lib/puppet/provider/service/smf.rb +0 -169
  909. data/vendored/puppet/lib/puppet/provider/service/src.rb +0 -147
  910. data/vendored/puppet/lib/puppet/provider/service/systemd.rb +0 -189
  911. data/vendored/puppet/lib/puppet/provider/service/upstart.rb +0 -369
  912. data/vendored/puppet/lib/puppet/provider/service/windows.rb +0 -103
  913. data/vendored/puppet/lib/puppet/provider/user/aix.rb +0 -271
  914. data/vendored/puppet/lib/puppet/provider/user/directoryservice.rb +0 -632
  915. data/vendored/puppet/lib/puppet/provider/user/hpux.rb +0 -95
  916. data/vendored/puppet/lib/puppet/provider/user/ldap.rb +0 -128
  917. data/vendored/puppet/lib/puppet/provider/user/openbsd.rb +0 -76
  918. data/vendored/puppet/lib/puppet/provider/user/pw.rb +0 -98
  919. data/vendored/puppet/lib/puppet/provider/user/user_role_add.rb +0 -233
  920. data/vendored/puppet/lib/puppet/provider/user/useradd.rb +0 -265
  921. data/vendored/puppet/lib/puppet/provider/user/windows_adsi.rb +0 -148
  922. data/vendored/puppet/lib/puppet/reference/configuration.rb +0 -92
  923. data/vendored/puppet/lib/puppet/reference/function.rb +0 -17
  924. data/vendored/puppet/lib/puppet/reference/indirection.rb +0 -71
  925. data/vendored/puppet/lib/puppet/reference/metaparameter.rb +0 -35
  926. data/vendored/puppet/lib/puppet/reference/providers.rb +0 -118
  927. data/vendored/puppet/lib/puppet/reference/report.rb +0 -20
  928. data/vendored/puppet/lib/puppet/reference/type.rb +0 -113
  929. data/vendored/puppet/lib/puppet/relationship.rb +0 -89
  930. data/vendored/puppet/lib/puppet/reports.rb +0 -93
  931. data/vendored/puppet/lib/puppet/reports/http.rb +0 -37
  932. data/vendored/puppet/lib/puppet/reports/log.rb +0 -14
  933. data/vendored/puppet/lib/puppet/reports/store.rb +0 -68
  934. data/vendored/puppet/lib/puppet/resource.rb +0 -687
  935. data/vendored/puppet/lib/puppet/resource/capability_finder.rb +0 -150
  936. data/vendored/puppet/lib/puppet/resource/catalog.rb +0 -675
  937. data/vendored/puppet/lib/puppet/resource/status.rb +0 -229
  938. data/vendored/puppet/lib/puppet/resource/type.rb +0 -528
  939. data/vendored/puppet/lib/puppet/resource/type_collection.rb +0 -263
  940. data/vendored/puppet/lib/puppet/rest/client.rb +0 -83
  941. data/vendored/puppet/lib/puppet/rest/errors.rb +0 -14
  942. data/vendored/puppet/lib/puppet/rest/response.rb +0 -34
  943. data/vendored/puppet/lib/puppet/rest/route.rb +0 -84
  944. data/vendored/puppet/lib/puppet/rest/routes.rb +0 -154
  945. data/vendored/puppet/lib/puppet/rest/ssl_context.rb +0 -13
  946. data/vendored/puppet/lib/puppet/scheduler.rb +0 -16
  947. data/vendored/puppet/lib/puppet/scheduler/job.rb +0 -53
  948. data/vendored/puppet/lib/puppet/scheduler/scheduler.rb +0 -44
  949. data/vendored/puppet/lib/puppet/scheduler/splay_job.rb +0 -32
  950. data/vendored/puppet/lib/puppet/scheduler/timer.rb +0 -13
  951. data/vendored/puppet/lib/puppet/settings.rb +0 -1485
  952. data/vendored/puppet/lib/puppet/settings/array_setting.rb +0 -17
  953. data/vendored/puppet/lib/puppet/settings/autosign_setting.rb +0 -22
  954. data/vendored/puppet/lib/puppet/settings/base_setting.rb +0 -197
  955. data/vendored/puppet/lib/puppet/settings/boolean_setting.rb +0 -32
  956. data/vendored/puppet/lib/puppet/settings/certificate_revocation_setting.rb +0 -21
  957. data/vendored/puppet/lib/puppet/settings/config_file.rb +0 -152
  958. data/vendored/puppet/lib/puppet/settings/directory_setting.rb +0 -18
  959. data/vendored/puppet/lib/puppet/settings/duration_setting.rb +0 -32
  960. data/vendored/puppet/lib/puppet/settings/enum_setting.rb +0 -16
  961. data/vendored/puppet/lib/puppet/settings/environment_conf.rb +0 -222
  962. data/vendored/puppet/lib/puppet/settings/errors.rb +0 -11
  963. data/vendored/puppet/lib/puppet/settings/file_or_directory_setting.rb +0 -40
  964. data/vendored/puppet/lib/puppet/settings/file_setting.rb +0 -245
  965. data/vendored/puppet/lib/puppet/settings/ini_file.rb +0 -225
  966. data/vendored/puppet/lib/puppet/settings/path_setting.rb +0 -8
  967. data/vendored/puppet/lib/puppet/settings/priority_setting.rb +0 -42
  968. data/vendored/puppet/lib/puppet/settings/server_list_setting.rb +0 -20
  969. data/vendored/puppet/lib/puppet/settings/string_setting.rb +0 -9
  970. data/vendored/puppet/lib/puppet/settings/symbolic_enum_setting.rb +0 -17
  971. data/vendored/puppet/lib/puppet/settings/terminus_setting.rb +0 -14
  972. data/vendored/puppet/lib/puppet/settings/ttl_setting.rb +0 -51
  973. data/vendored/puppet/lib/puppet/settings/value_translator.rb +0 -15
  974. data/vendored/puppet/lib/puppet/ssl.rb +0 -12
  975. data/vendored/puppet/lib/puppet/ssl/base.rb +0 -150
  976. data/vendored/puppet/lib/puppet/ssl/certificate.rb +0 -99
  977. data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +0 -325
  978. data/vendored/puppet/lib/puppet/ssl/certificate_request_attributes.rb +0 -37
  979. data/vendored/puppet/lib/puppet/ssl/certificate_signer.rb +0 -33
  980. data/vendored/puppet/lib/puppet/ssl/digest.rb +0 -20
  981. data/vendored/puppet/lib/puppet/ssl/host.rb +0 -626
  982. data/vendored/puppet/lib/puppet/ssl/key.rb +0 -59
  983. data/vendored/puppet/lib/puppet/ssl/oids.rb +0 -193
  984. data/vendored/puppet/lib/puppet/ssl/validator.rb +0 -60
  985. data/vendored/puppet/lib/puppet/ssl/validator/default_validator.rb +0 -187
  986. data/vendored/puppet/lib/puppet/ssl/validator/no_validator.rb +0 -20
  987. data/vendored/puppet/lib/puppet/status.rb +0 -40
  988. data/vendored/puppet/lib/puppet/syntax_checkers.rb +0 -3
  989. data/vendored/puppet/lib/puppet/syntax_checkers/base64.rb +0 -40
  990. data/vendored/puppet/lib/puppet/syntax_checkers/json.rb +0 -35
  991. data/vendored/puppet/lib/puppet/test/test_helper.rb +0 -251
  992. data/vendored/puppet/lib/puppet/transaction.rb +0 -444
  993. data/vendored/puppet/lib/puppet/transaction/additional_resource_generator.rb +0 -220
  994. data/vendored/puppet/lib/puppet/transaction/event.rb +0 -167
  995. data/vendored/puppet/lib/puppet/transaction/event_manager.rb +0 -169
  996. data/vendored/puppet/lib/puppet/transaction/persistence.rb +0 -99
  997. data/vendored/puppet/lib/puppet/transaction/report.rb +0 -471
  998. data/vendored/puppet/lib/puppet/transaction/resource_harness.rb +0 -318
  999. data/vendored/puppet/lib/puppet/type.rb +0 -2673
  1000. data/vendored/puppet/lib/puppet/type/component.rb +0 -88
  1001. data/vendored/puppet/lib/puppet/type/exec.rb +0 -625
  1002. data/vendored/puppet/lib/puppet/type/file.rb +0 -1042
  1003. data/vendored/puppet/lib/puppet/type/file/checksum.rb +0 -50
  1004. data/vendored/puppet/lib/puppet/type/file/checksum_value.rb +0 -54
  1005. data/vendored/puppet/lib/puppet/type/file/content.rb +0 -172
  1006. data/vendored/puppet/lib/puppet/type/file/ctime.rb +0 -20
  1007. data/vendored/puppet/lib/puppet/type/file/data_sync.rb +0 -93
  1008. data/vendored/puppet/lib/puppet/type/file/ensure.rb +0 -192
  1009. data/vendored/puppet/lib/puppet/type/file/group.rb +0 -41
  1010. data/vendored/puppet/lib/puppet/type/file/mode.rb +0 -177
  1011. data/vendored/puppet/lib/puppet/type/file/mtime.rb +0 -18
  1012. data/vendored/puppet/lib/puppet/type/file/owner.rb +0 -44
  1013. data/vendored/puppet/lib/puppet/type/file/selcontext.rb +0 -141
  1014. data/vendored/puppet/lib/puppet/type/file/source.rb +0 -369
  1015. data/vendored/puppet/lib/puppet/type/file/target.rb +0 -87
  1016. data/vendored/puppet/lib/puppet/type/file/type.rb +0 -19
  1017. data/vendored/puppet/lib/puppet/type/filebucket.rb +0 -117
  1018. data/vendored/puppet/lib/puppet/type/group.rb +0 -207
  1019. data/vendored/puppet/lib/puppet/type/notify.rb +0 -46
  1020. data/vendored/puppet/lib/puppet/type/package.rb +0 -568
  1021. data/vendored/puppet/lib/puppet/type/resources.rb +0 -180
  1022. data/vendored/puppet/lib/puppet/type/schedule.rb +0 -430
  1023. data/vendored/puppet/lib/puppet/type/service.rb +0 -255
  1024. data/vendored/puppet/lib/puppet/type/stage.rb +0 -27
  1025. data/vendored/puppet/lib/puppet/type/tidy.rb +0 -349
  1026. data/vendored/puppet/lib/puppet/type/user.rb +0 -818
  1027. data/vendored/puppet/lib/puppet/type/whit.rb +0 -34
  1028. data/vendored/puppet/lib/puppet/util.rb +0 -705
  1029. data/vendored/puppet/lib/puppet/util/at_fork.rb +0 -35
  1030. data/vendored/puppet/lib/puppet/util/at_fork/noop.rb +0 -18
  1031. data/vendored/puppet/lib/puppet/util/at_fork/solaris.rb +0 -160
  1032. data/vendored/puppet/lib/puppet/util/autoload.rb +0 -234
  1033. data/vendored/puppet/lib/puppet/util/backups.rb +0 -86
  1034. data/vendored/puppet/lib/puppet/util/character_encoding.rb +0 -76
  1035. data/vendored/puppet/lib/puppet/util/checksums.rb +0 -361
  1036. data/vendored/puppet/lib/puppet/util/classgen.rb +0 -222
  1037. data/vendored/puppet/lib/puppet/util/colors.rb +0 -100
  1038. data/vendored/puppet/lib/puppet/util/command_line.rb +0 -189
  1039. data/vendored/puppet/lib/puppet/util/command_line/puppet_option_parser.rb +0 -87
  1040. data/vendored/puppet/lib/puppet/util/command_line/trollop.rb +0 -825
  1041. data/vendored/puppet/lib/puppet/util/connection.rb +0 -74
  1042. data/vendored/puppet/lib/puppet/util/constant_inflector.rb +0 -24
  1043. data/vendored/puppet/lib/puppet/util/diff.rb +0 -79
  1044. data/vendored/puppet/lib/puppet/util/docs.rb +0 -128
  1045. data/vendored/puppet/lib/puppet/util/errors.rb +0 -159
  1046. data/vendored/puppet/lib/puppet/util/execution.rb +0 -412
  1047. data/vendored/puppet/lib/puppet/util/execution_stub.rb +0 -26
  1048. data/vendored/puppet/lib/puppet/util/feature.rb +0 -117
  1049. data/vendored/puppet/lib/puppet/util/file_watcher.rb +0 -28
  1050. data/vendored/puppet/lib/puppet/util/fileparsing.rb +0 -397
  1051. data/vendored/puppet/lib/puppet/util/filetype.rb +0 -309
  1052. data/vendored/puppet/lib/puppet/util/http_proxy.rb +0 -207
  1053. data/vendored/puppet/lib/puppet/util/inifile.rb +0 -340
  1054. data/vendored/puppet/lib/puppet/util/instance_loader.rb +0 -61
  1055. data/vendored/puppet/lib/puppet/util/json.rb +0 -69
  1056. data/vendored/puppet/lib/puppet/util/json_lockfile.rb +0 -44
  1057. data/vendored/puppet/lib/puppet/util/ldap.rb +0 -2
  1058. data/vendored/puppet/lib/puppet/util/ldap/connection.rb +0 -71
  1059. data/vendored/puppet/lib/puppet/util/ldap/generator.rb +0 -42
  1060. data/vendored/puppet/lib/puppet/util/ldap/manager.rb +0 -281
  1061. data/vendored/puppet/lib/puppet/util/libuser.rb +0 -12
  1062. data/vendored/puppet/lib/puppet/util/limits.rb +0 -12
  1063. data/vendored/puppet/lib/puppet/util/lockfile.rb +0 -66
  1064. data/vendored/puppet/lib/puppet/util/log.rb +0 -415
  1065. data/vendored/puppet/lib/puppet/util/log/destination.rb +0 -49
  1066. data/vendored/puppet/lib/puppet/util/log/destinations.rb +0 -258
  1067. data/vendored/puppet/lib/puppet/util/logging.rb +0 -311
  1068. data/vendored/puppet/lib/puppet/util/metaid.rb +0 -21
  1069. data/vendored/puppet/lib/puppet/util/metric.rb +0 -64
  1070. data/vendored/puppet/lib/puppet/util/monkey_patches.rb +0 -108
  1071. data/vendored/puppet/lib/puppet/util/multi_match.rb +0 -51
  1072. data/vendored/puppet/lib/puppet/util/network_device.rb +0 -17
  1073. data/vendored/puppet/lib/puppet/util/network_device/base.rb +0 -23
  1074. data/vendored/puppet/lib/puppet/util/network_device/config.rb +0 -105
  1075. data/vendored/puppet/lib/puppet/util/network_device/transport.rb +0 -5
  1076. data/vendored/puppet/lib/puppet/util/network_device/transport/base.rb +0 -26
  1077. data/vendored/puppet/lib/puppet/util/package.rb +0 -31
  1078. data/vendored/puppet/lib/puppet/util/pidlock.rb +0 -62
  1079. data/vendored/puppet/lib/puppet/util/platform.rb +0 -38
  1080. data/vendored/puppet/lib/puppet/util/plist.rb +0 -155
  1081. data/vendored/puppet/lib/puppet/util/posix.rb +0 -137
  1082. data/vendored/puppet/lib/puppet/util/profiler.rb +0 -53
  1083. data/vendored/puppet/lib/puppet/util/profiler/aggregate.rb +0 -85
  1084. data/vendored/puppet/lib/puppet/util/profiler/around_profiler.rb +0 -67
  1085. data/vendored/puppet/lib/puppet/util/profiler/logging.rb +0 -48
  1086. data/vendored/puppet/lib/puppet/util/profiler/object_counts.rb +0 -17
  1087. data/vendored/puppet/lib/puppet/util/profiler/wall_clock.rb +0 -35
  1088. data/vendored/puppet/lib/puppet/util/provider_features.rb +0 -181
  1089. data/vendored/puppet/lib/puppet/util/psych_support.rb +0 -30
  1090. data/vendored/puppet/lib/puppet/util/rdoc.rb +0 -60
  1091. data/vendored/puppet/lib/puppet/util/rdoc/code_objects.rb +0 -294
  1092. data/vendored/puppet/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -910
  1093. data/vendored/puppet/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +0 -1085
  1094. data/vendored/puppet/lib/puppet/util/rdoc/parser.rb +0 -12
  1095. data/vendored/puppet/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +0 -259
  1096. data/vendored/puppet/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +0 -14
  1097. data/vendored/puppet/lib/puppet/util/reference.rb +0 -119
  1098. data/vendored/puppet/lib/puppet/util/resource_template.rb +0 -61
  1099. data/vendored/puppet/lib/puppet/util/retry_action.rb +0 -46
  1100. data/vendored/puppet/lib/puppet/util/rubygems.rb +0 -63
  1101. data/vendored/puppet/lib/puppet/util/run_mode.rb +0 -110
  1102. data/vendored/puppet/lib/puppet/util/selinux.rb +0 -264
  1103. data/vendored/puppet/lib/puppet/util/skip_tags.rb +0 -9
  1104. data/vendored/puppet/lib/puppet/util/splayer.rb +0 -18
  1105. data/vendored/puppet/lib/puppet/util/ssl.rb +0 -92
  1106. data/vendored/puppet/lib/puppet/util/storage.rb +0 -89
  1107. data/vendored/puppet/lib/puppet/util/suidmanager.rb +0 -167
  1108. data/vendored/puppet/lib/puppet/util/symbolic_file_mode.rb +0 -144
  1109. data/vendored/puppet/lib/puppet/util/tag_set.rb +0 -27
  1110. data/vendored/puppet/lib/puppet/util/tagging.rb +0 -131
  1111. data/vendored/puppet/lib/puppet/util/terminal.rb +0 -16
  1112. data/vendored/puppet/lib/puppet/util/user_attr.rb +0 -21
  1113. data/vendored/puppet/lib/puppet/util/warnings.rb +0 -31
  1114. data/vendored/puppet/lib/puppet/util/watched_file.rb +0 -37
  1115. data/vendored/puppet/lib/puppet/util/watcher.rb +0 -17
  1116. data/vendored/puppet/lib/puppet/util/watcher/change_watcher.rb +0 -33
  1117. data/vendored/puppet/lib/puppet/util/watcher/periodic_watcher.rb +0 -37
  1118. data/vendored/puppet/lib/puppet/util/watcher/timer.rb +0 -19
  1119. data/vendored/puppet/lib/puppet/util/windows.rb +0 -52
  1120. data/vendored/puppet/lib/puppet/util/windows/access_control_entry.rb +0 -84
  1121. data/vendored/puppet/lib/puppet/util/windows/access_control_list.rb +0 -113
  1122. data/vendored/puppet/lib/puppet/util/windows/adsi.rb +0 -494
  1123. data/vendored/puppet/lib/puppet/util/windows/api_types.rb +0 -282
  1124. data/vendored/puppet/lib/puppet/util/windows/com.rb +0 -225
  1125. data/vendored/puppet/lib/puppet/util/windows/error.rb +0 -83
  1126. data/vendored/puppet/lib/puppet/util/windows/eventlog.rb +0 -197
  1127. data/vendored/puppet/lib/puppet/util/windows/file.rb +0 -589
  1128. data/vendored/puppet/lib/puppet/util/windows/principal.rb +0 -192
  1129. data/vendored/puppet/lib/puppet/util/windows/process.rb +0 -497
  1130. data/vendored/puppet/lib/puppet/util/windows/registry.rb +0 -374
  1131. data/vendored/puppet/lib/puppet/util/windows/root_certs.rb +0 -108
  1132. data/vendored/puppet/lib/puppet/util/windows/security.rb +0 -869
  1133. data/vendored/puppet/lib/puppet/util/windows/security_descriptor.rb +0 -62
  1134. data/vendored/puppet/lib/puppet/util/windows/service.rb +0 -770
  1135. data/vendored/puppet/lib/puppet/util/windows/sid.rb +0 -282
  1136. data/vendored/puppet/lib/puppet/util/windows/string.rb +0 -16
  1137. data/vendored/puppet/lib/puppet/util/windows/user.rb +0 -309
  1138. data/vendored/puppet/lib/puppet/util/yaml.rb +0 -72
  1139. data/vendored/puppet/lib/puppet/vendor.rb +0 -57
  1140. data/vendored/puppet/lib/puppet/vendor/deep_merge/lib/deep_merge.rb +0 -2
  1141. data/vendored/puppet/lib/puppet/vendor/deep_merge/lib/deep_merge/core.rb +0 -210
  1142. data/vendored/puppet/lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb +0 -28
  1143. data/vendored/puppet/lib/puppet/vendor/deep_merge/lib/deep_merge/rails_compat.rb +0 -27
  1144. data/vendored/puppet/lib/puppet/vendor/deep_merge/test/test_deep_merge.rb +0 -608
  1145. data/vendored/puppet/lib/puppet/vendor/load_deep_merge.rb +0 -1
  1146. data/vendored/puppet/lib/puppet/vendor/load_pathspec.rb +0 -1
  1147. data/vendored/puppet/lib/puppet/vendor/pathspec/lib/pathspec.rb +0 -122
  1148. data/vendored/puppet/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb +0 -275
  1149. data/vendored/puppet/lib/puppet/vendor/pathspec/lib/pathspec/regexspec.rb +0 -17
  1150. data/vendored/puppet/lib/puppet/vendor/pathspec/lib/pathspec/spec.rb +0 -14
  1151. data/vendored/puppet/lib/puppet/vendor/require_vendored.rb +0 -6
  1152. data/vendored/puppet/lib/puppet/version.rb +0 -93
  1153. data/vendored/puppet/lib/puppet_pal.rb +0 -1135
  1154. data/vendored/puppet/lib/puppet_x.rb +0 -14
  1155. data/vendored/require_vendored.rb +0 -3
@@ -1,318 +0,0 @@
1
- require 'puppet/resource/status'
2
-
3
- class Puppet::Transaction::ResourceHarness
4
- NO_ACTION = Object.new
5
-
6
- extend Forwardable
7
- def_delegators :@transaction, :relationship_graph
8
-
9
- attr_reader :transaction
10
-
11
- def initialize(transaction)
12
- @transaction = transaction
13
- @persistence = transaction.persistence
14
- end
15
-
16
- def evaluate(resource)
17
- status = Puppet::Resource::Status.new(resource)
18
-
19
- begin
20
- context = ResourceApplicationContext.from_resource(resource, status)
21
- perform_changes(resource, context)
22
-
23
- if status.changed? && ! resource.noop?
24
- cache(resource, :synced, Time.now)
25
- resource.flush if resource.respond_to?(:flush)
26
- end
27
- rescue => detail
28
- status.failed_because(detail)
29
- ensure
30
- status.evaluation_time = Time.now - status.time
31
- end
32
-
33
- status
34
- end
35
-
36
- def scheduled?(resource)
37
- return true if Puppet[:ignoreschedules]
38
- return true unless schedule = schedule(resource)
39
-
40
- # We use 'checked' here instead of 'synced' because otherwise we'll
41
- # end up checking most resources most times, because they will generally
42
- # have been synced a long time ago (e.g., a file only gets updated
43
- # once a month on the server and its schedule is daily; the last sync time
44
- # will have been a month ago, so we'd end up checking every run).
45
- schedule.match?(cached(resource, :checked).to_i)
46
- end
47
-
48
- def schedule(resource)
49
- unless resource.catalog
50
- resource.warning _("Cannot schedule without a schedule-containing catalog")
51
- return nil
52
- end
53
-
54
- return nil unless name = resource[:schedule]
55
- resource.catalog.resource(:schedule, name) || resource.fail(_("Could not find schedule %{name}") % { name: name })
56
- end
57
-
58
- # Used mostly for scheduling and auditing at this point.
59
- def cached(resource, name)
60
- Puppet::Util::Storage.cache(resource)[name]
61
- end
62
-
63
- # Used mostly for scheduling and auditing at this point.
64
- def cache(resource, name, value)
65
- Puppet::Util::Storage.cache(resource)[name] = value
66
- end
67
-
68
- private
69
-
70
- def perform_changes(resource, context)
71
- cache(resource, :checked, Time.now)
72
-
73
- # Record the current state in state.yml.
74
- context.audited_params.each do |param|
75
- cache(resource, param, context.current_values[param])
76
- end
77
-
78
- ensure_param = resource.parameter(:ensure)
79
- if ensure_param && ensure_param.should
80
- ensure_event = sync_if_needed(ensure_param, context)
81
- else
82
- ensure_event = NO_ACTION
83
- end
84
-
85
- if ensure_event == NO_ACTION
86
- if context.resource_present?
87
- resource.properties.each do |param|
88
- sync_if_needed(param, context)
89
- end
90
- else
91
- resource.debug("Nothing to manage: no ensure and the resource doesn't exist")
92
- end
93
- end
94
-
95
- capture_audit_events(resource, context)
96
- persist_system_values(resource, context)
97
- end
98
-
99
- # We persist the last known values for the properties of a resource after resource
100
- # application.
101
- # @param [Puppet::Type] resource resource whose values we are to persist.
102
- # @param [ResourceApplicationContent] context the application context to operate on.
103
- def persist_system_values(resource, context)
104
- param_to_event = {}
105
- context.status.events.each do |ev|
106
- param_to_event[ev.property] = ev
107
- end
108
-
109
- context.system_value_params.each do |pname, param|
110
- @persistence.set_system_value(resource.ref, pname.to_s,
111
- new_system_value(param,
112
- param_to_event[pname.to_s],
113
- @persistence.get_system_value(resource.ref, pname.to_s)))
114
- end
115
- end
116
-
117
- def sync_if_needed(param, context)
118
- historical_value = context.historical_values[param.name]
119
- current_value = context.current_values[param.name]
120
- do_audit = context.audited_params.include?(param.name)
121
-
122
- begin
123
- if param.should && !param.safe_insync?(current_value)
124
- event = create_change_event(param, current_value, historical_value)
125
- if do_audit
126
- event = audit_event(event, param, context)
127
- end
128
-
129
- brief_audit_message = audit_message(param, do_audit, historical_value, current_value)
130
-
131
- if param.noop
132
- noop(event, param, current_value, brief_audit_message)
133
- else
134
- sync(event, param, current_value, brief_audit_message)
135
- end
136
-
137
- event
138
- else
139
- NO_ACTION
140
- end
141
- rescue => detail
142
- # Execution will continue on StandardErrors, just store the event
143
- Puppet.log_exception(detail)
144
-
145
- event = create_change_event(param, current_value, historical_value)
146
- event.status = "failure"
147
- event.message = param.format(_("change from %s to %s failed: "),
148
- param.is_to_s(current_value),
149
- param.should_to_s(param.should)) + detail.to_s
150
- event
151
- rescue Exception => detail
152
- # Execution will halt on Exceptions, they get raised to the application
153
- event = create_change_event(param, current_value, historical_value)
154
- event.status = "failure"
155
- event.message = param.format(_("change from %s to %s failed: "),
156
- param.is_to_s(current_value),
157
- param.should_to_s(param.should)) + detail.to_s
158
- raise
159
- ensure
160
- if event
161
- event.calculate_corrective_change(@persistence.get_system_value(context.resource.ref, param.name.to_s))
162
- context.record(event)
163
- event.send_log
164
- context.synced_params << param.name
165
- end
166
- end
167
- end
168
-
169
- def create_change_event(property, current_value, historical_value)
170
- options = {}
171
- should = property.should
172
-
173
- if property.sensitive
174
- options[:previous_value] = current_value.nil? ? nil : '[redacted]'
175
- options[:desired_value] = should.nil? ? nil : '[redacted]'
176
- options[:historical_value] = historical_value.nil? ? nil : '[redacted]'
177
- else
178
- options[:previous_value] = current_value
179
- options[:desired_value] = should
180
- options[:historical_value] = historical_value
181
- end
182
-
183
- property.event(options)
184
- end
185
-
186
- # This method is an ugly hack because, given a Time object with nanosecond
187
- # resolution, roundtripped through YAML serialization, the Time object will
188
- # be truncated to microseconds.
189
- # For audit purposes, this code special cases this comparison, and compares
190
- # the two objects by their second and microsecond components. tv_sec is the
191
- # number of seconds since the epoch, and tv_usec is only the microsecond
192
- # portion of time.
193
- def are_audited_values_equal(a, b)
194
- a == b || (a.is_a?(Time) && b.is_a?(Time) && a.tv_sec == b.tv_sec && a.tv_usec == b.tv_usec)
195
- end
196
- private :are_audited_values_equal
197
-
198
- # Populate an existing event with audit information.
199
- #
200
- # @param event [Puppet::Transaction::Event] The event to be populated.
201
- # @param property [Puppet::Property] The property being audited.
202
- # @param context [ResourceApplicationContext]
203
- #
204
- # @return [Puppet::Transaction::Event] The given event, populated with the audit information.
205
- def audit_event(event, property, context)
206
- event.audited = true
207
- event.status = "audit"
208
-
209
- # The event we've been provided might have been redacted so we need to use the state stored within
210
- # the resource application context to see if an event was actually generated.
211
- if !are_audited_values_equal(context.historical_values[property.name], context.current_values[property.name])
212
- event.message = property.format(_("audit change: previously recorded value %s has been changed to %s"),
213
- property.is_to_s(event.historical_value),
214
- property.is_to_s(event.previous_value))
215
- end
216
-
217
- event
218
- end
219
-
220
- def audit_message(param, do_audit, historical_value, current_value)
221
- if do_audit && historical_value && !are_audited_values_equal(historical_value, current_value)
222
- param.format(_(" (previously recorded value was %s)"), param.is_to_s(historical_value))
223
- else
224
- ""
225
- end
226
- end
227
-
228
- def noop(event, param, current_value, audit_message)
229
- event.message = param.format(_("current_value %s, should be %s (noop)"),
230
- param.is_to_s(current_value),
231
- param.should_to_s(param.should)) + audit_message.to_s
232
- event.status = "noop"
233
- end
234
-
235
- def sync(event, param, current_value, audit_message)
236
- param.sync
237
- if param.sensitive
238
- event.message = param.format(_("changed %s to %s"),
239
- param.is_to_s(current_value),
240
- param.should_to_s(param.should)) + audit_message.to_s
241
- else
242
- event.message = "#{param.change_to_s(current_value, param.should)}#{audit_message}"
243
- end
244
- event.status = "success"
245
- end
246
-
247
- def capture_audit_events(resource, context)
248
- context.audited_params.each do |param_name|
249
- if context.historical_values.include?(param_name)
250
- if !are_audited_values_equal(context.historical_values[param_name], context.current_values[param_name]) && !context.synced_params.include?(param_name)
251
- parameter = resource.parameter(param_name)
252
- event = audit_event(create_change_event(parameter,
253
- context.current_values[param_name],
254
- context.historical_values[param_name]),
255
- parameter, context)
256
- event.send_log
257
- context.record(event)
258
- end
259
- else
260
- property = resource.property(param_name)
261
- property.notice(property.format(_("audit change: newly-recorded value %s"), context.current_values[param_name]))
262
- end
263
- end
264
- end
265
-
266
- # Given an event and its property, calculate the system_value to persist
267
- # for future calculations.
268
- # @param [Puppet::Transaction::Event] event event to use for processing
269
- # @param [Puppet::Property] property correlating property
270
- # @param [Object] old_system_value system_value from last transaction
271
- # @return [Object] system_value to be used for next transaction
272
- def new_system_value(property, event, old_system_value)
273
- if event && event.status != "success"
274
- # For non-success events, we persist the old_system_value if it is defined,
275
- # or use the event previous_value.
276
- # If we're using the event previous_value, we ensure that it's
277
- # an array. This is needed because properties assume that their
278
- # `should` value is an array, and we will use this value later
279
- # on in property insync? logic.
280
- event_value = [event.previous_value] unless event.previous_value.is_a?(Array)
281
- old_system_value.nil? ? event_value : old_system_value
282
- else
283
- # For non events, or for success cases, we just want to store
284
- # the parameters agent value.
285
- # We use instance_variable_get here because we want this process to bypass any
286
- # munging/unmunging or validation that the property might try to do, since those
287
- # operations may not be correctly implemented for custom types.
288
- property.instance_variable_get(:@should)
289
- end
290
- end
291
-
292
- # @api private
293
- ResourceApplicationContext = Struct.new(:resource,
294
- :current_values,
295
- :historical_values,
296
- :audited_params,
297
- :synced_params,
298
- :status,
299
- :system_value_params) do
300
- def self.from_resource(resource, status)
301
- ResourceApplicationContext.new(resource,
302
- resource.retrieve_resource.to_hash,
303
- Puppet::Util::Storage.cache(resource).dup,
304
- (resource[:audit] || []).map { |p| p.to_sym },
305
- [],
306
- status,
307
- resource.parameters.select { |n,p| p.is_a?(Puppet::Property) && !p.sensitive })
308
- end
309
-
310
- def resource_present?
311
- resource.present?(current_values)
312
- end
313
-
314
- def record(event)
315
- status << event
316
- end
317
- end
318
- end
@@ -1,2673 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'puppet'
3
- require 'puppet/util/log'
4
- require 'puppet/util/metric'
5
- require 'puppet/property'
6
- require 'puppet/parameter'
7
- require 'puppet/util'
8
- require 'puppet/util/autoload'
9
- require 'puppet/metatype/manager'
10
- require 'puppet/util/errors'
11
- require 'puppet/util/logging'
12
- require 'puppet/util/tagging'
13
-
14
- # see the bottom of the file for the rest of the inclusions
15
-
16
-
17
- module Puppet
18
- # The base class for all Puppet types.
19
- #
20
- # A type describes:
21
- #--
22
- # * **Attributes** - properties, parameters, and meta-parameters are different types of attributes of a type.
23
- # * **Properties** - these are the properties of the managed resource (attributes of the entity being managed; like
24
- # a file's owner, group and mode). A property describes two states; the 'is' (current state) and the 'should' (wanted
25
- # state).
26
- # * **Ensurable** - a set of traits that control the lifecycle (create, remove, etc.) of a managed entity.
27
- # There is a default set of operations associated with being _ensurable_, but this can be changed.
28
- # * **Name/Identity** - one property is the name/identity of a resource, the _namevar_ that uniquely identifies
29
- # one instance of a type from all others.
30
- # * **Parameters** - additional attributes of the type (that does not directly related to an instance of the managed
31
- # resource; if an operation is recursive or not, where to look for things, etc.). A Parameter (in contrast to Property)
32
- # has one current value where a Property has two (current-state and wanted-state).
33
- # * **Meta-Parameters** - parameters that are available across all types. A meta-parameter typically has
34
- # additional semantics; like the `require` meta-parameter. A new type typically does not add new meta-parameters,
35
- # but you need to be aware of their existence so you do not inadvertently shadow an existing meta-parameters.
36
- # * **Parent** - a type can have a super type (that it inherits from).
37
- # * **Validation** - If not just a basic data type, or an enumeration of symbolic values, it is possible to provide
38
- # validation logic for a type, properties and parameters.
39
- # * **Munging** - munging/unmunging is the process of turning a value in external representation (as used
40
- # by a provider) into an internal representation and vice versa. A Type supports adding custom logic for these.
41
- # * **Auto Requirements** - a type can specify automatic relationships to resources to ensure that if they are being
42
- # managed, they will be processed before this type.
43
- # * **Providers** - a provider is an implementation of a type's behavior - the management of a resource in the
44
- # system being managed. A provider is often platform specific and is selected at runtime based on
45
- # criteria/predicates specified in the configured providers. See {Puppet::Provider} for details.
46
- # * **Device Support** - A type has some support for being applied to a device; i.e. something that is managed
47
- # by running logic external to the device itself. There are several methods that deals with type
48
- # applicability for these special cases such as {apply_to_device}.
49
- #
50
- # Additional Concepts:
51
- # --
52
- # * **Resource-type** - A _resource type_ is a term used to denote the type of a resource; internally a resource
53
- # is really an instance of a Ruby class i.e. {Puppet::Resource} which defines its behavior as "resource data".
54
- # Conceptually however, a resource is an instance of a subclass of Type (e.g. File), where such a class describes
55
- # its interface (what can be said/what is known about a resource of this type),
56
- # * **Managed Entity** - This is not a term in general use, but is used here when there is a need to make
57
- # a distinction between a resource (a description of what/how something should be managed), and what it is
58
- # managing (a file in the file system). The term _managed entity_ is a reference to the "file in the file system"
59
- # * **Isomorphism** - the quality of being _isomorphic_ means that two resource instances with the same name
60
- # refers to the same managed entity. Or put differently; _an isomorphic name is the identity of a resource_.
61
- # As an example, `exec` resources (that executes some command) have the command (i.e. the command line string) as
62
- # their name, and these resources are said to be non-isomorphic.
63
- #
64
- # @note The Type class deals with multiple concerns; some methods provide an internal DSL for convenient definition
65
- # of types, other methods deal with various aspects while running; wiring up a resource (expressed in Puppet DSL)
66
- # with its _resource type_ (i.e. an instance of Type) to enable validation, transformation of values
67
- # (munge/unmunge), etc. Lastly, Type is also responsible for dealing with Providers; the concrete implementations
68
- # of the behavior that constitutes how a particular Type behaves on a particular type of system (e.g. how
69
- # commands are executed on a flavor of Linux, on Windows, etc.). This means that as you are reading through the
70
- # documentation of this class, you will be switching between these concepts, as well as switching between
71
- # the conceptual level "a resource is an instance of a resource-type" and the actual implementation classes
72
- # (Type, Resource, Provider, and various utility and helper classes).
73
- #
74
- # @api public
75
- #
76
- #
77
- class Type
78
- extend Puppet::CompilableResourceType
79
- include Puppet::Util
80
- include Puppet::Util::Errors
81
- include Puppet::Util::Logging
82
- include Puppet::Util::Tagging
83
-
84
- # Comparing type instances.
85
- include Comparable
86
-
87
- # Compares this type against the given _other_ (type) and returns -1, 0, or +1 depending on the order.
88
- # @param other [Object] the object to compare against (produces nil, if not kind of Type}
89
- # @return [-1, 0, +1, nil] produces -1 if this type is before the given _other_ type, 0 if equals, and 1 if after.
90
- # Returns nil, if the given _other_ is not a kind of Type.
91
- # @see Comparable
92
- #
93
- def <=>(other)
94
- # Order is only maintained against other types, not arbitrary objects.
95
- # The natural order is based on the reference name used when comparing
96
- return nil unless other.is_a?(Puppet::CompilableResourceType) || other.class.is_a?(Puppet::CompilableResourceType)
97
- # against other type instances.
98
- self.ref <=> other.ref
99
- end
100
-
101
- # Code related to resource type attributes.
102
- class << self
103
- include Puppet::Util::ClassGen
104
- include Puppet::Util::Warnings
105
-
106
- # @return [Array<Puppet::Property>] The list of declared properties for the resource type.
107
- # The returned lists contains instances if Puppet::Property or its subclasses.
108
- attr_reader :properties
109
- end
110
-
111
- # Allow declaring that a type is actually a capability
112
- class << self
113
- attr_accessor :is_capability
114
-
115
- def is_capability?
116
- c = is_capability
117
- c.nil? ? false : c
118
- end
119
- end
120
-
121
- # Returns whether this type represents an application instance; since
122
- # only defined types, i.e., instances of Puppet::Resource::Type can
123
- # represent application instances, this implementation always returns
124
- # +false+. Having this method though makes code checking whether a
125
- # resource is an application instance simpler
126
- def self.application?
127
- false
128
- end
129
-
130
- # Returns all the attribute names of the type in the appropriate order.
131
- # The {key_attributes} come first, then the {provider}, then the {properties}, and finally
132
- # the {parameters} and {metaparams},
133
- # all in the order they were specified in the respective files.
134
- # @return [Array<String>] all type attribute names in a defined order.
135
- #
136
- def self.allattrs
137
- key_attributes | (parameters & [:provider]) | properties.collect { |property| property.name } | parameters | metaparams
138
- end
139
-
140
- # Returns the class associated with the given attribute name.
141
- # @param name [String] the name of the attribute to obtain the class for
142
- # @return [Class, nil] the class for the given attribute, or nil if the name does not refer to an existing attribute
143
- #
144
- def self.attrclass(name)
145
- @attrclasses ||= {}
146
-
147
- # We cache the value, since this method gets called such a huge number
148
- # of times (as in, hundreds of thousands in a given run).
149
- unless @attrclasses.include?(name)
150
- @attrclasses[name] = case self.attrtype(name)
151
- when :property; @validproperties[name]
152
- when :meta; @@metaparamhash[name]
153
- when :param; @paramhash[name]
154
- end
155
- end
156
- @attrclasses[name]
157
- end
158
-
159
- # Returns the attribute type (`:property`, `;param`, `:meta`).
160
- # @comment What type of parameter are we dealing with? Cache the results, because
161
- # this method gets called so many times.
162
- # @return [Symbol] a symbol describing the type of attribute (`:property`, `;param`, `:meta`)
163
- #
164
- def self.attrtype(attr)
165
- @attrtypes ||= {}
166
- unless @attrtypes.include?(attr)
167
- @attrtypes[attr] = case
168
- when @validproperties.include?(attr); :property
169
- when @paramhash.include?(attr); :param
170
- when @@metaparamhash.include?(attr); :meta
171
- end
172
- end
173
-
174
- @attrtypes[attr]
175
- end
176
-
177
- # Provides iteration over meta-parameters.
178
- # @yieldparam p [Puppet::Parameter] each meta parameter
179
- # @return [void]
180
- #
181
- def self.eachmetaparam
182
- @@metaparams.each { |p| yield p.name }
183
- end
184
-
185
- # Creates a new `ensure` property with configured default values or with configuration by an optional block.
186
- # This method is a convenience method for creating a property `ensure` with default accepted values.
187
- # If no block is specified, the new `ensure` property will accept the default symbolic
188
- # values `:present`, and `:absent` - see {Puppet::Property::Ensure}.
189
- # If something else is wanted, pass a block and make calls to {Puppet::Property.newvalue} from this block
190
- # to define each possible value. If a block is passed, the defaults are not automatically added to the set of
191
- # valid values.
192
- #
193
- # @note This method will be automatically called without a block if the type implements the methods
194
- # specified by {ensurable?}. It is recommended to always call this method and not rely on this automatic
195
- # specification to clearly state that the type is ensurable.
196
- #
197
- # @overload ensurable()
198
- # @overload ensurable({|| ... })
199
- # @yield [ ] A block evaluated in scope of the new Parameter
200
- # @yieldreturn [void]
201
- # @return [void]
202
- # @dsl type
203
- # @api public
204
- #
205
- def self.ensurable(&block)
206
- if block_given?
207
- self.newproperty(:ensure, :parent => Puppet::Property::Ensure, &block)
208
- else
209
- self.newproperty(:ensure, :parent => Puppet::Property::Ensure) do
210
- self.defaultvalues
211
- end
212
- end
213
- end
214
-
215
- # Returns true if the type implements the default behavior expected by being _ensurable_ "by default".
216
- # A type is _ensurable_ by default if it responds to `:exists`, `:create`, and `:destroy`.
217
- # If a type implements these methods and have not already specified that it is _ensurable_, it will be
218
- # made so with the defaults specified in {ensurable}.
219
- # @return [Boolean] whether the type is _ensurable_ or not.
220
- #
221
- def self.ensurable?
222
- # If the class has all three of these methods defined, then it's
223
- # ensurable.
224
- [:exists?, :create, :destroy].all? { |method|
225
- self.public_method_defined?(method)
226
- }
227
- end
228
-
229
- # @comment These `apply_to` methods are horrible. They should really be implemented
230
- # as part of the usual system of constraints that apply to a type and
231
- # provider pair, but were implemented as a separate shadow system.
232
- #
233
- # @comment We should rip them out in favour of a real constraint pattern around the
234
- # target device - whatever that looks like - and not have this additional
235
- # magic here. --daniel 2012-03-08
236
- #
237
- # Makes this type applicable to `:device`.
238
- # @return [Symbol] Returns `:device`
239
- # @api private
240
- #
241
- def self.apply_to_device
242
- @apply_to = :device
243
- end
244
-
245
- # Makes this type applicable to `:host`.
246
- # @return [Symbol] Returns `:host`
247
- # @api private
248
- #
249
- def self.apply_to_host
250
- @apply_to = :host
251
- end
252
-
253
- # Makes this type applicable to `:both` (i.e. `:host` and `:device`).
254
- # @return [Symbol] Returns `:both`
255
- # @api private
256
- #
257
- def self.apply_to_all
258
- @apply_to = :both
259
- end
260
-
261
- # Makes this type apply to `:host` if not already applied to something else.
262
- # @return [Symbol] a `:device`, `:host`, or `:both` enumeration
263
- # @api private
264
- def self.apply_to
265
- @apply_to ||= :host
266
- end
267
-
268
- # Returns true if this type is applicable to the given target.
269
- # @param target [Symbol] should be :device, :host or :target, if anything else, :host is enforced
270
- # @return [Boolean] true
271
- # @api private
272
- #
273
- def self.can_apply_to(target)
274
- [ target == :device ? :device : :host, :both ].include?(apply_to)
275
- end
276
-
277
- # Processes the options for a named parameter.
278
- # @param name [String] the name of a parameter
279
- # @param options [Hash] a hash of options
280
- # @option options [Boolean] :boolean if option set to true, an access method on the form _name_? is added for the param
281
- # @return [void]
282
- #
283
- def self.handle_param_options(name, options)
284
- # If it's a boolean parameter, create a method to test the value easily
285
- if options[:boolean]
286
- define_method(name.to_s + "?") do
287
- val = self[name]
288
- if val == :true or val == true
289
- return true
290
- end
291
- end
292
- end
293
- end
294
-
295
- # Is the given parameter a meta-parameter?
296
- # @return [Boolean] true if the given parameter is a meta-parameter.
297
- #
298
- def self.metaparam?(param)
299
- @@metaparamhash.include?(param.intern)
300
- end
301
-
302
- # Returns the meta-parameter class associated with the given meta-parameter name.
303
- # Accepts a `nil` name, and return nil.
304
- # @param name [String, nil] the name of a meta-parameter
305
- # @return [Class,nil] the class for the given meta-parameter, or `nil` if no such meta-parameter exists, (or if
306
- # the given meta-parameter name is `nil`.
307
- #
308
- def self.metaparamclass(name)
309
- return nil if name.nil?
310
- @@metaparamhash[name.intern]
311
- end
312
-
313
- # Returns all meta-parameter names.
314
- # @return [Array<String>] all meta-parameter names
315
- #
316
- def self.metaparams
317
- @@metaparams.collect { |param| param.name }
318
- end
319
-
320
- # Returns the documentation for a given meta-parameter of this type.
321
- # @param metaparam [Puppet::Parameter] the meta-parameter to get documentation for.
322
- # @return [String] the documentation associated with the given meta-parameter, or nil of no such documentation
323
- # exists.
324
- # @raise if the given metaparam is not a meta-parameter in this type
325
- #
326
- def self.metaparamdoc(metaparam)
327
- @@metaparamhash[metaparam].doc
328
- end
329
-
330
- # Creates a new meta-parameter.
331
- # This creates a new meta-parameter that is added to this and all inheriting types.
332
- # @param name [Symbol] the name of the parameter
333
- # @param options [Hash] a hash with options.
334
- # @option options [Class<inherits Puppet::Parameter>] :parent (Puppet::Parameter) the super class of this parameter
335
- # @option options [Hash{String => Object}] :attributes a hash that is applied to the generated class
336
- # by calling setter methods corresponding to this hash's keys/value pairs. This is done before the given
337
- # block is evaluated.
338
- # @option options [Boolean] :boolean (false) specifies if this is a boolean parameter
339
- # @option options [Boolean] :namevar (false) specifies if this parameter is the namevar
340
- # @option options [Symbol, Array<Symbol>] :required_features specifies required provider features by name
341
- # @return [Class<inherits Puppet::Parameter>] the created parameter
342
- # @yield [ ] a required block that is evaluated in the scope of the new meta-parameter
343
- # @api public
344
- # @dsl type
345
- # @todo Verify that this description is ok
346
- #
347
- def self.newmetaparam(name, options = {}, &block)
348
- @@metaparams ||= []
349
- @@metaparamhash ||= {}
350
- name = name.intern
351
-
352
- param = genclass(
353
- name,
354
- :parent => options[:parent] || Puppet::Parameter,
355
- :prefix => "MetaParam",
356
- :hash => @@metaparamhash,
357
- :array => @@metaparams,
358
- :attributes => options[:attributes],
359
- &block
360
- )
361
-
362
- # Grr.
363
- param.required_features = options[:required_features] if options[:required_features]
364
-
365
- handle_param_options(name, options)
366
-
367
- param.metaparam = true
368
-
369
- param
370
- end
371
-
372
- # Returns the list of parameters that comprise the composite key / "uniqueness key".
373
- # All parameters that return true from #isnamevar? or is named `:name` are included in the returned result.
374
- # @see uniqueness_key
375
- # @return [Array<Puppet::Parameter>] WARNING: this return type is uncertain
376
- def self.key_attribute_parameters
377
- @key_attribute_parameters ||= (
378
- @parameters.find_all { |param|
379
- param.isnamevar? or param.name == :name
380
- }
381
- )
382
- end
383
-
384
- # Returns cached {key_attribute_parameters} names.
385
- # Key attributes are properties and parameters that comprise a composite key
386
- # or "uniqueness key".
387
- # @return [Array<String>] cached key_attribute names
388
- #
389
- def self.key_attributes
390
- # This is a cache miss around 0.05 percent of the time. --daniel 2012-07-17
391
- @key_attributes_cache ||= key_attribute_parameters.collect { |p| p.name }
392
- end
393
-
394
- # Returns a mapping from the title string to setting of attribute values.
395
- # This default implementation provides a mapping of title to the one and only _namevar_ present
396
- # in the type's definition.
397
- # @note Advanced: some logic requires this mapping to be done differently, using a different
398
- # validation/pattern, breaking up the title
399
- # into several parts assigning each to an individual attribute, or even use a composite identity where
400
- # all namevars are seen as part of the unique identity (such computation is done by the {#uniqueness} method.
401
- # These advanced options are rarely used (only one of the built in puppet types use this, and then only
402
- # a small part of the available functionality), and the support for these advanced mappings is not
403
- # implemented in a straight forward way. For these reasons, this method has been marked as private).
404
- #
405
- # @raise [Puppet::DevError] if there is no title pattern and there are two or more key attributes
406
- # @return [Array<Array<Regexp, Array<Array <Symbol, Proc>>>>, nil] a structure with a regexp and the first key_attribute ???
407
- # @comment This wonderful piece of logic creates a structure used by Resource.parse_title which
408
- # has the capability to assign parts of the title to one or more attributes; It looks like an implementation
409
- # of a composite identity key (all parts of the key_attributes array are in the key). This can also
410
- # be seen in the method uniqueness_key.
411
- # The implementation in this method simply assigns the title to the one and only namevar (which is name
412
- # or a variable marked as namevar).
413
- # If there are multiple namevars (any in addition to :name?) then this method MUST be implemented
414
- # as it raises an exception if there is more than 1. Note that in puppet, it is only File that uses this
415
- # to create a different pattern for assigning to the :path attribute
416
- # This requires further digging.
417
- # The entire construct is somewhat strange, since resource checks if the method "title_patterns" is
418
- # implemented (it seems it always is) - why take this more expensive regexp mathching route for all
419
- # other types?
420
- # @api private
421
- #
422
- def self.title_patterns
423
- case key_attributes.length
424
- when 0; []
425
- when 1;
426
- [ [ /(.*)/m, [ [key_attributes.first] ] ] ]
427
- else
428
- raise Puppet::DevError, _("you must specify title patterns when there are two or more key attributes")
429
- end
430
- end
431
-
432
- # Produces a resource's _uniqueness_key_ (or composite key).
433
- # This key is an array of all key attributes' values. Each distinct tuple must be unique for each resource type.
434
- # @see key_attributes
435
- # @return [Object] an object that is a _uniqueness_key_ for this object
436
- #
437
- def uniqueness_key
438
- self.class.key_attributes.sort_by { |attribute_name| attribute_name.to_s }.map{ |attribute_name| self[attribute_name] }
439
- end
440
-
441
- # Creates a new parameter.
442
- # @param name [Symbol] the name of the parameter
443
- # @param options [Hash] a hash with options.
444
- # @option options [Class<inherits Puppet::Parameter>] :parent (Puppet::Parameter) the super class of this parameter
445
- # @option options [Hash{String => Object}] :attributes a hash that is applied to the generated class
446
- # by calling setter methods corresponding to this hash's keys/value pairs. This is done before the given
447
- # block is evaluated.
448
- # @option options [Boolean] :boolean (false) specifies if this is a boolean parameter
449
- # @option options [Boolean] :namevar (false) specifies if this parameter is the namevar
450
- # @option options [Symbol, Array<Symbol>] :required_features specifies required provider features by name
451
- # @return [Class<inherits Puppet::Parameter>] the created parameter
452
- # @yield [ ] a required block that is evaluated in the scope of the new parameter
453
- # @api public
454
- # @dsl type
455
- #
456
- def self.newparam(name, options = {}, &block)
457
- options[:attributes] ||= {}
458
-
459
- param = genclass(
460
- name,
461
- :parent => options[:parent] || Puppet::Parameter,
462
- :attributes => options[:attributes],
463
- :block => block,
464
- :prefix => "Parameter",
465
- :array => @parameters,
466
- :hash => @paramhash
467
- )
468
-
469
- handle_param_options(name, options)
470
-
471
- # Grr.
472
- param.required_features = options[:required_features] if options[:required_features]
473
-
474
- param.isnamevar if options[:namevar]
475
-
476
- param
477
- end
478
-
479
- # Creates a new property.
480
- # @param name [Symbol] the name of the property
481
- # @param options [Hash] a hash with options.
482
- # @option options [Symbol] :array_matching (:first) specifies how the current state is matched against
483
- # the wanted state. Use `:first` if the property is single valued, and (`:all`) otherwise.
484
- # @option options [Class<inherits Puppet::Property>] :parent (Puppet::Property) the super class of this property
485
- # @option options [Hash{String => Object}] :attributes a hash that is applied to the generated class
486
- # by calling setter methods corresponding to this hash's keys/value pairs. This is done before the given
487
- # block is evaluated.
488
- # @option options [Boolean] :boolean (false) specifies if this is a boolean parameter
489
- # @option options [Symbol] :retrieve the method to call on the provider (or `parent` if `provider` is not set)
490
- # to retrieve the current value of this property.
491
- # @option options [Symbol, Array<Symbol>] :required_features specifies required provider features by name
492
- # @return [Class<inherits Puppet::Property>] the created property
493
- # @yield [ ] a required block that is evaluated in the scope of the new property
494
- # @api public
495
- # @dsl type
496
- #
497
- def self.newproperty(name, options = {}, &block)
498
- name = name.intern
499
-
500
- # This is here for types that might still have the old method of defining
501
- # a parent class.
502
- unless options.is_a? Hash
503
- raise Puppet::DevError, _("Options must be a hash, not %{type}") % { type: options.inspect }
504
- end
505
-
506
- raise Puppet::DevError, _("Class %{class_name} already has a property named %{property}") % { class_name: self.name, property: name } if @validproperties.include?(name)
507
-
508
- if parent = options[:parent]
509
- options.delete(:parent)
510
- else
511
- parent = Puppet::Property
512
- end
513
-
514
- # We have to create our own, new block here because we want to define
515
- # an initial :retrieve method, if told to, and then eval the passed
516
- # block if available.
517
- prop = genclass(name, :parent => parent, :hash => @validproperties, :attributes => options) do
518
- # If they've passed a retrieve method, then override the retrieve
519
- # method on the class.
520
- if options[:retrieve]
521
- define_method(:retrieve) do
522
- provider.send(options[:retrieve])
523
- end
524
- end
525
-
526
- class_eval(&block) if block
527
- end
528
-
529
- # If it's the 'ensure' property, always put it first.
530
- if name == :ensure
531
- @properties.unshift prop
532
- else
533
- @properties << prop
534
- end
535
-
536
- prop
537
- end
538
-
539
- def self.paramdoc(param)
540
- @paramhash[param].doc
541
- end
542
-
543
- # @return [Array<String>] Returns the parameter names
544
- def self.parameters
545
- return [] unless defined?(@parameters)
546
- @parameters.collect { |klass| klass.name }
547
- end
548
-
549
- # @return [Puppet::Parameter] Returns the parameter class associated with the given parameter name.
550
- def self.paramclass(name)
551
- @paramhash[name]
552
- end
553
-
554
- # @return [Puppet::Property] Returns the property class ??? associated with the given property name
555
- def self.propertybyname(name)
556
- @validproperties[name]
557
- end
558
-
559
- # Returns whether or not the given name is the name of a property, parameter or meta-parameter
560
- # @return [Boolean] true if the given attribute name is the name of an existing property, parameter or meta-parameter
561
- #
562
- def self.validattr?(name)
563
- name = name.intern
564
- return true if name == :name
565
- @validattrs ||= {}
566
-
567
- unless @validattrs.include?(name)
568
- @validattrs[name] = !!(self.validproperty?(name) or self.validparameter?(name) or self.metaparam?(name))
569
- end
570
-
571
- @validattrs[name]
572
- end
573
-
574
- # @return [Boolean] Returns true if the given name is the name of an existing property
575
- def self.validproperty?(name)
576
- name = name.intern
577
- @validproperties.include?(name) && @validproperties[name]
578
- end
579
-
580
- # @return [Array<Symbol>, {}] Returns a list of valid property names, or an empty hash if there are none.
581
- # @todo An empty hash is returned if there are no defined parameters (not an empty array). This looks like
582
- # a bug.
583
- #
584
- def self.validproperties
585
- return {} unless defined?(@parameters)
586
-
587
- @validproperties.keys
588
- end
589
-
590
- # @return [Boolean] Returns true if the given name is the name of an existing parameter
591
- def self.validparameter?(name)
592
- raise Puppet::DevError, _("Class %{class_name} has not defined parameters") % { class_name: self } unless defined?(@parameters)
593
- !!(@paramhash.include?(name) or @@metaparamhash.include?(name))
594
- end
595
-
596
- # (see validattr?)
597
- # @note see comment in code - how should this be documented? Are some of the other query methods deprecated?
598
- # (or should be).
599
- # @comment This is a forward-compatibility method - it's the validity interface we'll use in Puppet::Resource.
600
- def self.valid_parameter?(name)
601
- validattr?(name)
602
- end
603
-
604
- # @return [Boolean] Returns true if the wanted state of the resource is that it should be absent (i.e. to be deleted).
605
- def deleting?
606
- obj = @parameters[:ensure] and obj.should == :absent
607
- end
608
-
609
- # Creates a new property value holder for the resource if it is valid and does not already exist
610
- # @return [Boolean] true if a new parameter was added, false otherwise
611
- def add_property_parameter(prop_name)
612
- if self.class.validproperty?(prop_name) && !@parameters[prop_name]
613
- self.newattr(prop_name)
614
- return true
615
- end
616
- false
617
- end
618
-
619
- # @return [Symbol, Boolean] Returns the name of the namevar if there is only one or false otherwise.
620
- # @comment This is really convoluted and part of the support for multiple namevars (?).
621
- # If there is only one namevar, the produced value is naturally this namevar, but if there are several?
622
- # The logic caches the name of the namevar if it is a single name, but otherwise always
623
- # calls key_attributes, and then caches the first if there was only one, otherwise it returns
624
- # false and caches this (which is then subsequently returned as a cache hit).
625
- #
626
- def name_var
627
- return @name_var_cache unless @name_var_cache.nil?
628
- key_attributes = self.class.key_attributes
629
- @name_var_cache = (key_attributes.length == 1) && key_attributes.first
630
- end
631
-
632
- # Gets the 'should' (wanted state) value of a parameter or property by name.
633
- # To explicitly get the 'is' (current state) value use `o.is(:name)`, and to explicitly get the 'should' value
634
- # use `o.should(:name)`
635
- # @param name [String] the name of the attribute to obtain the 'should' value for.
636
- # @return [Object] 'should'/wanted value of the given attribute
637
- def [](name)
638
- name = name.intern
639
- fail("Invalid parameter #{name}(#{name.inspect})") unless self.class.validattr?(name)
640
-
641
- if name == :name && nv = name_var
642
- name = nv
643
- end
644
-
645
- if obj = @parameters[name]
646
- # Note that if this is a property, then the value is the "should" value,
647
- # not the current value.
648
- obj.value
649
- else
650
- return nil
651
- end
652
- end
653
-
654
- # Sets the 'should' (wanted state) value of a property, or the value of a parameter.
655
- # @return
656
- # @raise [Puppet::Error] if the setting of the value fails, or if the given name is nil.
657
- # @raise [Puppet::ResourceError] when the parameter validation raises Puppet::Error or
658
- # ArgumentError
659
- def []=(name,value)
660
- name = name.intern
661
-
662
- fail("no parameter named '#{name}'") unless self.class.validattr?(name)
663
-
664
- if name == :name && nv = name_var
665
- name = nv
666
- end
667
- raise Puppet::Error.new("Got nil value for #{name}") if value.nil?
668
-
669
- property = self.newattr(name)
670
-
671
- if property
672
- begin
673
- # make sure the parameter doesn't have any errors
674
- property.value = value
675
- rescue Puppet::Error, ArgumentError => detail
676
- error = Puppet::ResourceError.new(_("Parameter %{name} failed on %{ref}: %{detail}") %
677
- { name: name, ref: ref, detail: detail })
678
- adderrorcontext(error, detail)
679
- raise error
680
- end
681
- end
682
-
683
- nil
684
- end
685
-
686
- # Removes an attribute from the object; useful in testing or in cleanup
687
- # when an error has been encountered
688
- # @todo Don't know what the attr is (name or Property/Parameter?). Guessing it is a String name...
689
- # @todo Is it possible to delete a meta-parameter?
690
- # @todo What does delete mean? Is it deleted from the type or is its value state 'is'/'should' deleted?
691
- # @param attr [String] the attribute to delete from this object. WHAT IS THE TYPE?
692
- # @raise [Puppet::DecError] when an attempt is made to delete an attribute that does not exists.
693
- #
694
- def delete(attr)
695
- attr = attr.intern
696
- if @parameters.has_key?(attr)
697
- @parameters.delete(attr)
698
- else
699
- raise Puppet::DevError.new(_("Undefined attribute '%{attribute}' in %{name}") % { attribute: attr, name: self})
700
- end
701
- end
702
-
703
- # Iterates over the properties that were set on this resource.
704
- # @yieldparam property [Puppet::Property] each property
705
- # @return [void]
706
- def eachproperty
707
- # properties is a private method
708
- properties.each { |property|
709
- yield property
710
- }
711
- end
712
-
713
- # Return the parameters, metaparams, and properties that have a value or were set by a default. Properties are
714
- # included since they are a subclass of parameter.
715
- # @return [Array<Puppet::Parameter>] Array of parameter objects ( or subclass thereof )
716
- def parameters_with_value
717
- self.class.allattrs.collect { |attr| parameter(attr) }.compact
718
- end
719
-
720
- # Iterates over all parameters with value currently set.
721
- # @yieldparam parameter [Puppet::Parameter] or a subclass thereof
722
- # @return [void]
723
- def eachparameter
724
- parameters_with_value.each { |parameter| yield parameter }
725
- end
726
-
727
- # Creates a transaction event.
728
- # Called by Transaction or by a property.
729
- # Merges the given options with the options `:resource`, `:file`, `:line`, and `:tags`, initialized from
730
- # values in this object. For possible options to pass (if any ????) see {Puppet::Transaction::Event}.
731
- # @todo Needs a better explanation "Why should I care who is calling this method?", What do I need to know
732
- # about events and how they work? Where can I read about them?
733
- # @param options [Hash] options merged with a fixed set of options defined by this method, passed on to {Puppet::Transaction::Event}.
734
- # @return [Puppet::Transaction::Event] the created event
735
- def event(options = {})
736
- Puppet::Transaction::Event.new({:resource => self, :file => file, :line => line, :tags => tags}.merge(options))
737
- end
738
-
739
- # @return [Object, nil] Returns the 'should' (wanted state) value for a specified property, or nil if the
740
- # given attribute name is not a property (i.e. if it is a parameter, meta-parameter, or does not exist).
741
- def should(name)
742
- name = name.intern
743
- (prop = @parameters[name] and prop.is_a?(Puppet::Property)) ? prop.should : nil
744
- end
745
-
746
- # Registers an attribute to this resource type instance.
747
- # Requires either the attribute name or class as its argument.
748
- # This is a noop if the named property/parameter is not supported
749
- # by this resource. Otherwise, an attribute instance is created
750
- # and kept in this resource's parameters hash.
751
- # @overload newattr(name)
752
- # @param name [Symbol] symbolic name of the attribute
753
- # @overload newattr(klass)
754
- # @param klass [Class] a class supported as an attribute class, i.e. a subclass of
755
- # Parameter or Property
756
- # @return [Object] An instance of the named Parameter or Property class associated
757
- # to this resource type instance, or nil if the attribute is not supported
758
- #
759
- def newattr(name)
760
- if name.is_a?(Class)
761
- klass = name
762
- name = klass.name
763
- end
764
-
765
- unless klass = self.class.attrclass(name)
766
- raise Puppet::Error, "Resource type #{self.class.name} does not support parameter #{name}"
767
- end
768
-
769
- if provider and ! provider.class.supports_parameter?(klass)
770
- missing = klass.required_features.find_all { |f| ! provider.class.feature?(f) }
771
- debug "Provider %s does not support features %s; not managing attribute %s" % [provider.class.name, missing.join(", "), name]
772
- return nil
773
- end
774
-
775
- return @parameters[name] if @parameters.include?(name)
776
-
777
- @parameters[name] = klass.new(:resource => self)
778
- end
779
-
780
- # Returns a string representation of the resource's containment path in
781
- # the catalog.
782
- # @return [String]
783
- def path
784
- @path ||= '/' + pathbuilder.join('/')
785
- end
786
-
787
- # Returns the value of this object's parameter given by name
788
- # @param name [String] the name of the parameter
789
- # @return [Object] the value
790
- def parameter(name)
791
- @parameters[name.to_sym]
792
- end
793
-
794
- # Returns a shallow copy of this object's hash of attributes by name.
795
- # Note that his not only comprises parameters, but also properties and metaparameters.
796
- # Changes to the contained parameters will have an effect on the parameters of this type, but changes to
797
- # the returned hash does not.
798
- # @return [Hash{String => Object}] a new hash being a shallow copy of the parameters map name to parameter
799
- def parameters
800
- @parameters.dup
801
- end
802
-
803
- # @return [Boolean] Returns whether the attribute given by name has been added
804
- # to this resource or not.
805
- def propertydefined?(name)
806
- name = name.intern unless name.is_a? Symbol
807
- @parameters.include?(name)
808
- end
809
-
810
- # Returns a {Puppet::Property} instance by name.
811
- # To return the value, use 'resource[param]'
812
- # @todo LAK:NOTE(20081028) Since the 'parameter' method is now a superset of this method,
813
- # this one should probably go away at some point. - Does this mean it should be deprecated ?
814
- # @return [Puppet::Property] the property with the given name, or nil if not a property or does not exist.
815
- def property(name)
816
- (obj = @parameters[name.intern] and obj.is_a?(Puppet::Property)) ? obj : nil
817
- end
818
-
819
- # @todo comment says "For any parameters or properties that have defaults and have not yet been
820
- # set, set them now. This method can be handed a list of attributes,
821
- # and if so it will only set defaults for those attributes."
822
- # @todo Needs a better explanation, and investigation about the claim an array can be passed (it is passed
823
- # to self.class.attrclass to produce a class on which a check is made if it has a method class :default (does
824
- # not seem to support an array...
825
- # @return [void]
826
- #
827
- def set_default(attr)
828
- return unless klass = self.class.attrclass(attr)
829
- # TODO this is not a necessary check, as we define a class level attr_reader
830
- return unless klass.method_defined?(:default)
831
- return if @parameters.include?(klass.name)
832
-
833
- return unless parameter = newattr(klass.name)
834
-
835
- if value = parameter.default and ! value.nil?
836
- parameter.value = value
837
- else
838
- @parameters.delete(parameter.name)
839
- end
840
- end
841
-
842
- # @todo the comment says: "Convert our object to a hash. This just includes properties."
843
- # @todo this is confused, again it is the @parameters instance variable that is consulted, and
844
- # each value is copied - does it contain "properties" and "parameters" or both? Does it contain
845
- # meta-parameters?
846
- #
847
- # @return [Hash{ ??? => ??? }] a hash of WHAT?. The hash is a shallow copy, any changes to the
848
- # objects returned in this hash will be reflected in the original resource having these attributes.
849
- #
850
- def to_hash
851
- rethash = {}
852
-
853
- @parameters.each do |name, obj|
854
- rethash[name] = obj.value
855
- end
856
-
857
- rethash
858
- end
859
-
860
- # @return [String] the name of this object's class
861
- # @todo Would that be "file" for the "File" resource type? of "File" or something else?
862
- #
863
- def type
864
- self.class.name
865
- end
866
-
867
- # @todo Comment says "Return a specific value for an attribute.", as opposed to what "An unspecific value"???
868
- # @todo is this the 'is' or the 'should' value?
869
- # @todo why is the return restricted to things that respond to :value? (Only non structural basic data types
870
- # supported?
871
- #
872
- # @return [Object, nil] the value of the attribute having the given name, or nil if the given name is not
873
- # an attribute, or the referenced attribute does not respond to `:value`.
874
- def value(name)
875
- name = name.intern
876
-
877
- (obj = @parameters[name] and obj.respond_to?(:value)) ? obj.value : nil
878
- end
879
-
880
- # @todo What is this used for? Needs a better explanation.
881
- # @return [???] the version of the catalog or 0 if there is no catalog.
882
- def version
883
- return 0 unless catalog
884
- catalog.version
885
- end
886
-
887
- # @return [Array<Puppet::Property>] Returns all of the property objects, in the order specified in the
888
- # class.
889
- # @todo "what does the 'order specified in the class' mean? The order the properties where added in the
890
- # ruby file adding a new type with new properties?
891
- #
892
- def properties
893
- self.class.properties.collect { |prop| @parameters[prop.name] }.compact
894
- end
895
-
896
- # Returns true if the type's notion of name is the identity of a resource.
897
- # See the overview of this class for a longer explanation of the concept _isomorphism_.
898
- # Defaults to true.
899
- #
900
- # @return [Boolean] true, if this type's name is isomorphic with the object
901
- def self.isomorphic?
902
- if defined?(@isomorphic)
903
- return @isomorphic
904
- else
905
- return true
906
- end
907
- end
908
-
909
- # @todo check that this gets documentation (it is at the class level as well as instance).
910
- # (see isomorphic?)
911
- def isomorphic?
912
- self.class.isomorphic?
913
- end
914
-
915
- # Returns true if the instance is a managed instance.
916
- # A 'yes' here means that the instance was created from the language, vs. being created
917
- # in order resolve other questions, such as finding a package in a list.
918
- # @note An object that is managed always stays managed, but an object that is not managed
919
- # may become managed later in its lifecycle.
920
- # @return [Boolean] true if the object is managed
921
- def managed?
922
- # Once an object is managed, it always stays managed; but an object
923
- # that is listed as unmanaged might become managed later in the process,
924
- # so we have to check that every time
925
- if @managed
926
- return @managed
927
- else
928
- @managed = false
929
- properties.each { |property|
930
- s = property.should
931
- if s and ! property.class.unmanaged
932
- @managed = true
933
- break
934
- end
935
- }
936
- return @managed
937
- end
938
- end
939
-
940
- ###############################
941
- # Code related to the container behaviour.
942
-
943
- # Returns true if the search should be done in depth-first order.
944
- # This implementation always returns false.
945
- # @todo What is this used for?
946
- #
947
- # @return [Boolean] true if the search should be done in depth first order.
948
- #
949
- def depthfirst?
950
- false
951
- end
952
-
953
- # Removes this object (FROM WHERE?)
954
- # @todo removes if from where?
955
- # @return [void]
956
- def remove()
957
- # This is hackish (mmm, cut and paste), but it works for now, and it's
958
- # better than warnings.
959
- @parameters.each do |name, obj|
960
- obj.remove
961
- end
962
- @parameters.clear
963
-
964
- @parent = nil
965
-
966
- # Remove the reference to the provider.
967
- if self.provider
968
- @provider.clear
969
- @provider = nil
970
- end
971
- end
972
-
973
- ###############################
974
- # Code related to evaluating the resources.
975
-
976
- # Returns the ancestors - WHAT?
977
- # This implementation always returns an empty list.
978
- # @todo WHAT IS THIS ?
979
- # @return [Array<???>] returns a list of ancestors.
980
- def ancestors
981
- []
982
- end
983
-
984
- # Lifecycle method for a resource. This is called during graph creation.
985
- # It should perform any consistency checking of the catalog and raise a
986
- # Puppet::Error if the transaction should be aborted.
987
- #
988
- # It differs from the validate method, since it is called later during
989
- # initialization and can rely on self.catalog to have references to all
990
- # resources that comprise the catalog.
991
- #
992
- # @see Puppet::Transaction#add_vertex
993
- # @raise [Puppet::Error] If the pre-run check failed.
994
- # @return [void]
995
- # @abstract a resource type may implement this method to perform
996
- # validation checks that can query the complete catalog
997
- def pre_run_check
998
- end
999
-
1000
- # Flushes the provider if supported by the provider, else no action.
1001
- # This is called by the transaction.
1002
- # @todo What does Flushing the provider mean? Why is it interesting to know that this is
1003
- # called by the transaction? (It is not explained anywhere what a transaction is).
1004
- #
1005
- # @return [???, nil] WHAT DOES IT RETURN? GUESS IS VOID
1006
- def flush
1007
- self.provider.flush if self.provider and self.provider.respond_to?(:flush)
1008
- end
1009
-
1010
- # Returns true if all contained objects are in sync.
1011
- # @todo "contained in what?" in the given "in" parameter?
1012
- #
1013
- # @todo deal with the comment _"FIXME I don't think this is used on the type instances any more,
1014
- # it's really only used for testing"_
1015
- # @return [Boolean] true if in sync, false otherwise.
1016
- #
1017
- def insync?(is)
1018
- insync = true
1019
-
1020
- if property = @parameters[:ensure]
1021
- unless is.include? property
1022
- #TRANSLATORS 'is' is a variable name and should not be translated
1023
- raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: property.name }
1024
- end
1025
- ensureis = is[property]
1026
- if property.safe_insync?(ensureis) and property.should == :absent
1027
- return true
1028
- end
1029
- end
1030
-
1031
- properties.each { |prop|
1032
- unless is.include? prop
1033
- #TRANSLATORS 'is' is a variable name and should not be translated
1034
- raise Puppet::DevError, _("The 'is' value is not in the 'is' array for '%{name}'") % { name: prop.name }
1035
- end
1036
-
1037
- propis = is[prop]
1038
- unless prop.safe_insync?(propis)
1039
- prop.debug("Not in sync: #{propis.inspect} vs #{prop.should.inspect}")
1040
- insync = false
1041
- #else
1042
- # property.debug("In sync")
1043
- end
1044
- }
1045
-
1046
- #self.debug("#{self} sync status is #{insync}")
1047
- insync
1048
- end
1049
-
1050
- # Says if the ensure property should be retrieved if the resource is ensurable
1051
- # Defaults to true. Some resource type classes can override it
1052
- def self.needs_ensure_retrieved
1053
- true
1054
- end
1055
-
1056
- # Retrieves the current value of all contained properties.
1057
- # Parameters and meta-parameters are not included in the result.
1058
- # @todo As opposed to all non contained properties? How is this different than any of the other
1059
- # methods that also "gets" properties/parameters/etc. ?
1060
- # @return [Puppet::Resource] array of all property values (mix of types)
1061
- # @raise [fail???] if there is a provider and it is not suitable for the host this is evaluated for.
1062
- def retrieve
1063
- fail "Provider #{provider.class.name} is not functional on this host" if self.provider.is_a?(Puppet::Provider) and ! provider.class.suitable?
1064
-
1065
- result = Puppet::Resource.new(self.class, title)
1066
-
1067
- # Provide the name, so we know we'll always refer to a real thing
1068
- result[:name] = self[:name] unless self[:name] == title
1069
-
1070
- if ensure_prop = property(:ensure) or (self.class.needs_ensure_retrieved and self.class.validattr?(:ensure) and ensure_prop = newattr(:ensure))
1071
- result[:ensure] = ensure_state = ensure_prop.retrieve
1072
- else
1073
- ensure_state = nil
1074
- end
1075
-
1076
- properties.each do |property|
1077
- next if property.name == :ensure
1078
- if ensure_state == :absent
1079
- result[property] = :absent
1080
- else
1081
- result[property] = property.retrieve
1082
- end
1083
- end
1084
-
1085
- result
1086
- end
1087
-
1088
- # Retrieve the current state of the system as a Puppet::Resource. For
1089
- # the base Puppet::Type this does the same thing as #retrieve, but
1090
- # specific types are free to implement #retrieve as returning a hash,
1091
- # and this will call #retrieve and convert the hash to a resource.
1092
- # This is used when determining when syncing a resource.
1093
- #
1094
- # @return [Puppet::Resource] A resource representing the current state
1095
- # of the system.
1096
- #
1097
- # @api private
1098
- def retrieve_resource
1099
- resource = retrieve
1100
- resource = Resource.new(self.class, title, :parameters => resource) if resource.is_a? Hash
1101
- resource
1102
- end
1103
-
1104
- # Given the hash of current properties, should this resource be treated as if it
1105
- # currently exists on the system. May need to be overridden by types that offer up
1106
- # more than just :absent and :present.
1107
- def present?(current_values)
1108
- current_values[:ensure] != :absent
1109
- end
1110
-
1111
- # Returns a hash of the current properties and their values.
1112
- # If a resource is absent, its value is the symbol `:absent`
1113
- # @return [Hash{Puppet::Property => Object}] mapping of property instance to its value
1114
- #
1115
- def currentpropvalues
1116
- # It's important to use the 'properties' method here, as it follows the order
1117
- # in which they're defined in the class. It also guarantees that 'ensure'
1118
- # is the first property, which is important for skipping 'retrieve' on
1119
- # all the properties if the resource is absent.
1120
- ensure_state = false
1121
- return properties.inject({}) do | prophash, property|
1122
- if property.name == :ensure
1123
- ensure_state = property.retrieve
1124
- prophash[property] = ensure_state
1125
- else
1126
- if ensure_state == :absent
1127
- prophash[property] = :absent
1128
- else
1129
- prophash[property] = property.retrieve
1130
- end
1131
- end
1132
- prophash
1133
- end
1134
- end
1135
-
1136
- # Returns the `noop` run mode status of this.
1137
- # @return [Boolean] true if running in noop mode.
1138
- def noop?
1139
- # If we're not a host_config, we're almost certainly part of
1140
- # Settings, and we want to ignore 'noop'
1141
- return false if catalog and ! catalog.host_config?
1142
-
1143
- if defined?(@noop)
1144
- @noop
1145
- else
1146
- Puppet[:noop]
1147
- end
1148
- end
1149
-
1150
- # (see #noop?)
1151
- def noop
1152
- noop?
1153
- end
1154
-
1155
- # Retrieves all known instances.
1156
- # @todo Retrieves them from where? Known to whom?
1157
- # Either requires providers or must be overridden.
1158
- # @raise [Puppet::DevError] when there are no providers and the implementation has not overridden this method.
1159
- def self.instances
1160
- raise Puppet::DevError, _("%{name} has no providers and has not overridden 'instances'") % { name: self.name } if provider_hash.empty?
1161
-
1162
- # Put the default provider first, then the rest of the suitable providers.
1163
- provider_instances = {}
1164
- providers_by_source.collect do |provider|
1165
- provider.instances.collect do |instance|
1166
- # We always want to use the "first" provider instance we find, unless the resource
1167
- # is already managed and has a different provider set
1168
- if other = provider_instances[instance.name]
1169
- Puppet.debug "%s %s found in both %s and %s; skipping the %s version" %
1170
- [self.name.to_s.capitalize, instance.name, other.class.name, instance.class.name, instance.class.name]
1171
- next
1172
- end
1173
- provider_instances[instance.name] = instance
1174
-
1175
- result = new(:name => instance.name, :provider => instance)
1176
- properties.each { |name| result.newattr(name) }
1177
- result
1178
- end
1179
- end.flatten.compact
1180
- end
1181
-
1182
- # Returns a list of one suitable provider per source, with the default provider first.
1183
- # @todo Needs better explanation; what does "source" mean in this context?
1184
- # @return [Array<Puppet::Provider>] list of providers
1185
- #
1186
- def self.providers_by_source
1187
- # Put the default provider first (can be nil), then the rest of the suitable providers.
1188
- sources = []
1189
- [defaultprovider, suitableprovider].flatten.uniq.collect do |provider|
1190
- next if provider.nil?
1191
- next if sources.include?(provider.source)
1192
-
1193
- sources << provider.source
1194
- provider
1195
- end.compact
1196
- end
1197
-
1198
- # Converts a simple hash into a Resource instance.
1199
- # @todo as opposed to a complex hash? Other raised exceptions?
1200
- # @param [Hash{Symbol, String => Object}] hash resource attribute to value map to initialize the created resource from
1201
- # @return [Puppet::Resource] the resource created from the hash
1202
- # @raise [Puppet::Error] if a title is missing in the given hash
1203
- def self.hash2resource(hash)
1204
- hash = hash.inject({}) { |result, ary| result[ary[0].to_sym] = ary[1]; result }
1205
-
1206
- title = hash.delete(:title)
1207
- title ||= hash[:name]
1208
- title ||= hash[key_attributes.first] if key_attributes.length == 1
1209
-
1210
- raise Puppet::Error, "Title or name must be provided" unless title
1211
-
1212
- # Now create our resource.
1213
- resource = Puppet::Resource.new(self, title)
1214
- resource.catalog = hash.delete(:catalog)
1215
-
1216
- if sensitive = hash.delete(:sensitive_parameters)
1217
- resource.sensitive_parameters = sensitive
1218
- end
1219
-
1220
- hash.each do |param, value|
1221
- resource[param] = value
1222
- end
1223
- resource
1224
- end
1225
-
1226
-
1227
- # Returns an array of strings representing the containment hierarchy
1228
- # (types/classes) that make up the path to the resource from the root
1229
- # of the catalog. This is mostly used for logging purposes.
1230
- #
1231
- # @api private
1232
- def pathbuilder
1233
- if p = parent
1234
- [p.pathbuilder, self.ref].flatten
1235
- else
1236
- [self.ref]
1237
- end
1238
- end
1239
-
1240
- ###############################
1241
- # Add all of the meta-parameters.
1242
- newmetaparam(:noop) do
1243
- desc "Whether to apply this resource in noop mode.
1244
-
1245
- When applying a resource in noop mode, Puppet will check whether it is in sync,
1246
- like it does when running normally. However, if a resource attribute is not in
1247
- the desired state (as declared in the catalog), Puppet will take no
1248
- action, and will instead report the changes it _would_ have made. These
1249
- simulated changes will appear in the report sent to the puppet master, or
1250
- be shown on the console if running puppet agent or puppet apply in the
1251
- foreground. The simulated changes will not send refresh events to any
1252
- subscribing or notified resources, although Puppet will log that a refresh
1253
- event _would_ have been sent.
1254
-
1255
- **Important note:**
1256
- [The `noop` setting](https://puppet.com/docs/puppet/latest/configuration.html#noop)
1257
- allows you to globally enable or disable noop mode, but it will _not_ override
1258
- the `noop` metaparameter on individual resources. That is, the value of the
1259
- global `noop` setting will _only_ affect resources that do not have an explicit
1260
- value set for their `noop` attribute."
1261
-
1262
- newvalues(:true, :false)
1263
- munge do |value|
1264
- case value
1265
- when true, :true, "true"; @resource.noop = true
1266
- when false, :false, "false"; @resource.noop = false
1267
- end
1268
- end
1269
- end
1270
-
1271
- newmetaparam(:schedule) do
1272
- desc "A schedule to govern when Puppet is allowed to manage this resource.
1273
- The value of this metaparameter must be the `name` of a `schedule`
1274
- resource. This means you must declare a schedule resource, then
1275
- refer to it by name; see
1276
- [the docs for the `schedule` type](https://puppet.com/docs/puppet/latest/type.html#schedule)
1277
- for more info.
1278
-
1279
- schedule { 'everyday':
1280
- period => daily,
1281
- range => \"2-4\"
1282
- }
1283
-
1284
- exec { \"/usr/bin/apt-get update\":
1285
- schedule => 'everyday'
1286
- }
1287
-
1288
- Note that you can declare the schedule resource anywhere in your
1289
- manifests, as long as it ends up in the final compiled catalog."
1290
- end
1291
-
1292
- newmetaparam(:audit) do
1293
- desc "Marks a subset of this resource's unmanaged attributes for auditing. Accepts an
1294
- attribute name, an array of attribute names, or `all`.
1295
-
1296
- Auditing a resource attribute has two effects: First, whenever a catalog
1297
- is applied with puppet apply or puppet agent, Puppet will check whether
1298
- that attribute of the resource has been modified, comparing its current
1299
- value to the previous run; any change will be logged alongside any actions
1300
- performed by Puppet while applying the catalog.
1301
-
1302
- Secondly, marking a resource attribute for auditing will include that
1303
- attribute in inspection reports generated by puppet inspect; see the
1304
- puppet inspect documentation for more details.
1305
-
1306
- Managed attributes for a resource can also be audited, but note that
1307
- changes made by Puppet will be logged as additional modifications. (I.e.
1308
- if a user manually edits a file whose contents are audited and managed,
1309
- puppet agent's next two runs will both log an audit notice: the first run
1310
- will log the user's edit and then revert the file to the desired state,
1311
- and the second run will log the edit made by Puppet.)"
1312
-
1313
- validate do |list|
1314
- list = Array(list).collect {|p| p.to_sym}
1315
- unless list == [:all]
1316
- list.each do |param|
1317
- next if @resource.class.validattr?(param)
1318
- fail "Cannot audit #{param}: not a valid attribute for #{resource}"
1319
- end
1320
- end
1321
- end
1322
-
1323
- munge do |args|
1324
- properties_to_audit(args).each do |param|
1325
- next unless resource.class.validproperty?(param)
1326
- resource.newattr(param)
1327
- end
1328
- end
1329
-
1330
- def all_properties
1331
- resource.class.properties.find_all do |property|
1332
- resource.provider.nil? or resource.provider.class.supports_parameter?(property)
1333
- end.collect do |property|
1334
- property.name
1335
- end
1336
- end
1337
-
1338
- def properties_to_audit(list)
1339
- if !list.kind_of?(Array) && list.to_sym == :all
1340
- all_properties
1341
- else
1342
- Array(list).collect { |p| p.to_sym }
1343
- end
1344
- end
1345
- end
1346
-
1347
- newmetaparam(:loglevel) do
1348
- desc "Sets the level that information will be logged.
1349
- The log levels have the biggest impact when logs are sent to
1350
- syslog (which is currently the default).
1351
-
1352
- The order of the log levels, in decreasing priority, is:
1353
-
1354
- * `emerg`
1355
- * `alert`
1356
- * `crit`
1357
- * `err`
1358
- * `warning`
1359
- * `notice`
1360
- * `info` / `verbose`
1361
- * `debug`
1362
- "
1363
- defaultto :notice
1364
-
1365
- newvalues(*Puppet::Util::Log.levels)
1366
- newvalues(:verbose)
1367
-
1368
- munge do |loglevel|
1369
- val = super(loglevel)
1370
- if val == :verbose
1371
- val = :info
1372
- end
1373
- val
1374
- end
1375
- end
1376
-
1377
- newmetaparam(:alias) do
1378
- desc %q{Creates an alias for the resource. Puppet uses this internally when you
1379
- provide a symbolic title and an explicit namevar value:
1380
-
1381
- file { 'sshdconfig':
1382
- path => $operatingsystem ? {
1383
- solaris => '/usr/local/etc/ssh/sshd_config',
1384
- default => '/etc/ssh/sshd_config',
1385
- },
1386
- source => '...'
1387
- }
1388
-
1389
- service { 'sshd':
1390
- subscribe => File['sshdconfig'],
1391
- }
1392
-
1393
- When you use this feature, the parser sets `sshdconfig` as the title,
1394
- and the library sets that as an alias for the file so the dependency
1395
- lookup in `Service['sshd']` works. You can use this metaparameter yourself,
1396
- but note that aliases generally only work for creating relationships; anything
1397
- else that refers to an existing resource (such as amending or overriding
1398
- resource attributes in an inherited class) must use the resource's exact
1399
- title. For example, the following code will not work:
1400
-
1401
- file { '/etc/ssh/sshd_config':
1402
- owner => root,
1403
- group => root,
1404
- alias => 'sshdconfig',
1405
- }
1406
-
1407
- File['sshdconfig'] {
1408
- mode => '0644',
1409
- }
1410
-
1411
- There's no way here for the Puppet parser to know that these two stanzas
1412
- should be affecting the same file.
1413
-
1414
- }
1415
-
1416
- munge do |aliases|
1417
- aliases = [aliases] unless aliases.is_a?(Array)
1418
-
1419
- raise(ArgumentError, _("Cannot add aliases without a catalog")) unless @resource.catalog
1420
-
1421
- aliases.each do |other|
1422
- if obj = @resource.catalog.resource(@resource.class.name, other)
1423
- unless obj.object_id == @resource.object_id
1424
- self.fail("#{@resource.title} can not create alias #{other}: object already exists")
1425
- end
1426
- next
1427
- end
1428
-
1429
- # Newschool, add it to the catalog.
1430
- @resource.catalog.alias(@resource, other)
1431
- end
1432
- end
1433
- end
1434
-
1435
- newmetaparam(:tag) do
1436
- desc "Add the specified tags to the associated resource. While all resources
1437
- are automatically tagged with as much information as possible
1438
- (e.g., each class and definition containing the resource), it can
1439
- be useful to add your own tags to a given resource.
1440
-
1441
- Multiple tags can be specified as an array:
1442
-
1443
- file {'/etc/hosts':
1444
- ensure => file,
1445
- source => 'puppet:///modules/site/hosts',
1446
- mode => '0644',
1447
- tag => ['bootstrap', 'minimumrun', 'mediumrun'],
1448
- }
1449
-
1450
- Tags are useful for things like applying a subset of a host's configuration
1451
- with [the `tags` setting](/puppet/latest/configuration.html#tags)
1452
- (e.g. `puppet agent --test --tags bootstrap`)."
1453
-
1454
- munge do |tags|
1455
- tags = [tags] unless tags.is_a? Array
1456
-
1457
- tags.each do |tag|
1458
- @resource.tag(tag)
1459
- end
1460
- end
1461
- end
1462
-
1463
- # RelationshipMetaparam is an implementation supporting the meta-parameters `:require`, `:subscribe`,
1464
- # `:notify`, and `:before`.
1465
- #
1466
- #
1467
- class RelationshipMetaparam < Puppet::Parameter
1468
- class << self
1469
- attr_accessor :direction, :events, :callback, :subclasses
1470
- end
1471
-
1472
- @subclasses = []
1473
-
1474
- def self.inherited(sub)
1475
- @subclasses << sub
1476
- end
1477
-
1478
- # @return [Array<Puppet::Resource>] turns attribute values into list of resources
1479
- def munge(references)
1480
- references = [references] unless references.is_a?(Array)
1481
- references.collect do |ref|
1482
- if ref.is_a?(Puppet::Resource)
1483
- ref
1484
- else
1485
- Puppet::Resource.new(ref)
1486
- end
1487
- end
1488
- end
1489
-
1490
- # Checks each reference to assert that what it references exists in the catalog.
1491
- #
1492
- # @raise [???fail] if the referenced resource can not be found
1493
- # @return [void]
1494
- def validate_relationship
1495
- @value.each do |ref|
1496
- unless @resource.catalog.resource(ref.to_s)
1497
- description = self.class.direction == :in ? "dependency" : "dependent"
1498
- fail ResourceError, _("Could not find %{description} %{ref} for %{resource}") %
1499
- { description: description, ref: ref, resource: resource.ref }
1500
- end
1501
- end
1502
- end
1503
-
1504
- # Creates edges for all relationships.
1505
- # The `:in` relationships are specified by the event-receivers, and `:out`
1506
- # relationships are specified by the event generator.
1507
- # @todo references to "event-receivers" and "event generator" means in this context - are those just
1508
- # the resources at the two ends of the relationship?
1509
- # This way 'source' and 'target' are consistent terms in both edges
1510
- # and events, i.e. an event targets edges whose source matches
1511
- # the event's source. The direction of the relationship determines
1512
- # which resource is applied first and which resource is considered
1513
- # to be the event generator.
1514
- # @return [Array<Puppet::Relationship>]
1515
- # @raise [???fail] when a reference can not be resolved
1516
- #
1517
- def to_edges
1518
- @value.collect do |reference|
1519
- reference.catalog = resource.catalog
1520
-
1521
- # Either of the two retrieval attempts could have returned
1522
- # nil.
1523
- unless related_resource = reference.resolve
1524
- self.fail "Could not retrieve dependency '#{reference}' of #{@resource.ref}"
1525
- end
1526
-
1527
- # Are we requiring them, or vice versa? See the method docs
1528
- # for further info on this.
1529
- if self.class.direction == :in
1530
- source = related_resource
1531
- target = @resource
1532
- else
1533
- source = @resource
1534
- target = related_resource
1535
- end
1536
-
1537
- if method = self.class.callback
1538
- subargs = {
1539
- :event => self.class.events,
1540
- :callback => method
1541
- }
1542
- else
1543
- # If there's no callback, there's no point in even adding
1544
- # a label.
1545
- subargs = nil
1546
- end
1547
-
1548
- ## Corrected syntax of debug statement to reflect the way this was called.
1549
- # i.e. before, after, subscribe, notify
1550
- self.debug do
1551
- relation = case self.class.name
1552
- when "subscribe"
1553
- "subscribes"
1554
- when "notify"
1555
- "notifies"
1556
- else
1557
- self.class.name
1558
- end
1559
-
1560
- "#{relation} to #{related_resource.ref}"
1561
- end
1562
-
1563
- Puppet::Relationship.new(source, target, subargs)
1564
- end
1565
- end
1566
- end
1567
-
1568
- # @todo document this, have no clue what this does... it returns "RelationshipMetaparam.subclasses"
1569
- #
1570
- def self.relationship_params
1571
- RelationshipMetaparam.subclasses
1572
- end
1573
-
1574
-
1575
- # Note that the order in which the relationships params is defined
1576
- # matters. The labeled params (notify and subscribe) must be later,
1577
- # so that if both params are used, those ones win. It's a hackish
1578
- # solution, but it works.
1579
-
1580
- newmetaparam(:require, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :NONE}) do
1581
- desc "One or more resources that this resource depends on, expressed as
1582
- [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1583
- Multiple resources can be specified as an array of references. When this
1584
- attribute is present:
1585
-
1586
- * The required resources will be applied **before** this resource.
1587
-
1588
- This is one of the four relationship metaparameters, along with
1589
- `before`, `notify`, and `subscribe`. For more context, including the
1590
- alternate chaining arrow (`->` and `~>`) syntax, see
1591
- [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1592
- end
1593
-
1594
- newmetaparam(:subscribe, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :ALL_EVENTS, :callback => :refresh}) do
1595
- desc "One or more resources that this resource depends on, expressed as
1596
- [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1597
- Multiple resources can be specified as an array of references. When this
1598
- attribute is present:
1599
-
1600
- * The subscribed resources will be applied _before_ this resource.
1601
- * If Puppet makes changes to any of the subscribed resources, it will cause
1602
- this resource to _refresh._ (Refresh behavior varies by resource
1603
- type: services will restart, mounts will unmount and re-mount, etc. Not
1604
- all types can refresh.)
1605
-
1606
- This is one of the four relationship metaparameters, along with
1607
- `before`, `require`, and `notify`. For more context, including the
1608
- alternate chaining arrow (`->` and `~>`) syntax, see
1609
- [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1610
- end
1611
-
1612
- newmetaparam(:before, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :NONE}) do
1613
- desc "One or more resources that depend on this resource, expressed as
1614
- [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1615
- Multiple resources can be specified as an array of references. When this
1616
- attribute is present:
1617
-
1618
- * This resource will be applied _before_ the dependent resources.
1619
-
1620
- This is one of the four relationship metaparameters, along with
1621
- `require`, `notify`, and `subscribe`. For more context, including the
1622
- alternate chaining arrow (`->` and `~>`) syntax, see
1623
- [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1624
- end
1625
-
1626
- newmetaparam(:notify, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :ALL_EVENTS, :callback => :refresh}) do
1627
- desc "One or more resources that depend on this resource, expressed as
1628
- [resource references](https://puppet.com/docs/puppet/latest/lang_data_resource_reference.html).
1629
- Multiple resources can be specified as an array of references. When this
1630
- attribute is present:
1631
-
1632
- * This resource will be applied _before_ the notified resources.
1633
- * If Puppet makes changes to this resource, it will cause all of the
1634
- notified resources to _refresh._ (Refresh behavior varies by resource
1635
- type: services will restart, mounts will unmount and re-mount, etc. Not
1636
- all types can refresh.)
1637
-
1638
- This is one of the four relationship metaparameters, along with
1639
- `before`, `require`, and `subscribe`. For more context, including the
1640
- alternate chaining arrow (`->` and `~>`) syntax, see
1641
- [the language page on relationships](https://puppet.com/docs/puppet/latest/lang_relationships.html)."
1642
- end
1643
-
1644
- newmetaparam(:stage) do
1645
- desc %{Which run stage this class should reside in.
1646
-
1647
- **Note: This metaparameter can only be used on classes,** and only when
1648
- declaring them with the resource-like syntax. It cannot be used on normal
1649
- resources or on classes declared with `include`.
1650
-
1651
- By default, all classes are declared in the `main` stage. To assign a class
1652
- to a different stage, you must:
1653
-
1654
- * Declare the new stage as a [`stage` resource](https://puppet.com/docs/puppet/latest/type.html#stage).
1655
- * Declare an order relationship between the new stage and the `main` stage.
1656
- * Use the resource-like syntax to declare the class, and set the `stage`
1657
- metaparameter to the name of the desired stage.
1658
-
1659
- For example:
1660
-
1661
- stage { 'pre':
1662
- before => Stage['main'],
1663
- }
1664
-
1665
- class { 'apt-updates':
1666
- stage => 'pre',
1667
- }
1668
- }
1669
- end
1670
-
1671
- newmetaparam(:export, :parent => RelationshipMetaparam, :attributes => {:direction => :out, :events => :NONE}) do
1672
- desc <<EOS
1673
- Export a capability resource.
1674
-
1675
- The value of this parameter must be a reference to a capability resource,
1676
- or an array of such references. Each capability resource referenced here
1677
- will be instantiated in the node catalog and exported to consumers of this
1678
- resource. The title of the capability resource will be the title given in
1679
- the reference, and all other attributes of the resource will be filled
1680
- according to the corresponding produces statement.
1681
-
1682
- It is an error if this metaparameter references resources whose type is not
1683
- a capability type, or of there is no produces clause for the type of the
1684
- current resource and the capability resource mentioned in this parameter.
1685
-
1686
- For example:
1687
-
1688
- define web(..) { .. }
1689
- Web produces Http { .. }
1690
- web { server:
1691
- export => Http[main_server]
1692
- }
1693
- EOS
1694
- end
1695
-
1696
- newmetaparam(:consume, :parent => RelationshipMetaparam, :attributes => {:direction => :in, :events => :NONE}) do
1697
- desc <<EOS
1698
- Consume a capability resource.
1699
-
1700
- The value of this parameter must be a reference to a capability resource,
1701
- or an array of such references. Each capability resource referenced here
1702
- must have been exported by another resource in the same environment.
1703
-
1704
- The referenced capability resources will be looked up, added to the
1705
- current node catalog, and processed following the underlying consumes
1706
- clause.
1707
-
1708
- It is an error if this metaparameter references resources whose type is not
1709
- a capability type, or of there is no consumes clause for the type of the
1710
- current resource and the capability resource mentioned in this parameter.
1711
-
1712
- For example:
1713
-
1714
- define web(..) { .. }
1715
- Web consumes Sql { .. }
1716
- web { server:
1717
- consume => Sql[my_db]
1718
- }
1719
- EOS
1720
- end
1721
-
1722
- ###############################
1723
- # All of the provider plumbing for the resource types.
1724
- require 'puppet/provider'
1725
- require 'puppet/util/provider_features'
1726
-
1727
- # Add the feature handling module.
1728
- extend Puppet::Util::ProviderFeatures
1729
-
1730
- # The provider that has been selected for the instance of the resource type.
1731
- # @return [Puppet::Provider,nil] the selected provider or nil, if none has been selected
1732
- #
1733
- attr_reader :provider
1734
-
1735
- # the Type class attribute accessors
1736
- class << self
1737
- # The loader of providers to use when loading providers from disk.
1738
- # Although it looks like this attribute provides a way to operate with different loaders of
1739
- # providers that is not the case; the attribute is written when a new type is created,
1740
- # and should not be changed thereafter.
1741
- # @api private
1742
- #
1743
- attr_accessor :providerloader
1744
-
1745
- # @todo Don't know if this is a name, or a reference to a Provider instance (now marked up as an instance
1746
- # of Provider.
1747
- # @return [Puppet::Provider, nil] The default provider for this type, or nil if non is defines
1748
- #
1749
- attr_writer :defaultprovider
1750
- end
1751
-
1752
- # The default provider, or the most suitable provider if no default provider was set.
1753
- # @note a warning will be issued if no default provider has been configured and a search for the most
1754
- # suitable provider returns more than one equally suitable provider.
1755
- # @return [Puppet::Provider, nil] the default or most suitable provider, or nil if no provider was found
1756
- #
1757
- def self.defaultprovider
1758
- return @defaultprovider if @defaultprovider
1759
-
1760
- suitable = suitableprovider
1761
-
1762
- # Find which providers are a default for this system.
1763
- defaults = suitable.find_all { |provider| provider.default? }
1764
-
1765
- # If we don't have any default we use suitable providers
1766
- defaults = suitable if defaults.empty?
1767
- max = defaults.collect { |provider| provider.specificity }.max
1768
- defaults = defaults.find_all { |provider| provider.specificity == max }
1769
-
1770
- if defaults.length > 1
1771
- Puppet.warning(_("Found multiple default providers for %{name}: %{provider_list}; using %{selected_provider}") %
1772
- { name: self.name, provider_list: defaults.collect { |i| i.name.to_s }.join(", "), selected_provider: defaults[0].name })
1773
- end
1774
-
1775
- @defaultprovider = defaults.shift unless defaults.empty?
1776
- end
1777
-
1778
- # @return [Hash{??? => Puppet::Provider}] Returns a hash of WHAT EXACTLY for the given type
1779
- # @todo what goes into this hash?
1780
- def self.provider_hash_by_type(type)
1781
- @provider_hashes ||= {}
1782
- @provider_hashes[type] ||= {}
1783
- end
1784
-
1785
- # @return [Hash{ ??? => Puppet::Provider}] Returns a hash of WHAT EXACTLY for this type.
1786
- # @see provider_hash_by_type method to get the same for some other type
1787
- def self.provider_hash
1788
- Puppet::Type.provider_hash_by_type(self.name)
1789
- end
1790
-
1791
- # Returns the provider having the given name.
1792
- # This will load a provider if it is not already loaded. The returned provider is the first found provider
1793
- # having the given name, where "first found" semantics is defined by the {providerloader} in use.
1794
- #
1795
- # @param name [String] the name of the provider to get
1796
- # @return [Puppet::Provider, nil] the found provider, or nil if no provider of the given name was found
1797
- #
1798
- def self.provider(name)
1799
- name = name.intern
1800
-
1801
- # If we don't have it yet, try loading it.
1802
- @providerloader.load(name, Puppet.lookup(:current_environment)) unless provider_hash.has_key?(name)
1803
- provider_hash[name]
1804
- end
1805
-
1806
- # Returns a list of loaded providers by name.
1807
- # This method will not load/search for available providers.
1808
- # @return [Array<String>] list of loaded provider names
1809
- #
1810
- def self.providers
1811
- provider_hash.keys
1812
- end
1813
-
1814
- # Returns true if the given name is a reference to a provider and if this is a suitable provider for
1815
- # this type.
1816
- # @todo How does the provider know if it is suitable for the type? Is it just suitable for the platform/
1817
- # environment where this method is executing?
1818
- # @param name [String] the name of the provider for which validity is checked
1819
- # @return [Boolean] true if the given name references a provider that is suitable
1820
- #
1821
- def self.validprovider?(name)
1822
- name = name.intern
1823
-
1824
- (provider_hash.has_key?(name) && provider_hash[name].suitable?)
1825
- end
1826
-
1827
- # Creates a new provider of a type.
1828
- # This method must be called directly on the type that it's implementing.
1829
- # @todo Fix Confusing Explanations!
1830
- # Is this a new provider of a Type (metatype), or a provider of an instance of Type (a resource), or
1831
- # a Provider (the implementation of a Type's behavior). CONFUSED. It calls magically named methods like
1832
- # "providify" ...
1833
- # @param name [String, Symbol] the name of the WHAT? provider? type?
1834
- # @param options [Hash{Symbol => Object}] a hash of options, used by this method, and passed on to {#genclass}, (see
1835
- # it for additional options to pass).
1836
- # @option options [Puppet::Provider] :parent the parent provider (what is this?)
1837
- # @option options [Puppet::Type] :resource_type the resource type, defaults to this type if unspecified
1838
- # @return [Puppet::Provider] a provider ???
1839
- # @raise [Puppet::DevError] when the parent provider could not be found.
1840
- #
1841
- def self.provide(name, options = {}, &block)
1842
- name = name.intern
1843
-
1844
- if unprovide(name)
1845
- Puppet.debug "Reloading #{name} #{self.name} provider"
1846
- end
1847
-
1848
- parent = if pname = options[:parent]
1849
- options.delete(:parent)
1850
- if pname.is_a? Class
1851
- pname
1852
- else
1853
- if provider = self.provider(pname)
1854
- provider
1855
- else
1856
- raise Puppet::DevError, _("Could not find parent provider %{parent} of %{name}") % { parent: pname, name: name }
1857
- end
1858
- end
1859
- else
1860
- Puppet::Provider
1861
- end
1862
-
1863
- options[:resource_type] ||= self
1864
-
1865
- self.providify
1866
-
1867
- provider = genclass(
1868
- name,
1869
- :parent => parent,
1870
- :hash => provider_hash,
1871
- :prefix => "Provider",
1872
- :block => block,
1873
- :include => feature_module,
1874
- :extend => feature_module,
1875
- :attributes => options
1876
- )
1877
-
1878
- provider
1879
- end
1880
-
1881
- # Ensures there is a `:provider` parameter defined.
1882
- # Should only be called if there are providers.
1883
- # @return [void]
1884
- def self.providify
1885
- return if @paramhash.has_key? :provider
1886
-
1887
- param = newparam(:provider) do
1888
- # We're using a hacky way to get the name of our type, since there doesn't
1889
- # seem to be a correct way to introspect this at the time this code is run.
1890
- # We expect that the class in which this code is executed will be something
1891
- # like Puppet::Type::Ssh_authorized_key::ParameterProvider.
1892
- desc <<-EOT
1893
- The specific backend to use for this `#{self.to_s.split('::')[2].downcase}`
1894
- resource. You will seldom need to specify this --- Puppet will usually
1895
- discover the appropriate provider for your platform.
1896
- EOT
1897
-
1898
- # This is so we can refer back to the type to get a list of
1899
- # providers for documentation.
1900
- class << self
1901
- # The reference to a parent type for the parameter `:provider` used to get a list of
1902
- # providers for documentation purposes.
1903
- #
1904
- attr_accessor :parenttype
1905
- end
1906
-
1907
- # Provides the ability to add documentation to a provider.
1908
- #
1909
- def self.doc
1910
- # Since we're mixing @doc with text from other sources, we must normalize
1911
- # its indentation with scrub. But we don't need to manually scrub the
1912
- # provider's doc string, since markdown_definitionlist sanitizes its inputs.
1913
- scrub(@doc) + "Available providers are:\n\n" + parenttype.providers.sort { |a,b|
1914
- a.to_s <=> b.to_s
1915
- }.collect { |i|
1916
- markdown_definitionlist( i, scrub(parenttype().provider(i).doc) )
1917
- }.join
1918
- end
1919
-
1920
- # For each resource, the provider param defaults to
1921
- # the type's default provider
1922
- defaultto {
1923
- prov = @resource.class.defaultprovider
1924
- prov.name if prov
1925
- }
1926
-
1927
- validate do |provider_class|
1928
- provider_class = provider_class[0] if provider_class.is_a? Array
1929
- provider_class = provider_class.class.name if provider_class.is_a?(Puppet::Provider)
1930
-
1931
- unless @resource.class.provider(provider_class)
1932
- raise ArgumentError, _("Invalid %{resource} provider '%{provider_class}'") % { resource: @resource.class.name, provider_class: provider_class}
1933
- end
1934
- end
1935
-
1936
- munge do |provider|
1937
- provider = provider[0] if provider.is_a? Array
1938
- provider = provider.intern if provider.is_a? String
1939
- @resource.provider = provider
1940
-
1941
- if provider.is_a?(Puppet::Provider)
1942
- provider.class.name
1943
- else
1944
- provider
1945
- end
1946
- end
1947
- end
1948
- param.parenttype = self
1949
- end
1950
-
1951
- # @todo this needs a better explanation
1952
- # Removes the implementation class of a given provider.
1953
- # @return [Object] returns what {Puppet::Util::ClassGen#rmclass} returns
1954
- def self.unprovide(name)
1955
- if @defaultprovider and @defaultprovider.name == name
1956
- @defaultprovider = nil
1957
- end
1958
-
1959
- rmclass(name, :hash => provider_hash, :prefix => "Provider")
1960
- end
1961
-
1962
- # Returns a list of suitable providers for the given type.
1963
- # A call to this method will load all providers if not already loaded and ask each if it is
1964
- # suitable - those that are are included in the result.
1965
- # @note This method also does some special processing which rejects a provider named `:fake` (for testing purposes).
1966
- # @return [Array<Puppet::Provider>] Returns an array of all suitable providers.
1967
- #
1968
- def self.suitableprovider
1969
- providerloader.loadall(Puppet.lookup(:current_environment)) if provider_hash.empty?
1970
- provider_hash.find_all { |name, provider|
1971
- provider.suitable?
1972
- }.collect { |name, provider|
1973
- provider
1974
- }.reject { |p| p.name == :fake } # For testing
1975
- end
1976
-
1977
- # @return [Boolean] Returns true if this is something else than a `:provider`, or if it
1978
- # is a provider and it is suitable, or if there is a default provider. Otherwise, false is returned.
1979
- #
1980
- def suitable?
1981
- # If we don't use providers, then we consider it suitable.
1982
- return true unless self.class.paramclass(:provider)
1983
-
1984
- # We have a provider and it is suitable.
1985
- return true if provider && provider.class.suitable?
1986
-
1987
- # We're using the default provider and there is one.
1988
- if !provider and self.class.defaultprovider
1989
- self.provider = self.class.defaultprovider.name
1990
- return true
1991
- end
1992
-
1993
- # We specified an unsuitable provider, or there isn't any suitable
1994
- # provider.
1995
- false
1996
- end
1997
-
1998
- # Sets the provider to the given provider/name.
1999
- # @overload provider=(name)
2000
- # Sets the provider to the result of resolving the name to an instance of Provider.
2001
- # @param name [String] the name of the provider
2002
- # @overload provider=(provider)
2003
- # Sets the provider to the given instances of Provider.
2004
- # @param provider [Puppet::Provider] the provider to set
2005
- # @return [Puppet::Provider] the provider set
2006
- # @raise [ArgumentError] if the provider could not be found/resolved.
2007
- #
2008
- def provider=(name)
2009
- if name.is_a?(Puppet::Provider)
2010
- @provider = name
2011
- @provider.resource = self
2012
- elsif klass = self.class.provider(name)
2013
- @provider = klass.new(self)
2014
- else
2015
- raise ArgumentError, _("Could not find %{name} provider of %{provider}") % { name: name, provider: self.class.name }
2016
- end
2017
- end
2018
-
2019
- ###############################
2020
- # All of the relationship code.
2021
-
2022
- # Adds a block producing a single name (or list of names) of the given
2023
- # resource type name to autorelate.
2024
- #
2025
- # The four relationship types require, before, notify, and subscribe are all
2026
- # supported.
2027
- #
2028
- # Be *careful* with notify and subscribe as they may have unintended
2029
- # consequences.
2030
- #
2031
- # Resources in the catalog that have the named type and a title that is
2032
- # included in the result will be linked to the calling resource as a
2033
- # requirement.
2034
- #
2035
- # @example Autorequire the files File['foo', 'bar']
2036
- # autorequire( 'file', {|| ['foo', 'bar'] })
2037
- #
2038
- # @example Autobefore the files File['foo', 'bar']
2039
- # autobefore( 'file', {|| ['foo', 'bar'] })
2040
- #
2041
- # @example Autosubscribe the files File['foo', 'bar']
2042
- # autosubscribe( 'file', {|| ['foo', 'bar'] })
2043
- #
2044
- # @example Autonotify the files File['foo', 'bar']
2045
- # autonotify( 'file', {|| ['foo', 'bar'] })
2046
- #
2047
- # @param name [String] the name of a type of which one or several resources should be autorelated e.g. "file"
2048
- # @yield [ ] a block returning list of names of given type to auto require
2049
- # @yieldreturn [String, Array<String>] one or several resource names for the named type
2050
- # @return [void]
2051
- # @dsl type
2052
- # @api public
2053
- #
2054
- def self.autorequire(name, &block)
2055
- @autorequires ||= {}
2056
- @autorequires[name] = block
2057
- end
2058
-
2059
- def self.autobefore(name, &block)
2060
- @autobefores ||= {}
2061
- @autobefores[name] = block
2062
- end
2063
-
2064
- def self.autosubscribe(name, &block)
2065
- @autosubscribes ||= {}
2066
- @autosubscribes[name] = block
2067
- end
2068
-
2069
- def self.autonotify(name, &block)
2070
- @autonotifies ||= {}
2071
- @autonotifies[name] = block
2072
- end
2073
-
2074
- # Provides iteration over added auto-requirements (see {autorequire}).
2075
- # @yieldparam type [String] the name of the type to autorequire an instance of
2076
- # @yieldparam block [Proc] a block producing one or several dependencies to auto require (see {autorequire}).
2077
- # @yieldreturn [void]
2078
- # @return [void]
2079
- def self.eachautorequire
2080
- @autorequires ||= {}
2081
- @autorequires.each { |type, block|
2082
- yield(type, block)
2083
- }
2084
- end
2085
-
2086
- # Provides iteration over added auto-requirements (see {autobefore}).
2087
- # @yieldparam type [String] the name of the type to autorequire an instance of
2088
- # @yieldparam block [Proc] a block producing one or several dependencies to auto require (see {autobefore}).
2089
- # @yieldreturn [void]
2090
- # @return [void]
2091
- def self.eachautobefore
2092
- @autobefores ||= {}
2093
- @autobefores.each { |type,block|
2094
- yield(type, block)
2095
- }
2096
- end
2097
-
2098
- # Provides iteration over added auto-requirements (see {autosubscribe}).
2099
- # @yieldparam type [String] the name of the type to autorequire an instance of
2100
- # @yieldparam block [Proc] a block producing one or several dependencies to auto require (see {autosubscribe}).
2101
- # @yieldreturn [void]
2102
- # @return [void]
2103
- def self.eachautosubscribe
2104
- @autosubscribes ||= {}
2105
- @autosubscribes.each { |type,block|
2106
- yield(type, block)
2107
- }
2108
- end
2109
-
2110
- # Provides iteration over added auto-requirements (see {autonotify}).
2111
- # @yieldparam type [String] the name of the type to autorequire an instance of
2112
- # @yieldparam block [Proc] a block producing one or several dependencies to auto require (see {autonotify}).
2113
- # @yieldreturn [void]
2114
- # @return [void]
2115
- def self.eachautonotify
2116
- @autonotifies ||= {}
2117
- @autonotifies.each { |type,block|
2118
- yield(type, block)
2119
- }
2120
- end
2121
-
2122
- # Adds dependencies to the catalog from added autorelations.
2123
- # See {autorequire} for how to add an auto-requirement.
2124
- # @todo needs details - see the param rel_catalog, and type of this param
2125
- # @param rel_catalog [Puppet::Resource::Catalog, nil] the catalog to
2126
- # add dependencies to. Defaults to the current catalog (set when the
2127
- # type instance was added to a catalog)
2128
- # @raise [Puppet::DevError] if there is no catalog
2129
- #
2130
- def autorelation(rel_type, rel_catalog = nil)
2131
- rel_catalog ||= catalog
2132
- raise Puppet::DevError, _("You cannot add relationships without a catalog") unless rel_catalog
2133
-
2134
- reqs = []
2135
-
2136
- auto_rel = "eachauto#{rel_type}".to_sym
2137
-
2138
- self.class.send(auto_rel) { |type, block|
2139
- # Ignore any types we can't find, although that would be a bit odd.
2140
- next unless Puppet::Type.type(type)
2141
-
2142
- # Retrieve the list of names from the block.
2143
- next unless list = self.instance_eval(&block)
2144
- list = [list] unless list.is_a?(Array)
2145
-
2146
- # Collect the current prereqs
2147
- list.each { |dep|
2148
- next if dep.nil?
2149
-
2150
- # Support them passing objects directly, to save some effort.
2151
- unless dep.is_a?(Puppet::Type)
2152
- # Skip autorelation that we aren't managing
2153
- unless dep = rel_catalog.resource(type, dep)
2154
- next
2155
- end
2156
- end
2157
-
2158
- if [:require, :subscribe].include?(rel_type)
2159
- reqs << Puppet::Relationship.new(dep, self)
2160
- else
2161
- reqs << Puppet::Relationship.new(self, dep)
2162
- end
2163
- }
2164
- }
2165
-
2166
- reqs
2167
- end
2168
-
2169
- def autorequire(rel_catalog = nil)
2170
- autorelation(:require, rel_catalog)
2171
- end
2172
-
2173
- def autobefore(rel_catalog = nil)
2174
- autorelation(:before, rel_catalog)
2175
- end
2176
-
2177
- def autosubscribe(rel_catalog = nil)
2178
- autorelation(:subscribe, rel_catalog)
2179
- end
2180
-
2181
- def autonotify(rel_catalog = nil)
2182
- autorelation(:notify, rel_catalog)
2183
- end
2184
-
2185
- # Builds the dependencies associated with this resource.
2186
- #
2187
- # @return [Array<Puppet::Relationship>] list of relationships to other resources
2188
- def builddepends
2189
- # Handle the requires
2190
- self.class.relationship_params.collect do |klass|
2191
- if param = @parameters[klass.name]
2192
- param.to_edges
2193
- end
2194
- end.flatten.reject { |r| r.nil? }
2195
- end
2196
-
2197
- # Sets the initial list of tags to associate to this resource.
2198
- #
2199
- # @return [void] ???
2200
- def tags=(list)
2201
- tag(self.class.name)
2202
- tag(*list)
2203
- end
2204
-
2205
- # @comment - these two comments were floating around here, and turned up as documentation
2206
- # for the attribute "title", much to my surprise and amusement. Clearly these comments
2207
- # are orphaned ... I think they can just be removed as what they say should be covered
2208
- # by the now added yardoc. <irony>(Yo! to quote some of the other actual awesome specific comments applicable
2209
- # to objects called from elsewhere, or not. ;-)</irony>
2210
- #
2211
- # @comment Types (which map to resources in the languages) are entirely composed of
2212
- # attribute value pairs. Generally, Puppet calls any of these things an
2213
- # 'attribute', but these attributes always take one of three specific
2214
- # forms: parameters, metaparams, or properties.
2215
-
2216
- # @comment In naming methods, I have tried to consistently name the method so
2217
- # that it is clear whether it operates on all attributes (thus has 'attr' in
2218
- # the method name, or whether it operates on a specific type of attributes.
2219
-
2220
- # The title attribute of WHAT ???
2221
- # @todo Figure out what this is the title attribute of (it appears on line 1926 currently).
2222
- # @return [String] the title
2223
- attr_writer :title
2224
-
2225
- # The noop attribute of WHAT ??? does WHAT???
2226
- # @todo Figure out what this is the noop attribute of (it appears on line 1931 currently).
2227
- # @return [???] the noop WHAT ??? (mode? if so of what, or noop for an instance of the type, or for all
2228
- # instances of a type, or for what???
2229
- #
2230
- attr_writer :noop
2231
-
2232
- include Enumerable
2233
-
2234
- # class methods dealing with Type management
2235
-
2236
- # The Type class attribute accessors
2237
- class << self
2238
- # @return [String] the name of the resource type; e.g., "File"
2239
- #
2240
- attr_reader :name
2241
-
2242
- # @return [Boolean] true if the type should send itself a refresh event on change.
2243
- #
2244
- attr_accessor :self_refresh
2245
- include Enumerable, Puppet::Util::ClassGen
2246
- include Puppet::MetaType::Manager
2247
-
2248
- include Puppet::Util
2249
- include Puppet::Util::Logging
2250
- end
2251
-
2252
- # Initializes all of the variables that must be initialized for each subclass.
2253
- # @todo Does the explanation make sense?
2254
- # @return [void]
2255
- def self.initvars
2256
- # all of the instances of this class
2257
- @objects = Hash.new
2258
- @aliases = Hash.new
2259
-
2260
- @defaults = {}
2261
-
2262
- @parameters ||= []
2263
-
2264
- @validproperties = {}
2265
- @properties = []
2266
- @parameters = []
2267
- @paramhash = {}
2268
-
2269
- @paramdoc = Hash.new { |hash,key|
2270
- key = key.intern if key.is_a?(String)
2271
- if hash.include?(key)
2272
- hash[key]
2273
- else
2274
- "Param Documentation for #{key} not found"
2275
- end
2276
- }
2277
-
2278
- @doc ||= ""
2279
-
2280
- end
2281
-
2282
- # Returns the name of this type (if specified) or the parent type #to_s.
2283
- # The returned name is on the form "Puppet::Type::<name>", where the first letter of name is
2284
- # capitalized.
2285
- # @return [String] the fully qualified name Puppet::Type::<name> where the first letter of name is capitalized
2286
- #
2287
- def self.to_s
2288
- if defined?(@name)
2289
- "Puppet::Type::#{@name.to_s.capitalize}"
2290
- else
2291
- super
2292
- end
2293
- end
2294
-
2295
- # Creates a `validate` method that is used to validate a resource before it is operated on.
2296
- # The validation should raise exceptions if the validation finds errors. (It is not recommended to
2297
- # issue warnings as this typically just ends up in a logfile - you should fail if a validation fails).
2298
- # The easiest way to raise an appropriate exception is to call the method {Puppet::Util::Errors.fail} with
2299
- # the message as an argument.
2300
- #
2301
- # @yield [ ] a required block called with self set to the instance of a Type class representing a resource.
2302
- # @return [void]
2303
- # @dsl type
2304
- # @api public
2305
- #
2306
- def self.validate(&block)
2307
- define_method(:validate, &block)
2308
- end
2309
-
2310
- # @return [String] The file from which this type originates from
2311
- attr_accessor :file
2312
-
2313
- # @return [Integer] The line in {#file} from which this type originates from
2314
- attr_accessor :line
2315
-
2316
- # @todo what does this mean "this resource" (sounds like this if for an instance of the type, not the meta Type),
2317
- # but not sure if this is about the catalog where the meta Type is included)
2318
- # @return [??? TODO] The catalog that this resource is stored in.
2319
- attr_accessor :catalog
2320
-
2321
- # @return [Boolean] Flag indicating if this type is exported
2322
- attr_accessor :exported
2323
-
2324
- # @return [Boolean] Flag indicating if the type is virtual (it should not be).
2325
- attr_accessor :virtual
2326
-
2327
- # Creates a log entry with the given message at the log level specified by the parameter `loglevel`
2328
- # @return [void]
2329
- #
2330
- def log(msg)
2331
-
2332
- Puppet::Util::Log.create(
2333
-
2334
- :level => @parameters[:loglevel].value,
2335
- :message => msg,
2336
-
2337
- :source => self
2338
- )
2339
- end
2340
-
2341
-
2342
- # instance methods related to instance intrinsics
2343
- # e.g., initialize and name
2344
-
2345
- # @return [Hash] hash of parameters originally defined
2346
- # @api private
2347
- attr_reader :original_parameters
2348
-
2349
- # Creates an instance of Type from a hash or a {Puppet::Resource}.
2350
- # @todo Unclear if this is a new Type or a new instance of a given type (the initialization ends
2351
- # with calling validate - which seems like validation of an instance of a given type, not a new
2352
- # meta type.
2353
- #
2354
- # @todo Explain what the Hash and Resource are. There seems to be two different types of
2355
- # resources; one that causes the title to be set to resource.title, and one that
2356
- # causes the title to be resource.ref ("for components") - what is a component?
2357
- #
2358
- # @overload initialize(hash)
2359
- # @param [Hash] hash
2360
- # @raise [Puppet::ResourceError] when the type validation raises
2361
- # Puppet::Error or ArgumentError
2362
- # @overload initialize(resource)
2363
- # @param resource [Puppet:Resource]
2364
- # @raise [Puppet::ResourceError] when the type validation raises
2365
- # Puppet::Error or ArgumentError
2366
- #
2367
- def initialize(resource)
2368
- resource = self.class.hash2resource(resource) unless resource.is_a?(Puppet::Resource)
2369
-
2370
- # The list of parameter/property instances.
2371
- @parameters = {}
2372
-
2373
- # Set the title first, so any failures print correctly.
2374
- if resource.type.to_s.downcase.to_sym == self.class.name
2375
- self.title = resource.title
2376
- else
2377
- # This should only ever happen for components
2378
- self.title = resource.ref
2379
- end
2380
-
2381
- [:file, :line, :catalog, :exported, :virtual].each do |getter|
2382
- setter = getter.to_s + "="
2383
- if val = resource.send(getter)
2384
- self.send(setter, val)
2385
- end
2386
- end
2387
-
2388
- merge_tags_from(resource)
2389
-
2390
- @original_parameters = resource.to_hash
2391
-
2392
- set_name(@original_parameters)
2393
-
2394
- set_default(:provider)
2395
-
2396
- set_parameters(@original_parameters)
2397
-
2398
- begin
2399
- self.validate if self.respond_to?(:validate)
2400
- rescue Puppet::Error, ArgumentError => detail
2401
- error = Puppet::ResourceError.new("Validation of #{ref} failed: #{detail}")
2402
- adderrorcontext(error, detail)
2403
- raise error
2404
- end
2405
-
2406
- set_sensitive_parameters(resource.sensitive_parameters)
2407
- end
2408
-
2409
- protected
2410
-
2411
- # Mark parameters associated with this type as sensitive, based on the associated resource.
2412
- #
2413
- # Currently, only instances of `Puppet::Property` can be easily marked for sensitive data handling
2414
- # and information redaction is limited to redacting events generated while synchronizing
2415
- # properties. While support for redaction will be broadened in the future we can't automatically
2416
- # deduce how to redact arbitrary parameters, so if a parameter is marked for redaction the best
2417
- # we can do is warn that we can't handle treating that parameter as sensitive and move on.
2418
- #
2419
- # In some unusual cases a given parameter will be marked as sensitive but that sensitive context
2420
- # needs to be transferred to another parameter. In this case resource types may need to override
2421
- # this method in order to copy the sensitive context from one parameter to another (and in the
2422
- # process force the early generation of a parameter that might otherwise be lazily generated.)
2423
- # See `Puppet::Type.type(:file)#set_sensitive_parameters` for an example of this.
2424
- #
2425
- # @note This method visibility is protected since it should only be called by #initialize, but is
2426
- # marked as public as subclasses may need to override this method.
2427
- #
2428
- # @api public
2429
- #
2430
- # @param sensitive_parameters [Array<Symbol>] A list of parameters to mark as sensitive.
2431
- #
2432
- # @return [void]
2433
- def set_sensitive_parameters(sensitive_parameters)
2434
- sensitive_parameters.each do |name|
2435
- p = parameter(name)
2436
- if p.is_a?(Puppet::Property)
2437
- p.sensitive = true
2438
- elsif p.is_a?(Puppet::Parameter)
2439
- warning(_("Unable to mark '%{name}' as sensitive: %{name} is a parameter and not a property, and cannot be automatically redacted.") %
2440
- { name: name })
2441
- elsif self.class.attrclass(name)
2442
- warning(_("Unable to mark '%{name}' as sensitive: the property itself was not assigned a value.") % { name: name })
2443
- else
2444
- err(_("Unable to mark '%{name}' as sensitive: the property itself is not defined on %{type}.") % { name: name, type: type })
2445
- end
2446
- end
2447
-
2448
- parameters.each do |name, param|
2449
- next if param.sensitive
2450
- if param.is_a?(Puppet::Parameter)
2451
- param.sensitive = param.is_sensitive if param.respond_to?(:is_sensitive)
2452
- end
2453
- end
2454
- end
2455
-
2456
- private
2457
-
2458
- # Sets the name of the resource from a hash containing a mapping of `name_var` to value.
2459
- # Sets the value of the property/parameter appointed by the `name_var` (if it is defined). The value set is
2460
- # given by the corresponding entry in the given hash - e.g. if name_var appoints the name `:path` the value
2461
- # of `:path` is set to the value at the key `:path` in the given hash. As a side effect this key/value is then
2462
- # removed from the given hash.
2463
- #
2464
- # @note This method mutates the given hash by removing the entry with a key equal to the value
2465
- # returned from name_var!
2466
- # @param hash [Hash] a hash of what
2467
- # @return [void]
2468
- def set_name(hash)
2469
- self[name_var] = hash.delete(name_var) if name_var
2470
- end
2471
-
2472
- # Sets parameters from the given hash.
2473
- # Values are set in _attribute order_ i.e. higher priority attributes before others, otherwise in
2474
- # the order they were specified (as opposed to just setting them in the order they happen to appear in
2475
- # when iterating over the given hash).
2476
- #
2477
- # Attributes that are not included in the given hash are set to their default value.
2478
- #
2479
- # @todo Is this description accurate? Is "ensure" an example of such a higher priority attribute?
2480
- # @return [void]
2481
- # @raise [Puppet::DevError] when impossible to set the value due to some problem
2482
- # @raise [ArgumentError, TypeError, Puppet::Error] when faulty arguments have been passed
2483
- #
2484
- def set_parameters(hash)
2485
- # Use the order provided by allattrs, but add in any
2486
- # extra attributes from the resource so we get failures
2487
- # on invalid attributes.
2488
- no_values = []
2489
- (self.class.allattrs + hash.keys).uniq.each do |attr|
2490
- begin
2491
- # Set any defaults immediately. This is mostly done so
2492
- # that the default provider is available for any other
2493
- # property validation.
2494
- if hash.has_key?(attr)
2495
- self[attr] = hash[attr]
2496
- else
2497
- no_values << attr
2498
- end
2499
- rescue ArgumentError, Puppet::Error, TypeError
2500
- raise
2501
- rescue => detail
2502
- error = Puppet::DevError.new(_("Could not set %{attribute} on %{class_name}: %{detail}") % { attribute: attr, class_name: self.class.name, detail: detail })
2503
- error.set_backtrace(detail.backtrace)
2504
- raise error
2505
- end
2506
- end
2507
- no_values.each do |attr|
2508
- set_default(attr)
2509
- end
2510
- end
2511
-
2512
- public
2513
-
2514
- # Finishes any outstanding processing.
2515
- # This method should be called as a final step in setup,
2516
- # to allow the parameters that have associated auto-require needs to be processed.
2517
- #
2518
- # @todo what is the expected sequence here - who is responsible for calling this? When?
2519
- # Is the returned type correct?
2520
- # @return [Array<Puppet::Parameter>] the validated list/set of attributes
2521
- #
2522
- def finish
2523
- # Call post_compile hook on every parameter that implements it. This includes all subclasses
2524
- # of parameter including, but not limited to, regular parameters, metaparameters, relationship
2525
- # parameters, and properties.
2526
- eachparameter do |parameter|
2527
- parameter.post_compile if parameter.respond_to? :post_compile
2528
- end
2529
-
2530
- # Make sure all of our relationships are valid. Again, must be done
2531
- # when the entire catalog is instantiated.
2532
- self.class.relationship_params.collect do |klass|
2533
- if param = @parameters[klass.name]
2534
- param.validate_relationship
2535
- end
2536
- end.flatten.reject { |r| r.nil? }
2537
- end
2538
-
2539
- # @comment For now, leave the 'name' method functioning like it used to. Once 'title'
2540
- # works everywhere, I'll switch it.
2541
- # Returns the resource's name
2542
- # @todo There is a comment in source that this is not quite the same as ':title' and that a switch should
2543
- # be made...
2544
- # @return [String] the name of a resource
2545
- def name
2546
- self[:name]
2547
- end
2548
-
2549
- # Returns the parent of this in the catalog. In case of an erroneous catalog
2550
- # where multiple parents have been produced, the first found (non
2551
- # deterministic) parent is returned.
2552
- # @return [Puppet::Type, nil] the
2553
- # containing resource or nil if there is no catalog or no containing
2554
- # resource.
2555
- def parent
2556
- return nil unless catalog
2557
-
2558
- @parent ||=
2559
- if parents = catalog.adjacent(self, :direction => :in)
2560
- parents.shift
2561
- else
2562
- nil
2563
- end
2564
- end
2565
-
2566
- # Returns a reference to this as a string in "Type[name]" format.
2567
- # @return [String] a reference to this object on the form 'Type[name]'
2568
- #
2569
- def ref
2570
- # memoizing this is worthwhile ~ 3 percent of calls are the "first time
2571
- # around" in an average run of Puppet. --daniel 2012-07-17
2572
- @ref ||= "#{self.class.name.to_s.capitalize}[#{self.title}]"
2573
- end
2574
-
2575
- # (see self_refresh)
2576
- # @todo check that meaningful yardoc is produced - this method delegates to "self.class.self_refresh"
2577
- # @return [Boolean] - ??? returns true when ... what?
2578
- #
2579
- def self_refresh?
2580
- self.class.self_refresh
2581
- end
2582
-
2583
- # Marks the object as "being purged".
2584
- # This method is used by transactions to forbid deletion when there are dependencies.
2585
- # @todo what does this mean; "mark that we are purging" (purging what from where). How to use/when?
2586
- # Is this internal API in transactions?
2587
- # @see purging?
2588
- def purging
2589
- @purging = true
2590
- end
2591
-
2592
- # Returns whether this resource is being purged or not.
2593
- # This method is used by transactions to forbid deletion when there are dependencies.
2594
- # @return [Boolean] the current "purging" state
2595
- #
2596
- def purging?
2597
- if defined?(@purging)
2598
- @purging
2599
- else
2600
- false
2601
- end
2602
- end
2603
-
2604
- # Returns the title of this object, or its name if title was not explicitly set.
2605
- # If the title is not already set, it will be computed by looking up the {#name_var} and using
2606
- # that value as the title.
2607
- # @todo it is somewhat confusing that if the name_var is a valid parameter, it is assumed to
2608
- # be the name_var called :name, but if it is a property, it uses the name_var.
2609
- # It is further confusing as Type in some respects supports multiple namevars.
2610
- #
2611
- # @return [String] Returns the title of this object, or its name if title was not explicitly set.
2612
- # @raise [??? devfail] if title is not set, and name_var can not be found.
2613
- def title
2614
- unless @title
2615
- if self.class.validparameter?(name_var)
2616
- @title = self[:name]
2617
- elsif self.class.validproperty?(name_var)
2618
- @title = self.should(name_var)
2619
- else
2620
- self.devfail "Could not find namevar #{name_var} for #{self.class.name}"
2621
- end
2622
- end
2623
-
2624
- @title
2625
- end
2626
-
2627
- # Produces a reference to this in reference format.
2628
- # @see #ref
2629
- #
2630
- def to_s
2631
- self.ref
2632
- end
2633
-
2634
- # Convert this resource type instance to a Puppet::Resource.
2635
- # @return [Puppet::Resource] Returns a serializable representation of this resource
2636
- #
2637
- def to_resource
2638
- resource = self.retrieve_resource
2639
- resource.merge_tags_from(self)
2640
-
2641
- @parameters.each do |name, param|
2642
- # Avoid adding each instance name twice
2643
- next if param.class.isnamevar? and param.value == self.title
2644
-
2645
- # We've already got property values
2646
- next if param.is_a?(Puppet::Property)
2647
- resource[name] = param.value
2648
- end
2649
-
2650
- resource
2651
- end
2652
-
2653
- # @return [Boolean] Returns whether the resource is virtual or not
2654
- def virtual?; !!@virtual; end
2655
- # @return [Boolean] Returns whether the resource is exported or not
2656
- def exported?; !!@exported; end
2657
-
2658
- # @return [Boolean] Returns whether the resource is applicable to `:device`
2659
- # Returns true if a resource of this type can be evaluated on a 'network device' kind
2660
- # of hosts.
2661
- # @api private
2662
- def appliable_to_device?
2663
- self.class.can_apply_to(:device)
2664
- end
2665
-
2666
- # @return [Boolean] Returns whether the resource is applicable to `:host`
2667
- # Returns true if a resource of this type can be evaluated on a regular generalized computer (ie not an appliance like a network device)
2668
- # @api private
2669
- def appliable_to_host?
2670
- self.class.can_apply_to(:host)
2671
- end
2672
- end
2673
- end