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