bolt 0.20.3 → 0.20.5

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 (256) hide show
  1. checksums.yaml +4 -4
  2. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +3 -3
  3. data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +33 -0
  4. data/lib/bolt/inventory.rb +19 -1
  5. data/lib/bolt/target.rb +15 -0
  6. data/lib/bolt/transport/local.rb +6 -1
  7. data/lib/bolt/transport/orch.rb +2 -0
  8. data/lib/bolt/transport/ssh.rb +7 -2
  9. data/lib/bolt/transport/winrm.rb +6 -1
  10. data/lib/bolt/version.rb +1 -1
  11. data/modules/facts/plans/retrieve.pp +2 -26
  12. data/modules/facts/tasks/init.json +9 -0
  13. data/vendored/puppet/lib/hiera/puppet_function.rb +1 -1
  14. data/vendored/puppet/lib/hiera/scope.rb +24 -2
  15. data/vendored/puppet/lib/puppet.rb +4 -13
  16. data/vendored/puppet/lib/puppet/application.rb +2 -2
  17. data/vendored/puppet/lib/puppet/application/agent.rb +1 -1
  18. data/vendored/puppet/lib/puppet/application/apply.rb +1 -1
  19. data/vendored/puppet/lib/puppet/application/cert.rb +1 -1
  20. data/vendored/puppet/lib/puppet/application/device.rb +8 -8
  21. data/vendored/puppet/lib/puppet/application/face_base.rb +1 -1
  22. data/vendored/puppet/lib/puppet/application/lookup.rb +2 -2
  23. data/vendored/puppet/lib/puppet/application/resource.rb +2 -2
  24. data/vendored/puppet/lib/puppet/application/script.rb +1 -1
  25. data/vendored/puppet/lib/puppet/configurer.rb +47 -24
  26. data/vendored/puppet/lib/puppet/confine.rb +4 -1
  27. data/vendored/puppet/lib/puppet/context.rb +1 -1
  28. data/vendored/puppet/lib/puppet/defaults.rb +32 -44
  29. data/vendored/puppet/lib/puppet/error.rb +14 -7
  30. data/vendored/puppet/lib/puppet/external/dot.rb +23 -17
  31. data/vendored/puppet/lib/puppet/face/config.rb +58 -3
  32. data/vendored/puppet/lib/puppet/face/epp.rb +1 -1
  33. data/vendored/puppet/lib/puppet/face/module/build.rb +3 -3
  34. data/vendored/puppet/lib/puppet/face/module/install.rb +0 -4
  35. data/vendored/puppet/lib/puppet/face/module/list.rb +0 -5
  36. data/vendored/puppet/lib/puppet/face/module/search.rb +1 -1
  37. data/vendored/puppet/lib/puppet/face/module/uninstall.rb +0 -4
  38. data/vendored/puppet/lib/puppet/face/module/upgrade.rb +0 -4
  39. data/vendored/puppet/lib/puppet/face/status.rb +2 -2
  40. data/vendored/puppet/lib/puppet/file_serving/base.rb +5 -5
  41. data/vendored/puppet/lib/puppet/file_serving/metadata.rb +2 -1
  42. data/vendored/puppet/lib/puppet/forge.rb +7 -8
  43. data/vendored/puppet/lib/puppet/forge/errors.rb +3 -3
  44. data/vendored/puppet/lib/puppet/functions/abs.rb +61 -0
  45. data/vendored/puppet/lib/puppet/functions/all.rb +2 -2
  46. data/vendored/puppet/lib/puppet/functions/any.rb +2 -2
  47. data/vendored/puppet/lib/puppet/functions/assert_type.rb +3 -3
  48. data/vendored/puppet/lib/puppet/functions/break.rb +3 -7
  49. data/vendored/puppet/lib/puppet/functions/camelcase.rb +62 -0
  50. data/vendored/puppet/lib/puppet/functions/capitalize.rb +61 -0
  51. data/vendored/puppet/lib/puppet/functions/ceiling.rb +37 -0
  52. data/vendored/puppet/lib/puppet/functions/chomp.rb +57 -0
  53. data/vendored/puppet/lib/puppet/functions/chop.rb +67 -0
  54. data/vendored/puppet/lib/puppet/functions/compare.rb +125 -0
  55. data/vendored/puppet/lib/puppet/functions/convert_to.rb +3 -2
  56. data/vendored/puppet/lib/puppet/functions/dig.rb +21 -1
  57. data/vendored/puppet/lib/puppet/functions/downcase.rb +89 -0
  58. data/vendored/puppet/lib/puppet/functions/each.rb +2 -2
  59. data/vendored/puppet/lib/puppet/functions/empty.rb +1 -3
  60. data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
  61. data/vendored/puppet/lib/puppet/functions/filter.rb +2 -2
  62. data/vendored/puppet/lib/puppet/functions/floor.rb +37 -0
  63. data/vendored/puppet/lib/puppet/functions/get.rb +150 -0
  64. data/vendored/puppet/lib/puppet/functions/getvar.rb +87 -0
  65. data/vendored/puppet/lib/puppet/functions/hiera.rb +5 -5
  66. data/vendored/puppet/lib/puppet/functions/hiera_array.rb +5 -5
  67. data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
  68. data/vendored/puppet/lib/puppet/functions/hiera_include.rb +7 -7
  69. data/vendored/puppet/lib/puppet/functions/hocon_data.rb +1 -1
  70. data/vendored/puppet/lib/puppet/functions/json_data.rb +3 -3
  71. data/vendored/puppet/lib/puppet/functions/lest.rb +1 -1
  72. data/vendored/puppet/lib/puppet/functions/lookup.rb +3 -2
  73. data/vendored/puppet/lib/puppet/functions/lstrip.rb +58 -0
  74. data/vendored/puppet/lib/puppet/functions/map.rb +1 -1
  75. data/vendored/puppet/lib/puppet/functions/match.rb +11 -0
  76. data/vendored/puppet/lib/puppet/functions/max.rb +183 -0
  77. data/vendored/puppet/lib/puppet/functions/min.rb +182 -0
  78. data/vendored/puppet/lib/puppet/functions/next.rb +1 -8
  79. data/vendored/puppet/lib/puppet/functions/reduce.rb +1 -1
  80. data/vendored/puppet/lib/puppet/functions/return.rb +1 -8
  81. data/vendored/puppet/lib/puppet/functions/reverse_each.rb +1 -1
  82. data/vendored/puppet/lib/puppet/functions/round.rb +24 -0
  83. data/vendored/puppet/lib/puppet/functions/rstrip.rb +58 -0
  84. data/vendored/puppet/lib/puppet/functions/size.rb +15 -0
  85. data/vendored/puppet/lib/puppet/functions/sort.rb +74 -0
  86. data/vendored/puppet/lib/puppet/functions/step.rb +1 -1
  87. data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -7
  88. data/vendored/puppet/lib/puppet/functions/strip.rb +58 -0
  89. data/vendored/puppet/lib/puppet/functions/then.rb +1 -1
  90. data/vendored/puppet/lib/puppet/functions/tree_each.rb +7 -7
  91. data/vendored/puppet/lib/puppet/functions/upcase.rb +89 -0
  92. data/vendored/puppet/lib/puppet/functions/with.rb +4 -4
  93. data/vendored/puppet/lib/puppet/functions/yaml_data.rb +4 -2
  94. data/vendored/puppet/lib/puppet/graph/simple_graph.rb +9 -5
  95. data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/rest.rb +0 -11
  96. data/vendored/puppet/lib/puppet/indirector/indirection.rb +8 -12
  97. data/vendored/puppet/lib/puppet/indirector/node/exec.rb +1 -1
  98. data/vendored/puppet/lib/puppet/indirector/node/ldap.rb +1 -1
  99. data/vendored/puppet/lib/puppet/indirector/request.rb +11 -11
  100. data/vendored/puppet/lib/puppet/indirector/rest.rb +11 -11
  101. data/vendored/puppet/lib/puppet/interface/action.rb +2 -5
  102. data/vendored/puppet/lib/puppet/metatype/manager.rb +0 -2
  103. data/vendored/puppet/lib/puppet/module.rb +7 -33
  104. data/vendored/puppet/lib/puppet/module/task.rb +0 -1
  105. data/vendored/puppet/lib/puppet/module_tool.rb +2 -5
  106. data/vendored/puppet/lib/puppet/module_tool/applications/application.rb +5 -5
  107. data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +2 -2
  108. data/vendored/puppet/lib/puppet/module_tool/applications/checksummer.rb +3 -3
  109. data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +6 -7
  110. data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +1 -2
  111. data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +2 -2
  112. data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +5 -6
  113. data/vendored/puppet/lib/puppet/module_tool/dependency.rb +1 -1
  114. data/vendored/puppet/lib/puppet/module_tool/installed_modules.rb +2 -2
  115. data/vendored/puppet/lib/puppet/module_tool/local_tarball.rb +3 -3
  116. data/vendored/puppet/lib/puppet/module_tool/metadata.rb +3 -4
  117. data/vendored/puppet/lib/puppet/module_tool/shared_behaviors.rb +2 -2
  118. data/vendored/puppet/lib/puppet/network/authconfig.rb +0 -13
  119. data/vendored/puppet/lib/puppet/network/format_support.rb +1 -1
  120. data/vendored/puppet/lib/puppet/network/formats.rb +5 -7
  121. data/vendored/puppet/lib/puppet/network/http.rb +0 -2
  122. data/vendored/puppet/lib/puppet/network/http/api.rb +1 -10
  123. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +2 -2
  124. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environments.rb +2 -2
  125. data/vendored/puppet/lib/puppet/network/http/compression.rb +1 -1
  126. data/vendored/puppet/lib/puppet/network/http/connection.rb +11 -3
  127. data/vendored/puppet/lib/puppet/network/http/error.rb +3 -3
  128. data/vendored/puppet/lib/puppet/network/http/factory.rb +3 -0
  129. data/vendored/puppet/lib/puppet/network/http/handler.rb +59 -27
  130. data/vendored/puppet/lib/puppet/network/resolver.rb +140 -67
  131. data/vendored/puppet/lib/puppet/node/environment.rb +2 -19
  132. data/vendored/puppet/lib/puppet/parameter.rb +12 -7
  133. data/vendored/puppet/lib/puppet/parser/ast.rb +4 -8
  134. data/vendored/puppet/lib/puppet/parser/ast/branch.rb +3 -3
  135. data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +5 -0
  136. data/vendored/puppet/lib/puppet/parser/ast/pops_bridge.rb +18 -0
  137. data/vendored/puppet/lib/puppet/parser/compiler.rb +3 -4
  138. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +9 -2
  139. data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
  140. data/vendored/puppet/lib/puppet/parser/functions/assert_type.rb +3 -3
  141. data/vendored/puppet/lib/puppet/parser/functions/create_resources.rb +1 -7
  142. data/vendored/puppet/lib/puppet/parser/functions/each.rb +2 -2
  143. data/vendored/puppet/lib/puppet/parser/functions/filter.rb +1 -1
  144. data/vendored/puppet/lib/puppet/parser/functions/hiera.rb +4 -4
  145. data/vendored/puppet/lib/puppet/parser/functions/hiera_array.rb +5 -5
  146. data/vendored/puppet/lib/puppet/parser/functions/hiera_hash.rb +6 -6
  147. data/vendored/puppet/lib/puppet/parser/functions/hiera_include.rb +10 -11
  148. data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -1
  149. data/vendored/puppet/lib/puppet/parser/functions/lest.rb +1 -1
  150. data/vendored/puppet/lib/puppet/parser/functions/lookup.rb +1 -1
  151. data/vendored/puppet/lib/puppet/parser/functions/map.rb +1 -1
  152. data/vendored/puppet/lib/puppet/parser/functions/reduce.rb +1 -1
  153. data/vendored/puppet/lib/puppet/parser/functions/return.rb +22 -1
  154. data/vendored/puppet/lib/puppet/parser/functions/reverse_each.rb +1 -1
  155. data/vendored/puppet/lib/puppet/parser/functions/step.rb +1 -1
  156. data/vendored/puppet/lib/puppet/parser/functions/then.rb +1 -1
  157. data/vendored/puppet/lib/puppet/parser/functions/with.rb +4 -4
  158. data/vendored/puppet/lib/puppet/parser/resource.rb +0 -1
  159. data/vendored/puppet/lib/puppet/parser/resource/param.rb +12 -5
  160. data/vendored/puppet/lib/puppet/parser/scope.rb +5 -7
  161. data/vendored/puppet/lib/puppet/pops/evaluator/compare_operator.rb +3 -1
  162. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +2 -7
  163. data/vendored/puppet/lib/puppet/pops/issues.rb +4 -0
  164. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
  165. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +17 -12
  166. data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +73 -45
  167. data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +55 -6
  168. data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +2 -0
  169. data/vendored/puppet/lib/puppet/pops/parser/epp_parser.rb +1 -1
  170. data/vendored/puppet/lib/puppet/pops/parser/epp_support.rb +6 -2
  171. data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +1 -1
  172. data/vendored/puppet/lib/puppet/pops/pcore.rb +7 -7
  173. data/vendored/puppet/lib/puppet/pops/puppet_stack.rb +15 -1
  174. data/vendored/puppet/lib/puppet/pops/serialization.rb +2 -2
  175. data/vendored/puppet/lib/puppet/pops/serialization/from_data_converter.rb +2 -2
  176. data/vendored/puppet/lib/puppet/pops/serialization/json.rb +7 -7
  177. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +5 -5
  178. data/vendored/puppet/lib/puppet/pops/types/types.rb +8 -4
  179. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +73 -0
  180. data/vendored/puppet/lib/puppet/pops/validation/validator_factory_4_0.rb +4 -3
  181. data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +7 -0
  182. data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -1
  183. data/vendored/puppet/lib/puppet/provider/user/aix.rb +2 -2
  184. data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +21 -9
  185. data/vendored/puppet/lib/puppet/reference/providers.rb +1 -1
  186. data/vendored/puppet/lib/puppet/reference/report.rb +1 -1
  187. data/vendored/puppet/lib/puppet/resource.rb +1 -1
  188. data/vendored/puppet/lib/puppet/resource/capability_finder.rb +4 -4
  189. data/vendored/puppet/lib/puppet/resource/catalog.rb +6 -3
  190. data/vendored/puppet/lib/puppet/resource/type.rb +6 -2
  191. data/vendored/puppet/lib/puppet/rest/client.rb +79 -0
  192. data/vendored/puppet/lib/puppet/rest/errors.rb +14 -0
  193. data/vendored/puppet/lib/puppet/rest/response.rb +29 -0
  194. data/vendored/puppet/lib/puppet/rest/route.rb +102 -0
  195. data/vendored/puppet/lib/puppet/rest/routes.rb +31 -0
  196. data/vendored/puppet/lib/puppet/settings.rb +9 -5
  197. data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
  198. data/vendored/puppet/lib/puppet/settings/environment_conf.rb +10 -1
  199. data/vendored/puppet/lib/puppet/ssl.rb +0 -1
  200. data/vendored/puppet/lib/puppet/ssl/certificate.rb +6 -2
  201. data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +3 -3
  202. data/vendored/puppet/lib/puppet/ssl/host.rb +258 -19
  203. data/vendored/puppet/lib/puppet/ssl/validator/default_validator.rb +33 -19
  204. data/vendored/puppet/lib/puppet/syntax_checkers/json.rb +1 -1
  205. data/vendored/puppet/lib/puppet/transaction/event.rb +34 -7
  206. data/vendored/puppet/lib/puppet/transaction/report.rb +17 -14
  207. data/vendored/puppet/lib/puppet/type.rb +20 -12
  208. data/vendored/puppet/lib/puppet/type/file.rb +1 -1
  209. data/vendored/puppet/lib/puppet/type/file/content.rb +15 -2
  210. data/vendored/puppet/lib/puppet/type/file/ensure.rb +1 -1
  211. data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
  212. data/vendored/puppet/lib/puppet/type/stage.rb +1 -1
  213. data/vendored/puppet/lib/puppet/type/tidy.rb +5 -1
  214. data/vendored/puppet/lib/puppet/type/user.rb +35 -18
  215. data/vendored/puppet/lib/puppet/type/yumrepo.rb +8 -17
  216. data/vendored/puppet/lib/puppet/util.rb +0 -1
  217. data/vendored/puppet/lib/puppet/util/autoload.rb +1 -6
  218. data/vendored/puppet/lib/puppet/util/checksums.rb +0 -2
  219. data/vendored/puppet/lib/puppet/util/classgen.rb +0 -6
  220. data/vendored/puppet/lib/puppet/util/fileparsing.rb +27 -5
  221. data/vendored/puppet/lib/puppet/util/instance_loader.rb +3 -3
  222. data/vendored/puppet/lib/puppet/util/json.rb +77 -0
  223. data/vendored/puppet/lib/puppet/util/json_lockfile.rb +3 -3
  224. data/vendored/puppet/lib/puppet/util/ldap/connection.rb +7 -7
  225. data/vendored/puppet/lib/puppet/util/log/destinations.rb +2 -2
  226. data/vendored/puppet/lib/puppet/util/logging.rb +1 -1
  227. data/vendored/puppet/lib/puppet/util/plist.rb +1 -1
  228. data/vendored/puppet/lib/puppet/util/provider_features.rb +2 -5
  229. data/vendored/puppet/lib/puppet/util/reference.rb +5 -4
  230. data/vendored/puppet/lib/puppet/util/tagging.rb +16 -3
  231. data/vendored/puppet/lib/puppet/version.rb +1 -1
  232. metadata +44 -26
  233. data/vendored/puppet/lib/puppet/application/master.rb +0 -317
  234. data/vendored/puppet/lib/puppet/feature/rack.rb +0 -19
  235. data/vendored/puppet/lib/puppet/network/http/api/ca.rb +0 -2
  236. data/vendored/puppet/lib/puppet/network/http/api/ca/v1.rb +0 -11
  237. data/vendored/puppet/lib/puppet/network/http/rack.rb +0 -33
  238. data/vendored/puppet/lib/puppet/network/http/rack/rest.rb +0 -162
  239. data/vendored/puppet/lib/puppet/network/http/webrick.rb +0 -124
  240. data/vendored/puppet/lib/puppet/network/http/webrick/rest.rb +0 -114
  241. data/vendored/puppet/lib/puppet/network/server.rb +0 -39
  242. data/vendored/puppet/lib/puppet/ssl/configuration.rb +0 -61
  243. data/vendored/puppet/lib/puppet/util/methodhelper.rb +0 -32
  244. data/vendored/puppet/lib/puppet/vendor/load_semantic.rb +0 -1
  245. data/vendored/puppet/lib/puppet/vendor/load_semantic_puppet.rb +0 -1
  246. data/vendored/puppet/lib/puppet/vendor/semantic/lib/semantic.rb +0 -5
  247. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +0 -11
  248. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency.rb +0 -181
  249. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph.rb +0 -60
  250. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph_node.rb +0 -117
  251. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/module_release.rb +0 -58
  252. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/source.rb +0 -25
  253. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/unsatisfiable_graph.rb +0 -31
  254. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/gem_version.rb +0 -3
  255. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +0 -203
  256. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +0 -758
@@ -1,39 +0,0 @@
1
- require 'puppet/network/http'
2
- require 'puppet/network/http/webrick'
3
-
4
- #
5
- # @api private
6
- class Puppet::Network::Server
7
- attr_reader :address, :port
8
-
9
- def initialize(address, port)
10
- @port = port
11
- @address = address
12
- @http_server = Puppet::Network::HTTP::WEBrick.new
13
-
14
- @listening = false
15
-
16
- # Make sure we have all of the directories we need to function.
17
- Puppet.settings.use(:main, :ssl, :application)
18
- end
19
-
20
- def listening?
21
- @listening
22
- end
23
-
24
- def start
25
- raise _("Cannot listen -- already listening.") if listening?
26
- @listening = true
27
- @http_server.listen(address, port)
28
- end
29
-
30
- def stop
31
- raise _("Cannot unlisten -- not currently listening.") unless listening?
32
- @http_server.unlisten
33
- @listening = false
34
- end
35
-
36
- def wait_for_shutdown
37
- @http_server.wait_for_shutdown
38
- end
39
- end
@@ -1,61 +0,0 @@
1
- require 'puppet/ssl'
2
- require 'openssl'
3
- module Puppet
4
- module SSL
5
- # Puppet::SSL::Configuration is intended to separate out the following concerns:
6
- # * CA certificates that authenticate peers (ca_auth_file)
7
- # * Who clients trust as distinct from who servers trust. We should not
8
- # assume one single self signed CA cert for everyone.
9
- class Configuration
10
- def initialize(localcacert, options={})
11
- @localcacert = localcacert
12
- @ca_auth_file = options[:ca_auth_file]
13
- end
14
-
15
- # @deprecated Use {#ca_auth_file} instead.
16
- def ca_chain_file
17
- ca_auth_file
18
- end
19
-
20
- # The ca_auth_file method is intended to return the PEM bundle of CA certs
21
- # used to authenticate peer connections.
22
- def ca_auth_file
23
- @ca_auth_file || @localcacert
24
- end
25
-
26
- ##
27
- # ca_auth_certificates returns an Array of OpenSSL::X509::Certificate
28
- # instances intended to be used in the connection verify_callback. This
29
- # method loads and parses the {#ca_auth_file} from the filesystem.
30
- #
31
- # @api private
32
- #
33
- # @return [Array<OpenSSL::X509::Certificate>]
34
- def ca_auth_certificates
35
- @ca_auth_certificates ||= decode_cert_bundle(read_file(ca_auth_file))
36
- end
37
-
38
- ##
39
- # Decode a string of concatenated certificates
40
- #
41
- # @return [Array<OpenSSL::X509::Certificate>]
42
- def decode_cert_bundle(bundle_str)
43
- re = /-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m
44
- pem_ary = bundle_str.scan(re)
45
- pem_ary.map do |pem_str|
46
- OpenSSL::X509::Certificate.new(pem_str)
47
- end
48
- end
49
- private :decode_cert_bundle
50
-
51
- # read_file makes testing easier.
52
- def read_file(path)
53
- # https://www.ietf.org/rfc/rfc2459.txt defines the x509 V3 certificate format
54
- # CA bundles are concatenated X509 certificates, but may also include
55
- # comments, which could have UTF-8 characters
56
- Puppet::FileSystem.read(path, :encoding => Encoding::UTF_8)
57
- end
58
- private :read_file
59
- end
60
- end
61
- end
@@ -1,32 +0,0 @@
1
- # Where we store helper methods related to, um, methods.
2
- module Puppet::Util::MethodHelper
3
- def requiredopts(*names)
4
- names.each do |name|
5
- devfail("#{name} is a required option for #{self.class}") if self.send(name).nil?
6
- end
7
- end
8
-
9
- # Iterate over a hash, treating each member as an attribute.
10
- def set_options(options)
11
- options.each do |param,value|
12
- method = param.to_s + "="
13
- if respond_to? method
14
- self.send(method, value)
15
- else
16
- raise ArgumentError, _("Invalid parameter %{parameter} to object class %{class_name}") % { parameter: param, class_name: self.class }
17
- end
18
- end
19
- end
20
-
21
- # Take a hash and convert all of the keys to symbols if possible.
22
- def symbolize_options(options)
23
- options.inject({}) do |hash, opts|
24
- if opts[0].respond_to? :intern
25
- hash[opts[0].intern] = opts[1]
26
- else
27
- hash[opts[0]] = opts[1]
28
- end
29
- hash
30
- end
31
- end
32
- end
@@ -1 +0,0 @@
1
- $: << File.join([File.dirname(__FILE__), "semantic/lib"])
@@ -1 +0,0 @@
1
- $: << File.join([File.dirname(__FILE__), "semantic_puppet/lib"])
@@ -1,5 +0,0 @@
1
- require 'puppet/vendor/semantic_puppet/lib/semantic_puppet'
2
-
3
- $stderr.puts "Warning: Puppet's internal vendored libraries are Private APIs and can change without warning. The 'semantic' library has been replaced with 'semantic_puppet'."
4
-
5
- Semantic = SemanticPuppet
@@ -1,11 +0,0 @@
1
- module SemanticPuppet
2
- locales_path = File.absolute_path('../locales', File.dirname(__FILE__))
3
- # Only create a translation repository of the relevant translations exist
4
- if Puppet::FileSystem.exist?(File.join(locales_path, Puppet::GettextConfig.current_locale))
5
- Puppet::GettextConfig.load_translations('semantic_puppet', locales_path, :po)
6
- end
7
-
8
- autoload :Version, 'semantic_puppet/version'
9
- autoload :VersionRange, 'semantic_puppet/version_range'
10
- autoload :Dependency, 'semantic_puppet/dependency'
11
- end
@@ -1,181 +0,0 @@
1
- require 'semantic_puppet'
2
-
3
- module SemanticPuppet
4
- module Dependency
5
- extend self
6
-
7
- autoload :Graph, 'semantic_puppet/dependency/graph'
8
- autoload :GraphNode, 'semantic_puppet/dependency/graph_node'
9
- autoload :ModuleRelease, 'semantic_puppet/dependency/module_release'
10
- autoload :Source, 'semantic_puppet/dependency/source'
11
-
12
- autoload :UnsatisfiableGraph, 'semantic_puppet/dependency/unsatisfiable_graph'
13
-
14
- # @!group Sources
15
-
16
- # @return [Array<Source>] a frozen copy of the {Source} list
17
- def sources
18
- (@sources ||= []).dup.freeze
19
- end
20
-
21
- # Appends a new {Source} to the current list.
22
- # @param source [Source] the {Source} to add
23
- # @return [void]
24
- def add_source(source)
25
- sources
26
- @sources << source
27
- nil
28
- end
29
-
30
- # Clears the current list of {Source}s.
31
- # @return [void]
32
- def clear_sources
33
- sources
34
- @sources.clear
35
- nil
36
- end
37
-
38
- # @!endgroup
39
-
40
- # Fetches a graph of modules and their dependencies from the currently
41
- # configured list of {Source}s.
42
- #
43
- # @todo Return a specialized "Graph" object.
44
- # @todo Allow for external constraints to be added to the graph.
45
- # @see #sources
46
- # @see #add_source
47
- # @see #clear_sources
48
- #
49
- # @param modules [{ String => String }]
50
- # @return [Graph] the root of a dependency graph
51
- def query(modules)
52
- constraints = Hash[modules.map { |k, v| [ k, VersionRange.parse(v) ] }]
53
-
54
- graph = Graph.new(constraints)
55
- fetch_dependencies(graph)
56
- return graph
57
- end
58
-
59
- # Given a graph result from {#query}, this method will resolve the graph of
60
- # dependencies, if possible, into a flat list of the best suited modules. If
61
- # the dependency graph does not have a suitable resolution, this method will
62
- # raise an exception to that effect.
63
- #
64
- # @param graph [Graph] the root of a dependency graph
65
- # @return [Array<ModuleRelease>] the list of releases to act on
66
- def resolve(graph)
67
- catch :next do
68
- return walk(graph, graph.dependencies.dup)
69
- end
70
- raise UnsatisfiableGraph.new(graph)
71
- end
72
-
73
- # Fetches all available releases for the given module name.
74
- #
75
- # @param name [String] the module name to find releases for
76
- # @return [Array<ModuleRelease>] the available releases
77
- def fetch_releases(name)
78
- releases = {}
79
-
80
- sources.each do |source|
81
- source.fetch(name).each do |dependency|
82
- releases[dependency.version] ||= dependency
83
- end
84
- end
85
-
86
- return releases.values
87
- end
88
-
89
- private
90
-
91
- # Iterates over a changing set of dependencies in search of the best
92
- # solution available. Fitness is specified as meeting all the constraints
93
- # placed on it, being {ModuleRelease#satisfied? satisfied}, and having the
94
- # greatest version number (with stability being preferred over prereleases).
95
- #
96
- # @todo Traversal order is not presently guaranteed.
97
- #
98
- # @param graph [Graph] the root of a dependency graph
99
- # @param dependencies [{ String => Array<ModuleRelease> }] the dependencies
100
- # @param considering [Array<GraphNode>] the set of releases being tested
101
- # @return [Array<GraphNode>] the list of releases to use, if successful
102
- def walk(graph, dependencies, *considering)
103
- return considering if dependencies.empty?
104
-
105
- # Selecting a dependency from the collection...
106
- name = dependencies.keys.sort.first
107
- deps = dependencies.delete(name)
108
-
109
- # ... (and stepping over it if we've seen it before) ...
110
- unless (deps & considering).empty?
111
- return walk(graph, dependencies, *considering)
112
- end
113
-
114
- # ... we'll iterate through the list of possible versions in order.
115
- preferred_releases(deps).reverse_each do |dep|
116
-
117
- # We should skip any releases that violate any module's constraints.
118
- unless [graph, *considering].all? { |x| x.satisfies_constraints?(dep) }
119
- next
120
- end
121
-
122
- # We should skip over any releases that violate graph-level constraints.
123
- potential_solution = considering.dup << dep
124
- unless graph.satisfies_graph? potential_solution
125
- next
126
- end
127
-
128
- catch :next do
129
- # After adding any new dependencies and imposing our own constraints
130
- # on existing dependencies, we'll mark ourselves as "under
131
- # consideration" and recurse.
132
- merged = dependencies.merge(dep.dependencies) { |_,a,b| a & b }
133
-
134
- # If all subsequent dependencies resolved well, the recursive call
135
- # will return a completed dependency list. If there were problems
136
- # resolving our dependencies, we'll catch `:next`, which will cause
137
- # us to move to the next possibility.
138
- return walk(graph, merged, *potential_solution)
139
- end
140
- end
141
-
142
- # Once we've exhausted all of our possible versions, we know that our
143
- # last choice was unusable, so we'll unwind the stack and make a new
144
- # choice.
145
- throw :next
146
- end
147
-
148
- # Given a {ModuleRelease}, this method will iterate through the current
149
- # list of {Source}s to find the complete list of versions available for its
150
- # dependencies.
151
- #
152
- # @param node [GraphNode] the node to fetch details for
153
- # @return [void]
154
- def fetch_dependencies(node, cache = {})
155
- node.dependency_names.each do |name|
156
- unless cache.key?(name)
157
- cache[name] = fetch_releases(name)
158
- cache[name].each { |dep| fetch_dependencies(dep, cache) }
159
- end
160
-
161
- node << cache[name]
162
- end
163
- end
164
-
165
- # Given a list of potential releases, this method returns the most suitable
166
- # releases for exploration. Only {ModuleRelease#satisfied? satisfied}
167
- # releases are considered, and releases with stable versions are preferred.
168
- #
169
- # @param releases [Array<ModuleRelease>] a list of potential releases
170
- # @return [Array<ModuleRelease>] releases open for consideration
171
- def preferred_releases(releases)
172
- satisfied = releases.select { |x| x.satisfied? }
173
-
174
- if satisfied.any? { |x| x.version.stable? }
175
- return satisfied.select { |x| x.version.stable? }
176
- else
177
- return satisfied
178
- end
179
- end
180
- end
181
- end
@@ -1,60 +0,0 @@
1
- require 'semantic_puppet/dependency'
2
-
3
- module SemanticPuppet
4
- module Dependency
5
- class Graph
6
- include GraphNode
7
-
8
- attr_reader :modules
9
-
10
- # Create a new instance of a dependency graph.
11
- #
12
- # @param modules [{String => VersionRange}] the required module
13
- # set and their version constraints
14
- def initialize(modules = {})
15
- @modules = modules.keys
16
-
17
- modules.each do |name, range|
18
- add_constraint('initialize', name, range.to_s) do |node|
19
- range === node.version
20
- end
21
-
22
- add_dependency(name)
23
- end
24
- end
25
-
26
- # Constrains graph solutions based on the given block. Graph constraints
27
- # are used to describe fundamental truths about the tooling or module
28
- # system (e.g.: module names contain a namespace component which is
29
- # dropped during install, so module names must be unique excluding the
30
- # namespace).
31
- #
32
- # @example Ensuring a single source for all modules
33
- # @graph.add_constraint('installed', mod.name) do |nodes|
34
- # nodes.count { |node| node.source } == 1
35
- # end
36
- #
37
- # @see #considering_solution?
38
- #
39
- # @param source [String, Symbol] a name describing the source of the
40
- # constraint
41
- # @yieldparam nodes [Array<GraphNode>] the nodes to test the constraint
42
- # against
43
- # @yieldreturn [Boolean] whether the node passed the constraint
44
- # @return [void]
45
- def add_graph_constraint(source, &block)
46
- constraints[:graph] << [ source, block ]
47
- end
48
-
49
- # Checks the proposed solution (or partial solution) against the graph's
50
- # constraints.
51
- #
52
- # @see #add_graph_constraint
53
- #
54
- # @return [Boolean] true if none of the graph constraints are violated
55
- def satisfies_graph?(solution)
56
- constraints[:graph].all? { |_, check| check[solution] }
57
- end
58
- end
59
- end
60
- end
@@ -1,117 +0,0 @@
1
- require 'semantic_puppet/dependency'
2
- require 'set'
3
-
4
- module SemanticPuppet
5
- module Dependency
6
- module GraphNode
7
- include Comparable
8
-
9
- def name
10
- end
11
-
12
- # Determines whether the modules dependencies are satisfied by the known
13
- # releases.
14
- #
15
- # @return [Boolean] true if all dependencies are satisfied
16
- def satisfied?
17
- dependencies.none? { |_, v| v.empty? }
18
- end
19
-
20
- def children
21
- @_children ||= {}
22
- end
23
-
24
- def populate_children(nodes)
25
- if children.empty?
26
- nodes = nodes.select { |node| satisfies_dependency?(node) }
27
- nodes.each do |node|
28
- children[node.name] = node
29
- node.populate_children(nodes)
30
- end
31
- self.freeze
32
- end
33
- end
34
-
35
- # @api internal
36
- # @return [{ String => SortedSet<GraphNode> }] the satisfactory
37
- # dependency nodes
38
- def dependencies
39
- @_dependencies ||= Hash.new { |h, k| h[k] = SortedSet.new }
40
- end
41
-
42
- # Adds the given dependency name to the list of dependencies.
43
- #
44
- # @param name [String] the dependency name
45
- # @return [void]
46
- def add_dependency(name)
47
- dependencies[name]
48
- end
49
-
50
- # @return [Array<String>] the list of dependency names
51
- def dependency_names
52
- dependencies.keys
53
- end
54
-
55
- def constraints
56
- @_constraints ||= Hash.new { |h, k| h[k] = [] }
57
- end
58
-
59
- def constraints_for(name)
60
- return [] unless constraints.has_key?(name)
61
-
62
- constraints[name].map do |constraint|
63
- {
64
- :source => constraint[0],
65
- :description => constraint[1],
66
- :test => constraint[2],
67
- }
68
- end
69
- end
70
-
71
- # Constrains the named module to suitable releases, as determined by the
72
- # given block.
73
- #
74
- # @example Version-locking currently installed modules
75
- # installed_modules.each do |m|
76
- # @graph.add_constraint('installed', m.name, m.version) do |node|
77
- # m.version == node.version
78
- # end
79
- # end
80
- #
81
- # @param source [String, Symbol] a name describing the source of the
82
- # constraint
83
- # @param mod [String] the name of the module
84
- # @param desc [String] a description of the enforced constraint
85
- # @yieldparam node [GraphNode] the node to test the constraint against
86
- # @yieldreturn [Boolean] whether the node passed the constraint
87
- # @return [void]
88
- def add_constraint(source, mod, desc, &block)
89
- constraints["#{mod}"] << [ source, desc, block ]
90
- end
91
-
92
- def satisfies_dependency?(node)
93
- dependencies.key?(node.name) && satisfies_constraints?(node)
94
- end
95
-
96
- # @param release [ModuleRelease] the release to test
97
- def satisfies_constraints?(release)
98
- constraints_for(release.name).all? { |x| x[:test].call(release) }
99
- end
100
-
101
- def << (nodes)
102
- Array(nodes).each do |node|
103
- next unless dependencies.key?(node.name)
104
- if satisfies_dependency?(node)
105
- dependencies[node.name] << node
106
- end
107
- end
108
-
109
- return self
110
- end
111
-
112
- def <=>(other)
113
- name <=> other.name
114
- end
115
- end
116
- end
117
- end