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
@@ -15,7 +15,7 @@ module DOT
15
15
 
16
16
  # if we don't like 4 spaces, we can change it any time
17
17
 
18
- def change_tab (t)
18
+ def change_tab(t)
19
19
  $tab = t
20
20
  $tab2 = t * 2
21
21
  end
@@ -118,7 +118,7 @@ module DOT
118
118
 
119
119
  attr_accessor :name
120
120
 
121
- def initialize (params = {})
121
+ def initialize(params = {})
122
122
  @label = params['name'] ? params['name'] : ''
123
123
  end
124
124
 
@@ -134,7 +134,7 @@ module DOT
134
134
  # attr_reader :parent
135
135
  attr_accessor :name, :options
136
136
 
137
- def initialize (params = {}, option_list = [])
137
+ def initialize(params = {}, option_list = [])
138
138
  super(params)
139
139
  @name = params['name'] ? params['name'] : nil
140
140
  @parent = params['parent'] ? params['parent'] : nil
@@ -168,7 +168,7 @@ module DOT
168
168
 
169
169
  attr_accessor :label
170
170
 
171
- def initialize (params = {})
171
+ def initialize(params = {})
172
172
  super(params)
173
173
  @name = params['label'] ? params['label'] : ''
174
174
  end
@@ -181,7 +181,7 @@ module DOT
181
181
  # node element
182
182
 
183
183
  class DOTNode < DOTElement
184
- def initialize (params = {}, option_list = NODE_OPTS)
184
+ def initialize(params = {}, option_list = NODE_OPTS)
185
185
  super(params, option_list)
186
186
  @ports = params['ports'] ? params['ports'] : []
187
187
  end
@@ -190,11 +190,11 @@ module DOT
190
190
  @ports.each { |i| yield i }
191
191
  end
192
192
 
193
- def << (thing)
193
+ def <<(thing)
194
194
  @ports << thing
195
195
  end
196
196
 
197
- def push (thing)
197
+ def push(thing)
198
198
  @ports.push(thing)
199
199
  end
200
200
 
@@ -202,16 +202,16 @@ module DOT
202
202
  @ports.pop
203
203
  end
204
204
 
205
- def to_s (t = '')
205
+ def to_s(t = '')
206
206
 
207
207
  # This code is totally incomprehensible; it needs to be replaced!
208
208
 
209
209
  label = @options['shape'] != 'record' && @ports.length == 0 ?
210
210
  @options['label'] ?
211
- t + $tab + "label = \"#{@options['label']}\"\n" :
211
+ t + $tab + "label = #{stringify(@options['label'])}\n" :
212
212
  '' :
213
213
  t + $tab + 'label = "' + " \\\n" +
214
- t + $tab2 + "#{@options['label']}| \\\n" +
214
+ t + $tab2 + "#{stringify(@options['label'])}| \\\n" +
215
215
  @ports.collect{ |i|
216
216
  t + $tab2 + i.to_s
217
217
  }.join( "| \\\n" ) + " \\\n" +
@@ -226,13 +226,19 @@ module DOT
226
226
  t + "]\n"
227
227
  end
228
228
 
229
+ private
230
+
231
+ def stringify(s)
232
+ %("#{s.gsub('"', '\\"')}")
233
+ end
234
+
229
235
  end
230
236
 
231
237
  # A subgraph element is the same to graph, but has another header in dot
232
238
  # notation.
233
239
 
234
240
  class DOTSubgraph < DOTElement
235
- def initialize (params = {}, option_list = GRAPH_OPTS)
241
+ def initialize(params = {}, option_list = GRAPH_OPTS)
236
242
  super(params, option_list)
237
243
  @nodes = params['nodes'] ? params['nodes'] : []
238
244
  @dot_string = 'graph'
@@ -242,11 +248,11 @@ module DOT
242
248
  @nodes.each{ |i| yield i }
243
249
  end
244
250
 
245
- def << (thing)
251
+ def <<(thing)
246
252
  @nodes << thing
247
253
  end
248
254
 
249
- def push (thing)
255
+ def push(thing)
250
256
  @nodes.push( thing )
251
257
  end
252
258
 
@@ -254,7 +260,7 @@ module DOT
254
260
  @nodes.pop
255
261
  end
256
262
 
257
- def to_s (t = '')
263
+ def to_s(t = '')
258
264
  hdr = t + "#{@dot_string} #{@name} {\n"
259
265
 
260
266
  options = @options.to_a.collect{ |name, val|
@@ -275,7 +281,7 @@ module DOT
275
281
 
276
282
  class DOTDigraph < DOTSubgraph
277
283
 
278
- def initialize (params = {}, option_list = GRAPH_OPTS)
284
+ def initialize(params = {}, option_list = GRAPH_OPTS)
279
285
  super(params, option_list)
280
286
  @dot_string = 'digraph'
281
287
  end
@@ -288,7 +294,7 @@ module DOT
288
294
 
289
295
  attr_accessor :from, :to
290
296
 
291
- def initialize (params = {}, option_list = EDGE_OPTS)
297
+ def initialize(params = {}, option_list = EDGE_OPTS)
292
298
  super(params, option_list)
293
299
  @from = params['from'] ? params['from'] : nil
294
300
  @to = params['to'] ? params['to'] : nil
@@ -298,7 +304,7 @@ module DOT
298
304
  '--'
299
305
  end
300
306
 
301
- def to_s (t = '')
307
+ def to_s(t = '')
302
308
  t + "#{@from} #{edge_link} #{to} [\n" +
303
309
  @options.to_a.collect{ |i|
304
310
  i[1] && i[0] != 'label' ?
@@ -2,6 +2,7 @@ require 'puppet/face'
2
2
  require 'puppet/settings/ini_file'
3
3
 
4
4
  Puppet::Face.define(:config, '0.0.1') do
5
+ extend Puppet::Util::Colors
5
6
  copyright "Puppet Inc.", 2011
6
7
  license _("Apache 2 license; see COPYING")
7
8
 
@@ -9,10 +10,12 @@ Puppet::Face.define(:config, '0.0.1') do
9
10
 
10
11
  description "This subcommand can inspect and modify settings from Puppet's
11
12
  'puppet.conf' configuration file. For documentation about individual settings,
12
- see https://docs.puppetlabs.com/puppet/latest/reference/configuration.html."
13
+ see https://puppet.com/docs/puppet/latest/configuration.html."
13
14
 
15
+ DEFAULT_SECTION_MARKER = Object.new
16
+ DEFAULT_SECTION = "main"
14
17
  option "--section " + _("SECTION_NAME") do
15
- default_to { "main" }
18
+ default_to { DEFAULT_SECTION_MARKER } #Sentinel object for default detection during commands
16
19
  summary _("The section of the configuration file to interact with.")
17
20
  description <<-EOT
18
21
  The section of the puppet.conf configuration file to interact with.
@@ -56,6 +59,13 @@ Puppet::Face.define(:config, '0.0.1') do
56
59
 
57
60
  when_invoked do |*args|
58
61
  options = args.pop
62
+
63
+ @default_section = false
64
+ if options[:section] == DEFAULT_SECTION_MARKER
65
+ options[:section] = DEFAULT_SECTION
66
+ @default_section = true
67
+ end
68
+
59
69
  render_all_settings = args.empty? || args == ['all']
60
70
 
61
71
  args = Puppet.settings.to_a.collect(&:first) if render_all_settings
@@ -75,6 +85,11 @@ Puppet::Face.define(:config, '0.0.1') do
75
85
  # the requested section
76
86
  values = Puppet.settings.values(Puppet[:environment].to_sym, options[:section].to_sym)
77
87
 
88
+ if Puppet::Util::Log.sendlevel?(:info)
89
+ warn_default_section(options[:section]) if @default_section
90
+ report_section_and_environment(options[:section], Puppet.settings[:environment])
91
+ end
92
+
78
93
  to_be_rendered = {}
79
94
  args.sort.each do |setting_name|
80
95
  to_be_rendered[setting_name] = values.print(setting_name.to_sym)
@@ -117,6 +132,25 @@ Puppet::Face.define(:config, '0.0.1') do
117
132
  newhash
118
133
  end
119
134
 
135
+ def warn_default_section(section_name)
136
+ messages = []
137
+ messages << _("No section specified; defaulting to '%{section_name}'.") %
138
+ { section_name: section_name }
139
+ #TRANSLATORS '--section' is a command line option and should not be translated
140
+ messages << _("Set the config section by using the `--section` flag.")
141
+ #TRANSLATORS `puppet config --section user print foo` is a command line example and should not be translated
142
+ messages << _("For example, `puppet config --section user print foo`.")
143
+ messages << _("For more information, see https://puppet.com/docs/puppet/latest/configuration.html")
144
+
145
+ Puppet.warning(messages.join("\n"))
146
+ end
147
+
148
+ def report_section_and_environment(section_name, environment_name)
149
+ $stderr.puts colorize(:hyellow,
150
+ _("Resolving settings from section '%{section_name}' in environment '%{environment_name}'") %
151
+ { section_name: section_name, environment_name: environment_name })
152
+ end
153
+
120
154
  action(:set) do
121
155
  summary _("Set Puppet's settings.")
122
156
  arguments _("[setting_name] [setting_value]")
@@ -139,6 +173,13 @@ Puppet::Face.define(:config, '0.0.1') do
139
173
  EOT
140
174
 
141
175
  when_invoked do |name, value, options|
176
+
177
+ @default_section = false
178
+ if options[:section] == DEFAULT_SECTION_MARKER
179
+ options[:section] = DEFAULT_SECTION
180
+ @default_section = true
181
+ end
182
+
142
183
  if name == 'environment' && options[:section] == 'main'
143
184
  Puppet.warning _(<<-EOM).chomp
144
185
  The environment should be set in either the `[user]`, `[agent]`, or `[master]`
@@ -152,6 +193,10 @@ https://puppet.com/docs/puppet/latest/configuration.html#environment
152
193
  EOM
153
194
  end
154
195
 
196
+ if Puppet::Util::Log.sendlevel?(:info)
197
+ report_section_and_environment(options[:section], Puppet.settings[:environment])
198
+ end
199
+
155
200
  path = Puppet::FileSystem.pathname(Puppet.settings.which_configuration_file)
156
201
  Puppet::FileSystem.touch(path)
157
202
  Puppet::FileSystem.open(path, nil, 'r+:UTF-8') do |file|
@@ -184,7 +229,12 @@ https://puppet.com/docs/puppet/latest/configuration.html#environment
184
229
  EOT
185
230
 
186
231
  when_invoked do |name, options|
187
- options[:section] = options[:section].to_s # If value was left as default - set to default string
232
+
233
+ @default_section = false
234
+ if options[:section] == DEFAULT_SECTION_MARKER
235
+ options[:section] = DEFAULT_SECTION
236
+ @default_section = true
237
+ end
188
238
 
189
239
  path = Puppet::FileSystem.pathname(Puppet.settings.which_configuration_file)
190
240
  if Puppet::FileSystem.exist?(path)
@@ -192,6 +242,11 @@ https://puppet.com/docs/puppet/latest/configuration.html#environment
192
242
  Puppet::Settings::IniFile.update(file) do |config|
193
243
  setting_string = config.delete(options[:section], name)
194
244
  if setting_string
245
+
246
+ if Puppet::Util::Log.sendlevel?(:info)
247
+ report_section_and_environment(options[:section], Puppet.settings[:environment])
248
+ end
249
+
195
250
  puts(_("Deleted setting from '%{section_name}': '%{setting_string}'") %
196
251
  { section_name: options[:section], name: name, setting_string: setting_string.strip })
197
252
  else
@@ -509,7 +509,7 @@ Puppet::Face.define(:epp, '0.0.1') do
509
509
  if fact_file.is_a?(Hash) # when used via the Face API
510
510
  given_facts = fact_file
511
511
  elsif fact_file.end_with?("json")
512
- given_facts = JSON.parse(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
512
+ given_facts = Puppet::Util::Json.load(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
513
513
  else
514
514
  given_facts = YAML.load(Puppet::FileSystem.read(fact_file, :encoding => 'utf-8'))
515
515
  end
@@ -7,7 +7,7 @@ Puppet::Face.define(:module, '1.0.0') do
7
7
  Note: Module build uses MD5 checksums, which are prohibited on FIPS enabled systems.
8
8
 
9
9
  This action uses the metadata.json file in the module directory to set metadata
10
- used by the Forge. See <https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html> for more
10
+ used by the Forge. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for more
11
11
  about writing metadata.json files.
12
12
 
13
13
  After being built, the release archive file can be found in the module's
@@ -44,11 +44,11 @@ Puppet::Face.define(:module, '1.0.0') do
44
44
  pwd = Dir.pwd
45
45
  module_path = Puppet::ModuleTool.find_module_root(pwd)
46
46
  if module_path.nil?
47
- raise _("Unable to find metadata.json in module root %{pwd} or parent directories. See <https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html> for required file format.") % { pwd: pwd }
47
+ raise _("Unable to find metadata.json in module root %{pwd} or parent directories. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for required file format.") % { pwd: pwd }
48
48
  end
49
49
  else
50
50
  unless Puppet::ModuleTool.is_module_root?(module_path)
51
- raise _("Unable to find metadata.json in module root %{module_path} or parent directories. See <https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html> for required file format.") % { module_path: module_path }
51
+ raise _("Unable to find metadata.json in module root %{module_path} or parent directories. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for required file format.") % { module_path: module_path }
52
52
  end
53
53
  end
54
54
 
@@ -120,10 +120,6 @@ Puppet::Face.define(:module, '1.0.0') do
120
120
  EOT
121
121
  end
122
122
 
123
- option '--strict-semver' do
124
- summary _('Whether version ranges should exclude pre-release versions')
125
- end
126
-
127
123
  when_invoked do |name, options|
128
124
  Puppet::ModuleTool.set_option_defaults options
129
125
  Puppet.notice _("Preparing to install into %{dir} ...") % { dir: options[:target_dir] }
@@ -17,10 +17,6 @@ Puppet::Face.define(:module, '1.0.0') do
17
17
  summary _("Whether to show dependencies as a tree view")
18
18
  end
19
19
 
20
- option '--strict-semver' do
21
- summary _('Whether version ranges should exclude pre-release versions')
22
- end
23
-
24
20
  examples <<-'EOT'
25
21
  List installed modules:
26
22
 
@@ -77,7 +73,6 @@ Puppet::Face.define(:module, '1.0.0') do
77
73
 
78
74
  output = ''
79
75
 
80
- environment.modules_strict_semver = !!options[:strict_semver]
81
76
  warn_unmet_dependencies(environment)
82
77
 
83
78
  environment.modulepath.each do |path|
@@ -23,7 +23,7 @@ Puppet::Face.define(:module, '1.0.0') do
23
23
 
24
24
  when_invoked do |term, options|
25
25
  Puppet::ModuleTool.set_option_defaults options
26
- Puppet::ModuleTool::Applications::Searcher.new(term, Puppet::Forge.new(options[:module_repository] || Puppet[:module_repository], options[:strict_semver]), options).run
26
+ Puppet::ModuleTool::Applications::Searcher.new(term, Puppet::Forge.new(options[:module_repository] || Puppet[:module_repository]), options).run
27
27
  end
28
28
 
29
29
  when_rendering :console do |results, term, options|
@@ -56,10 +56,6 @@ Puppet::Face.define(:module, '1.0.0') do
56
56
  EOT
57
57
  end
58
58
 
59
- option '--strict-semver' do
60
- summary _('Whether version ranges should exclude pre-release versions')
61
- end
62
-
63
59
  when_invoked do |name, options|
64
60
  name = name.gsub('/', '-')
65
61
 
@@ -62,10 +62,6 @@ Puppet::Face.define(:module, '1.0.0') do
62
62
  EOT
63
63
  end
64
64
 
65
- option '--strict-semver' do
66
- summary _('Whether version ranges should exclude pre-release versions')
67
- end
68
-
69
65
  when_invoked do |name, options|
70
66
  name = name.gsub('/', '-')
71
67
  Puppet.notice _("Preparing to upgrade '%{name}' ...") % { name: name }
@@ -38,7 +38,7 @@ Puppet::Indirector::Face.define(:status, '0.0.1') do
38
38
  This action requires that the server's `auth.conf` file allow find
39
39
  access to the `status` REST terminus. Puppet agent does not use this
40
40
  facility, and it is turned off by default. See
41
- <https://docs.puppetlabs.com/puppet/latest/reference/config_file_auth.html>
41
+ <https://puppet.com/docs/puppet/latest/config_file_auth.html>
42
42
  for more details.
43
43
  EOT
44
44
  find.examples <<-'EOT'
@@ -46,6 +46,6 @@ Puppet::Indirector::Face.define(:status, '0.0.1') do
46
46
 
47
47
  $ puppet status find --terminus rest
48
48
  EOT
49
-
49
+
50
50
  deprecate
51
51
  end
@@ -1,12 +1,9 @@
1
1
  require 'puppet/file_serving'
2
2
  require 'puppet/util'
3
- require 'puppet/util/methodhelper'
4
3
 
5
4
  # The base class for Content and Metadata; provides common
6
5
  # functionality like the behaviour around links.
7
6
  class Puppet::FileServing::Base
8
- include Puppet::Util::MethodHelper
9
-
10
7
  # This is for external consumers to store the source that was used
11
8
  # to retrieve the metadata.
12
9
  attr_accessor :source
@@ -35,10 +32,13 @@ class Puppet::FileServing::Base
35
32
  end
36
33
  end
37
34
 
38
- def initialize(path, options = {})
35
+ def initialize(path, links: nil, relative_path: nil, source: nil)
39
36
  self.path = path
40
37
  @links = :manage
41
- set_options(options)
38
+
39
+ self.links = links if links
40
+ self.relative_path = relative_path if relative_path
41
+ self.source = source if source
42
42
  end
43
43
 
44
44
  # Determine how we deal with links.
@@ -136,7 +136,8 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base
136
136
  @destination = data.delete('destination')
137
137
  @source = data.delete('source')
138
138
  @content_uri = data.delete('content_uri')
139
- super(path,data)
139
+
140
+ super(path, data.map { |k, v| [k.to_sym, v] }.to_h)
140
141
  end
141
142
 
142
143
  def to_data_hash
@@ -5,7 +5,7 @@ require 'net/http'
5
5
  require 'tempfile'
6
6
  require 'uri'
7
7
  require 'pathname'
8
- require 'json'
8
+ require 'puppet/util/json'
9
9
  require 'semantic_puppet'
10
10
 
11
11
  class Puppet::Forge < SemanticPuppet::Dependency::Source
@@ -19,10 +19,9 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
19
19
 
20
20
  attr_reader :host, :repository
21
21
 
22
- def initialize(host = Puppet[:module_repository], strict_semver = true)
22
+ def initialize(host = Puppet[:module_repository])
23
23
  @host = host
24
24
  @repository = Puppet::Forge::Repository.new(host, USER_AGENT)
25
- @strict_semver = strict_semver
26
25
  end
27
26
 
28
27
  # Return a list of module metadata hashes that match the search query.
@@ -64,7 +63,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
64
63
  response = make_http_request(uri)
65
64
 
66
65
  if response.code == '200'
67
- result = JSON.parse(response.body)
66
+ result = Puppet::Util::Json.load(response.body)
68
67
  uri = decode_uri(result['pagination']['next'])
69
68
  matches.concat result['results']
70
69
  else
@@ -101,7 +100,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
101
100
  response = make_http_request(uri)
102
101
 
103
102
  if response.code == '200'
104
- response = JSON.parse(response.body)
103
+ response = Puppet::Util::Json.load(response.body)
105
104
  else
106
105
  raise ResponseError.new(:uri => URI.parse(@host).merge(uri), :response => response)
107
106
  end
@@ -120,7 +119,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
120
119
  class ModuleRelease < SemanticPuppet::Dependency::ModuleRelease
121
120
  attr_reader :install_dir, :metadata
122
121
 
123
- def initialize(source, data, strict_semver = true)
122
+ def initialize(source, data)
124
123
  @data = data
125
124
  @metadata = meta = data['metadata']
126
125
 
@@ -132,7 +131,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
132
131
  dependencies = meta['dependencies'].collect do |dep|
133
132
  begin
134
133
  Puppet::ModuleTool::Metadata.new.add_dependency(dep['name'], dep['version_requirement'], dep['repository'])
135
- Puppet::ModuleTool.parse_module_dependency(release, dep, strict_semver)[0..1]
134
+ Puppet::ModuleTool.parse_module_dependency(release, dep)[0..1]
136
135
  rescue ArgumentError => e
137
136
  raise ArgumentError, _("Malformed dependency: %{name}.") % { name: dep['name'] } +
138
137
  ' ' + _("Exception was: %{detail}") % { detail: e }
@@ -224,7 +223,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
224
223
  l = list.map do |release|
225
224
  metadata = release['metadata']
226
225
  begin
227
- ModuleRelease.new(self, release, @strict_semver)
226
+ ModuleRelease.new(self, release)
228
227
  rescue ArgumentError => e
229
228
  Puppet.warning _("Cannot consider release %{name}-%{version}: %{error}") % { name: metadata['name'], version: metadata['version'], error: e }
230
229
  false