puppet 6.6.0 → 6.7.0

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

Potentially problematic release.


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

Files changed (254) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -8
  3. data/ext/solaris/smf/puppet.xml +2 -0
  4. data/ext/yaml_nodes.rb +7 -7
  5. data/lib/hiera_puppet.rb +2 -1
  6. data/lib/puppet/application/apply.rb +2 -3
  7. data/lib/puppet/application/doc.rb +2 -1
  8. data/lib/puppet/application/face_base.rb +22 -15
  9. data/lib/puppet/application/script.rb +4 -6
  10. data/lib/puppet/configurer.rb +10 -5
  11. data/lib/puppet/confine_collection.rb +2 -1
  12. data/lib/puppet/daemon.rb +3 -2
  13. data/lib/puppet/defaults.rb +8 -0
  14. data/lib/puppet/environments.rb +9 -7
  15. data/lib/puppet/etc.rb +1 -1
  16. data/lib/puppet/external/pson/pure/parser.rb +2 -1
  17. data/lib/puppet/face/epp.rb +4 -2
  18. data/lib/puppet/face/help.rb +3 -2
  19. data/lib/puppet/face/module/changes.rb +2 -1
  20. data/lib/puppet/file_bucket/dipper.rb +2 -1
  21. data/lib/puppet/file_serving/configuration.rb +2 -1
  22. data/lib/puppet/file_serving/fileset.rb +1 -1
  23. data/lib/puppet/file_serving/http_metadata.rb +4 -2
  24. data/lib/puppet/file_serving/metadata.rb +2 -1
  25. data/lib/puppet/file_serving/mount/file.rb +2 -1
  26. data/lib/puppet/file_serving/mount/locales.rb +2 -1
  27. data/lib/puppet/file_serving/mount/modules.rb +4 -2
  28. data/lib/puppet/file_serving/mount/pluginfacts.rb +2 -1
  29. data/lib/puppet/file_serving/mount/plugins.rb +2 -1
  30. data/lib/puppet/file_serving/mount/tasks.rb +4 -2
  31. data/lib/puppet/file_system/uniquefile.rb +4 -2
  32. data/lib/puppet/functions/match.rb +2 -3
  33. data/lib/puppet/generate/type.rb +2 -1
  34. data/lib/puppet/graph/relationship_graph.rb +2 -1
  35. data/lib/puppet/graph/simple_graph.rb +3 -2
  36. data/lib/puppet/indirector/catalog/compiler.rb +16 -8
  37. data/lib/puppet/indirector/certificate/rest.rb +2 -1
  38. data/lib/puppet/indirector/face.rb +2 -2
  39. data/lib/puppet/indirector/file_server.rb +4 -2
  40. data/lib/puppet/indirector/indirection.rb +12 -6
  41. data/lib/puppet/indirector/node/exec.rb +2 -1
  42. data/lib/puppet/indirector/report/processor.rb +2 -1
  43. data/lib/puppet/indirector/request.rb +9 -5
  44. data/lib/puppet/indirector/ssl_file.rb +10 -8
  45. data/lib/puppet/indirector/terminus.rb +6 -3
  46. data/lib/puppet/info_service.rb +9 -0
  47. data/lib/puppet/info_service/plan_information_service.rb +36 -0
  48. data/lib/puppet/interface.rb +2 -1
  49. data/lib/puppet/interface/action.rb +10 -5
  50. data/lib/puppet/interface/action_manager.rb +2 -1
  51. data/lib/puppet/interface/documentation.rb +10 -7
  52. data/lib/puppet/interface/face_collection.rb +6 -3
  53. data/lib/puppet/interface/option.rb +4 -2
  54. data/lib/puppet/interface/option_manager.rb +4 -2
  55. data/lib/puppet/module.rb +35 -1
  56. data/lib/puppet/module/plan.rb +160 -0
  57. data/lib/puppet/module_tool.rb +2 -1
  58. data/lib/puppet/module_tool/applications/application.rb +2 -1
  59. data/lib/puppet/module_tool/applications/installer.rb +4 -2
  60. data/lib/puppet/module_tool/applications/upgrader.rb +4 -2
  61. data/lib/puppet/module_tool/contents_description.rb +2 -1
  62. data/lib/puppet/module_tool/metadata.rb +2 -3
  63. data/lib/puppet/module_tool/shared_behaviors.rb +2 -1
  64. data/lib/puppet/network/authconfig.rb +4 -2
  65. data/lib/puppet/network/authstore.rb +2 -1
  66. data/lib/puppet/network/formats.rb +2 -1
  67. data/lib/puppet/network/http/api/indirected_routes.rb +6 -4
  68. data/lib/puppet/network/http/handler.rb +2 -1
  69. data/lib/puppet/network/http/request.rb +2 -1
  70. data/lib/puppet/network/http/route.rb +2 -1
  71. data/lib/puppet/network/resolver.rb +3 -2
  72. data/lib/puppet/network/rights.rb +2 -1
  73. data/lib/puppet/node.rb +8 -4
  74. data/lib/puppet/pal/catalog_compiler.rb +8 -1
  75. data/lib/puppet/pal/compiler.rb +2 -1
  76. data/lib/puppet/pal/pal_impl.rb +8 -0
  77. data/lib/puppet/pal/script_compiler.rb +4 -2
  78. data/lib/puppet/parameter.rb +4 -2
  79. data/lib/puppet/parameter/value_collection.rb +8 -8
  80. data/lib/puppet/parser/ast/pops_bridge.rb +2 -1
  81. data/lib/puppet/parser/compiler.rb +10 -5
  82. data/lib/puppet/parser/files.rb +2 -1
  83. data/lib/puppet/parser/functions.rb +2 -1
  84. data/lib/puppet/parser/relationship.rb +2 -1
  85. data/lib/puppet/parser/resource.rb +6 -3
  86. data/lib/puppet/parser/scope.rb +6 -4
  87. data/lib/puppet/parser/templatewrapper.rb +2 -1
  88. data/lib/puppet/parser/type_loader.rb +2 -1
  89. data/lib/puppet/pops/adaptable.rb +2 -5
  90. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +2 -1
  91. data/lib/puppet/pops/evaluator/collectors/fixed_set_collector.rb +2 -1
  92. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +2 -1
  93. data/lib/puppet/pops/evaluator/runtime3_support.rb +8 -4
  94. data/lib/puppet/pops/loader/base_loader.rb +4 -2
  95. data/lib/puppet/pops/loader/dependency_loader.rb +4 -2
  96. data/lib/puppet/pops/loader/gem_support.rb +4 -2
  97. data/lib/puppet/pops/loader/loader.rb +4 -2
  98. data/lib/puppet/pops/loader/loader_paths.rb +2 -1
  99. data/lib/puppet/pops/loader/static_loader.rb +1 -1
  100. data/lib/puppet/pops/lookup/interpolation.rb +2 -1
  101. data/lib/puppet/pops/model/factory.rb +4 -2
  102. data/lib/puppet/pops/parser/epp_support.rb +2 -1
  103. data/lib/puppet/pops/parser/heredoc_support.rb +2 -1
  104. data/lib/puppet/pops/parser/interpolation_support.rb +10 -5
  105. data/lib/puppet/pops/parser/lexer2.rb +6 -3
  106. data/lib/puppet/pops/parser/locator.rb +2 -1
  107. data/lib/puppet/pops/types/type_calculator.rb +1 -1
  108. data/lib/puppet/pops/types/type_parser.rb +4 -2
  109. data/lib/puppet/pops/validation.rb +2 -1
  110. data/lib/puppet/pops/validation/checker4_0.rb +6 -3
  111. data/lib/puppet/pops/visitor.rb +12 -6
  112. data/lib/puppet/property.rb +19 -16
  113. data/lib/puppet/property/ensure.rb +2 -1
  114. data/lib/puppet/property/keyvalue.rb +2 -1
  115. data/lib/puppet/property/list.rb +2 -1
  116. data/lib/puppet/provider.rb +10 -8
  117. data/lib/puppet/provider/exec.rb +7 -4
  118. data/lib/puppet/provider/file/posix.rb +6 -3
  119. data/lib/puppet/provider/group/groupadd.rb +2 -1
  120. data/lib/puppet/provider/group/ldap.rb +7 -4
  121. data/lib/puppet/provider/group/pw.rb +4 -2
  122. data/lib/puppet/provider/ldap.rb +8 -4
  123. data/lib/puppet/provider/nameservice.rb +8 -5
  124. data/lib/puppet/provider/nameservice/directoryservice.rb +8 -4
  125. data/lib/puppet/provider/network_device.rb +4 -2
  126. data/lib/puppet/provider/package.rb +2 -1
  127. data/lib/puppet/provider/package/aix.rb +4 -2
  128. data/lib/puppet/provider/package/appdmg.rb +4 -2
  129. data/lib/puppet/provider/package/apple.rb +2 -1
  130. data/lib/puppet/provider/package/apt.rb +4 -2
  131. data/lib/puppet/provider/package/blastwave.rb +2 -1
  132. data/lib/puppet/provider/package/dpkg.rb +6 -3
  133. data/lib/puppet/provider/package/fink.rb +2 -1
  134. data/lib/puppet/provider/package/gem.rb +4 -2
  135. data/lib/puppet/provider/package/macports.rb +6 -3
  136. data/lib/puppet/provider/package/nim.rb +8 -4
  137. data/lib/puppet/provider/package/openbsd.rb +14 -8
  138. data/lib/puppet/provider/package/opkg.rb +2 -1
  139. data/lib/puppet/provider/package/pacman.rb +2 -1
  140. data/lib/puppet/provider/package/pip.rb +2 -1
  141. data/lib/puppet/provider/package/pkgdmg.rb +4 -2
  142. data/lib/puppet/provider/package/pkgng.rb +4 -2
  143. data/lib/puppet/provider/package/pkgutil.rb +2 -1
  144. data/lib/puppet/provider/package/portupgrade.rb +2 -1
  145. data/lib/puppet/provider/package/rpm.rb +8 -4
  146. data/lib/puppet/provider/package/windows/package.rb +2 -1
  147. data/lib/puppet/provider/parsedfile.rb +14 -7
  148. data/lib/puppet/provider/service/base.rb +7 -4
  149. data/lib/puppet/provider/service/launchd.rb +4 -2
  150. data/lib/puppet/provider/service/service.rb +2 -1
  151. data/lib/puppet/provider/service/upstart.rb +11 -8
  152. data/lib/puppet/provider/user/directoryservice.rb +2 -1
  153. data/lib/puppet/provider/user/hpux.rb +1 -1
  154. data/lib/puppet/provider/user/ldap.rb +8 -4
  155. data/lib/puppet/provider/user/openbsd.rb +2 -1
  156. data/lib/puppet/provider/user/pw.rb +2 -1
  157. data/lib/puppet/provider/user/user_role_add.rb +4 -2
  158. data/lib/puppet/provider/user/useradd.rb +7 -4
  159. data/lib/puppet/reference/providers.rb +2 -3
  160. data/lib/puppet/reference/type.rb +4 -2
  161. data/lib/puppet/relationship.rb +4 -9
  162. data/lib/puppet/resource.rb +16 -9
  163. data/lib/puppet/resource/capability_finder.rb +12 -8
  164. data/lib/puppet/resource/catalog.rb +36 -40
  165. data/lib/puppet/resource/type.rb +7 -3
  166. data/lib/puppet/resource/type_collection.rb +4 -2
  167. data/lib/puppet/settings.rb +36 -19
  168. data/lib/puppet/settings/base_setting.rb +2 -1
  169. data/lib/puppet/settings/config_file.rb +2 -1
  170. data/lib/puppet/settings/file_setting.rb +2 -1
  171. data/lib/puppet/settings/ini_file.rb +2 -1
  172. data/lib/puppet/ssl/base.rb +2 -1
  173. data/lib/puppet/ssl/host.rb +16 -8
  174. data/lib/puppet/ssl/key.rb +2 -2
  175. data/lib/puppet/ssl/state_machine.rb +22 -3
  176. data/lib/puppet/transaction/event.rb +2 -1
  177. data/lib/puppet/transaction/event_manager.rb +4 -2
  178. data/lib/puppet/transaction/report.rb +10 -10
  179. data/lib/puppet/transaction/resource_harness.rb +4 -2
  180. data/lib/puppet/type.rb +84 -48
  181. data/lib/puppet/type/component.rb +2 -1
  182. data/lib/puppet/type/exec.rb +11 -7
  183. data/lib/puppet/type/file.rb +15 -9
  184. data/lib/puppet/type/file/content.rb +7 -3
  185. data/lib/puppet/type/file/ctime.rb +2 -1
  186. data/lib/puppet/type/file/data_sync.rb +2 -1
  187. data/lib/puppet/type/file/ensure.rb +10 -7
  188. data/lib/puppet/type/file/mode.rb +2 -1
  189. data/lib/puppet/type/file/mtime.rb +2 -1
  190. data/lib/puppet/type/file/selcontext.rb +2 -1
  191. data/lib/puppet/type/file/source.rb +6 -7
  192. data/lib/puppet/type/file/target.rb +2 -1
  193. data/lib/puppet/type/file/type.rb +2 -1
  194. data/lib/puppet/type/package.rb +6 -3
  195. data/lib/puppet/type/resources.rb +2 -1
  196. data/lib/puppet/type/service.rb +2 -1
  197. data/lib/puppet/type/tidy.rb +14 -7
  198. data/lib/puppet/type/user.rb +19 -7
  199. data/lib/puppet/util.rb +6 -3
  200. data/lib/puppet/util/checksums.rb +1 -1
  201. data/lib/puppet/util/classgen.rb +12 -6
  202. data/lib/puppet/util/command_line.rb +8 -4
  203. data/lib/puppet/util/connection.rb +4 -2
  204. data/lib/puppet/util/diff.rb +4 -2
  205. data/lib/puppet/util/execution.rb +4 -2
  206. data/lib/puppet/util/feature.rb +7 -4
  207. data/lib/puppet/util/fileparsing.rb +57 -46
  208. data/lib/puppet/util/filetype.rb +2 -1
  209. data/lib/puppet/util/http_proxy.rb +2 -1
  210. data/lib/puppet/util/instance_loader.rb +2 -1
  211. data/lib/puppet/util/ldap/connection.rb +4 -2
  212. data/lib/puppet/util/ldap/manager.rb +6 -3
  213. data/lib/puppet/util/log.rb +6 -3
  214. data/lib/puppet/util/metric.rb +2 -1
  215. data/lib/puppet/util/posix.rb +4 -2
  216. data/lib/puppet/util/rdoc/code_objects.rb +2 -1
  217. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +4 -2
  218. data/lib/puppet/util/selinux.rb +2 -1
  219. data/lib/puppet/version.rb +2 -5
  220. data/locales/puppet.pot +713 -685
  221. data/man/man5/puppet.conf.5 +9 -2
  222. data/man/man8/puppet-agent.8 +1 -1
  223. data/man/man8/puppet-apply.8 +1 -1
  224. data/man/man8/puppet-catalog.8 +1 -1
  225. data/man/man8/puppet-config.8 +1 -1
  226. data/man/man8/puppet-describe.8 +1 -1
  227. data/man/man8/puppet-device.8 +1 -1
  228. data/man/man8/puppet-doc.8 +1 -1
  229. data/man/man8/puppet-epp.8 +1 -1
  230. data/man/man8/puppet-facts.8 +1 -1
  231. data/man/man8/puppet-filebucket.8 +1 -1
  232. data/man/man8/puppet-generate.8 +1 -1
  233. data/man/man8/puppet-help.8 +1 -1
  234. data/man/man8/puppet-key.8 +1 -1
  235. data/man/man8/puppet-lookup.8 +1 -1
  236. data/man/man8/puppet-man.8 +1 -1
  237. data/man/man8/puppet-module.8 +1 -1
  238. data/man/man8/puppet-node.8 +1 -1
  239. data/man/man8/puppet-parser.8 +1 -1
  240. data/man/man8/puppet-plugin.8 +1 -1
  241. data/man/man8/puppet-report.8 +1 -1
  242. data/man/man8/puppet-resource.8 +1 -1
  243. data/man/man8/puppet-script.8 +1 -1
  244. data/man/man8/puppet-ssl.8 +1 -1
  245. data/man/man8/puppet-status.8 +1 -1
  246. data/man/man8/puppet.8 +2 -2
  247. data/spec/lib/puppet_spec/modules.rb +16 -2
  248. data/spec/unit/indirector/request_spec.rb +5 -6
  249. data/spec/unit/info_service_spec.rb +48 -0
  250. data/spec/unit/module_spec.rb +73 -0
  251. data/spec/unit/plan_spec.rb +65 -0
  252. data/spec/unit/puppet_pal_catalog_spec.rb +12 -0
  253. data/spec/unit/ssl/state_machine_spec.rb +68 -5
  254. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25cdda3cd645130128e5edab7617970fe15a3c89c99524e57bcddf8327158ec5
4
- data.tar.gz: 1d7890b03b68677b5ad1756cb8265d6684888e4420d0103fd9a5b13e4e479264
3
+ metadata.gz: 6739b00b930cc1e7e8f361e958769b3c3f02ab6ee88e96bdf018a98b847cfb09
4
+ data.tar.gz: 5b7812551d0fb9dcfc0c2793b5cb3ef36997efde0c878567b09f520808e41bd2
5
5
  SHA512:
6
- metadata.gz: fca7ac8a9c7a69ab904f1537d93b43596cd6cf1002ca4497e385eef749a20f172df43e4e6e14abf75649e9315c28822f0de2e4261c74a218119e8f744c9bc00c
7
- data.tar.gz: 8e0fc73cc45eb035cd1e5fe555301a8f015074812ae1b59eee2dda61a099d4529dfb257dcc185681c341bcb96b508da4aeec39660b8984da312de48cc173ea67
6
+ metadata.gz: 526dcbc10b75e92ca4028824567e2e83bb2c80938be0796e6574b0cb5efffb8dc1ad235763aa41e75946315c218aafd771d388e5cadeaaffae51cb338325eb6f
7
+ data.tar.gz: c800fbda4bfae645c209742ff25ed10ef07368da5920b241c81f6c6bcd54e4b113e32c08aa52be4a717b22da77cd6ab6e0ffeef5d5620abd9f83426d69bb6d3f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet (6.6.0)
4
+ puppet (6.7.0)
5
5
  CFPropertyList (~> 2.2)
6
6
  facter (>= 2.4.0, < 4)
7
7
  fast_gettext (~> 1.1)
@@ -23,7 +23,7 @@ GEM
23
23
  crack (0.4.3)
24
24
  safe_yaml (~> 1.0.0)
25
25
  diff-lcs (1.3)
26
- facter (2.5.1)
26
+ facter (2.5.5)
27
27
  fast_gettext (1.1.2)
28
28
  gettext (3.2.9)
29
29
  locale (>= 2.0.5)
@@ -32,7 +32,7 @@ GEM
32
32
  fast_gettext (~> 1.1.0)
33
33
  gettext (>= 3.0.2)
34
34
  locale
35
- hashdiff (0.4.0)
35
+ hashdiff (1.0.0)
36
36
  hiera (3.5.0)
37
37
  hiera-eyaml (3.0.0)
38
38
  highline (~> 1.6.19)
@@ -44,14 +44,14 @@ GEM
44
44
  json-schema (2.8.1)
45
45
  addressable (>= 2.4)
46
46
  locale (2.1.2)
47
- memory_profiler (0.9.13)
47
+ memory_profiler (0.9.14)
48
48
  method_source (0.9.2)
49
49
  minitar (0.8)
50
50
  msgpack (1.3.0)
51
51
  multi_json (1.13.1)
52
52
  mustache (1.1.0)
53
53
  optimist (3.0.0)
54
- packaging (0.99.35)
54
+ packaging (0.99.36)
55
55
  artifactory (~> 2)
56
56
  rake (~> 12.3)
57
57
  parallel (1.17.0)
@@ -64,7 +64,7 @@ GEM
64
64
  public_suffix (3.1.1)
65
65
  puppet-resource_api (1.8.4)
66
66
  hocon (>= 1.0)
67
- puppetserver-ca (1.3.1)
67
+ puppetserver-ca (1.3.2)
68
68
  facter (>= 2.0.1, < 4)
69
69
  racc (1.4.9)
70
70
  rainbow (2.2.2)
@@ -82,7 +82,7 @@ GEM
82
82
  rspec-mocks (~> 3.8.0)
83
83
  rspec-collection_matchers (1.1.3)
84
84
  rspec-expectations (>= 2.99.0.beta1)
85
- rspec-core (3.8.1)
85
+ rspec-core (3.8.2)
86
86
  rspec-support (~> 3.8.0)
87
87
  rspec-expectations (3.8.4)
88
88
  diff-lcs (>= 1.2.0, < 2.0)
@@ -114,7 +114,7 @@ GEM
114
114
  addressable (>= 2.3.6)
115
115
  crack (>= 0.3.2)
116
116
  hashdiff
117
- yard (0.9.19)
117
+ yard (0.9.20)
118
118
 
119
119
  PLATFORMS
120
120
  ruby
@@ -28,6 +28,8 @@
28
28
 
29
29
  <exec_method type="method" name="stop" exec="/lib/svc/method/puppet stop" timeout_seconds="60"/>
30
30
 
31
+ <exec_method type="method" name="refresh" exec=":kill" timeout_seconds="60"/>
32
+
31
33
  <stability value="Evolving"/>
32
34
 
33
35
  <template>
@@ -74,7 +74,7 @@ info = read_node(node)
74
74
 
75
75
  # Iterate over any provided parents, merging in there information.
76
76
  parents_seen = []
77
- while parent = info["parent"]
77
+ while parent = info["parent"] #rubocop:disable Lint/AssignmentInCondition
78
78
  raise "Found inheritance loop with parent #{parent}" if parents_seen.include?(parent)
79
79
 
80
80
  parents_seen << parent
@@ -84,21 +84,21 @@ while parent = info["parent"]
84
84
  parent_info = read_node(parent)
85
85
 
86
86
  # Include any parent classes in our list.
87
- if pclasses = parent_info["classes"]
88
- info["classes"] += pclasses
87
+ if parent_info["classes"]
88
+ info["classes"] += parent_info["classes"]
89
89
  info["classes"].uniq!
90
90
  end
91
91
 
92
92
  # And inherit parameters from our parent, while preferring our own values.
93
- if pparams = parent_info["parameters"]
93
+ if parent_info["parameters"]
94
94
  # When using Hash#merge, the hash being merged in wins, and we
95
95
  # want the subnode parameters to be the parent node parameters.
96
- info["parameters"] = pparams.merge(info["parameters"])
96
+ info["parameters"] = parent_info["parameters"].merge(info["parameters"])
97
97
  end
98
98
 
99
99
  # Copy over any parent node name.
100
- if pparent = parent_info["parent"]
101
- info["parent"] = pparent
100
+ if parent_info["parent"]
101
+ info["parent"] = parent_info["parent"]
102
102
  end
103
103
  end
104
104
 
@@ -58,7 +58,8 @@ module HieraPuppet
58
58
  def hiera_config
59
59
  config = {}
60
60
 
61
- if config_file = hiera_config_file
61
+ config_file = hiera_config_file
62
+ if config_file
62
63
  config = Hiera::Config.load(config_file)
63
64
  end
64
65
 
@@ -349,9 +349,8 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
349
349
  facts = nil
350
350
  unless Puppet[:node_name_fact].empty?
351
351
  # Collect our facts.
352
- unless facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
353
- raise _("Could not find facts for %{node}") % { node: Puppet[:node_name_value] }
354
- end
352
+ facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
353
+ raise _("Could not find facts for %{node}") % { node: Puppet[:node_name_value] } unless facts
355
354
 
356
355
  Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]]
357
356
  facts.name = Puppet[:node_name_value]
@@ -156,7 +156,8 @@ HELP
156
156
  exit_code = 0
157
157
  require 'puppet/util/reference'
158
158
  options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name|
159
- raise _("Could not find reference %{name}") % { name: name } unless section = Puppet::Util::Reference.reference(name)
159
+ section = Puppet::Util::Reference.reference(name)
160
+ raise _("Could not find reference %{name}") % { name: name } unless section
160
161
 
161
162
  begin
162
163
  # Add the per-section text, but with no ToC
@@ -74,32 +74,38 @@ class Puppet::Application::FaceBase < Puppet::Application
74
74
  index = -1
75
75
  until action_name or (index += 1) >= command_line.args.length do
76
76
  item = command_line.args[index]
77
- if item =~ /^-/ then
77
+ if item =~ /^-/
78
78
  option = @face.options.find do |name|
79
79
  item =~ /^-+#{name.to_s.gsub(/[-_]/, '[-_]')}(?:[ =].*)?$/
80
80
  end
81
- if option then
81
+ if option
82
82
  option = @face.get_option(option)
83
83
  # If we have an inline argument, just carry on. We don't need to
84
84
  # care about optional vs mandatory in that case because we do a real
85
85
  # parse later, and that will totally take care of raising the error
86
86
  # when we get there. --daniel 2011-04-04
87
- if option.takes_argument? and !item.index('=') then
87
+ if option.takes_argument? and !item.index('=')
88
88
  index += 1 unless
89
89
  (option.optional_argument? and command_line.args[index + 1] =~ /^-/)
90
90
  end
91
- elsif option = find_global_settings_argument(item) then
92
- unless Puppet.settings.boolean? option.name then
93
- # As far as I can tell, we treat non-bool options as always having
94
- # a mandatory argument. --daniel 2011-04-05
95
- # ... But, the mandatory argument will not be the next item if an = is
96
- # employed in the long form of the option. --jeffmccune 2012-09-18
97
- index += 1 unless item =~ /^--#{option.name}=/
98
- end
99
- elsif option = find_application_argument(item) then
100
- index += 1 if (option[:argument] and not option[:optional])
101
91
  else
102
- raise OptionParser::InvalidOption.new(item.sub(/=.*$/, ''))
92
+ option = find_global_settings_argument(item)
93
+ if option
94
+ unless Puppet.settings.boolean? option.name
95
+ # As far as I can tell, we treat non-bool options as always having
96
+ # a mandatory argument. --daniel 2011-04-05
97
+ # ... But, the mandatory argument will not be the next item if an = is
98
+ # employed in the long form of the option. --jeffmccune 2012-09-18
99
+ index += 1 unless item =~ /^--#{option.name}=/
100
+ end
101
+ else
102
+ option = find_application_argument(item)
103
+ if option
104
+ index += 1 if (option[:argument] and not option[:optional])
105
+ else
106
+ raise OptionParser::InvalidOption.new(item.sub(/=.*$/, ''))
107
+ end
108
+ end
103
109
  end
104
110
  else
105
111
  # Stash away the requested action name for later, and try to fetch the
@@ -112,7 +118,8 @@ class Puppet::Application::FaceBase < Puppet::Application
112
118
  end
113
119
 
114
120
  if @action.nil?
115
- if @action = @face.get_default_action() then
121
+ @action = @face.get_default_action()
122
+ if @action
116
123
  @is_default_action = true
117
124
  else
118
125
  # First try to handle global command line options
@@ -140,18 +140,16 @@ Copyright (c) 2017 Puppet Inc., LLC Licensed under the Apache 2.0 License
140
140
 
141
141
  unless Puppet[:node_name_fact].empty?
142
142
  # Collect the facts specified for that node
143
- unless facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
144
- raise _("Could not find facts for %{node}") % { node: Puppet[:node_name_value] }
145
- end
143
+ facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
144
+ raise _("Could not find facts for %{node}") % { node: Puppet[:node_name_value] } unless facts
146
145
 
147
146
  Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]]
148
147
  facts.name = Puppet[:node_name_value]
149
148
  end
150
149
 
151
150
  # Find the Node
152
- unless node = Puppet::Node.indirection.find(Puppet[:node_name_value])
153
- raise _("Could not find node %{node}") % { node: Puppet[:node_name_value] }
154
- end
151
+ node = Puppet::Node.indirection.find(Puppet[:node_name_value])
152
+ raise _("Could not find node %{node}") % { node: Puppet[:node_name_value] } unless node
155
153
 
156
154
  configured_environment = node.environment || Puppet.lookup(:current_environment)
157
155
 
@@ -67,7 +67,8 @@ class Puppet::Configurer
67
67
  # Get the remote catalog, yo. Returns nil if no catalog can be found.
68
68
  def retrieve_catalog(query_options)
69
69
  query_options ||= {}
70
- if (Puppet[:use_cached_catalog] && result = retrieve_catalog_from_cache(query_options))
70
+ result = retrieve_catalog_from_cache(query_options) if Puppet[:use_cached_catalog]
71
+ if result
71
72
  @cached_catalog_status = 'explicitly_requested'
72
73
 
73
74
  Puppet.info _("Using cached catalog from environment '%{environment}'") % { environment: result.environment }
@@ -104,7 +105,8 @@ class Puppet::Configurer
104
105
 
105
106
  catalog_conversion_time = thinmark do
106
107
  # Will mutate the result and replace all Deferred values with resolved values
107
- if facts = options[:convert_with_facts]
108
+ facts = options[:convert_with_facts]
109
+ if facts
108
110
  Puppet::Pops::Evaluator::DeferredResolver.resolve_and_replace(facts, result)
109
111
  end
110
112
 
@@ -257,7 +259,8 @@ class Puppet::Configurer
257
259
  Puppet::GettextConfig.reset_text_domain('agent')
258
260
  Puppet::ModuleTranslations.load_from_vardir(Puppet[:vardir])
259
261
 
260
- if catalog = prepare_and_retrieve_catalog_from_cache(options)
262
+ catalog = prepare_and_retrieve_catalog_from_cache(options)
263
+ if catalog
261
264
  options[:catalog] = catalog
262
265
  @cached_catalog_status = 'explicitly_requested'
263
266
 
@@ -339,7 +342,8 @@ class Puppet::Configurer
339
342
  query_options[:configured_environment] = configured_environment
340
343
  options[:convert_for_node] = node
341
344
 
342
- unless catalog = prepare_and_retrieve_catalog(options, query_options)
345
+ catalog = prepare_and_retrieve_catalog(options, query_options)
346
+ unless catalog
343
347
  return nil
344
348
  end
345
349
 
@@ -364,7 +368,8 @@ class Puppet::Configurer
364
368
  query_options = get_facts(options)
365
369
  query_options[:configured_environment] = configured_environment
366
370
 
367
- return nil unless catalog = prepare_and_retrieve_catalog(options, query_options)
371
+ catalog = prepare_and_retrieve_catalog(options, query_options)
372
+ return nil unless catalog
368
373
  tries += 1
369
374
  end
370
375
 
@@ -11,7 +11,8 @@ class Puppet::ConfineCollection
11
11
  for_binary = false
12
12
  end
13
13
  hash.each do |test, values|
14
- if klass = Puppet::Confine.test(test)
14
+ klass = Puppet::Confine.test(test)
15
+ if klass
15
16
  @confines << klass.new(values)
16
17
  @confines[-1].for_binary = true if for_binary
17
18
  else
@@ -38,7 +38,8 @@ class Puppet::Daemon
38
38
 
39
39
  # Put the daemon into the background.
40
40
  def daemonize
41
- if pid = fork
41
+ pid = fork
42
+ if pid
42
43
  Process.detach(pid)
43
44
  exit(0)
44
45
  end
@@ -181,7 +182,7 @@ class Puppet::Daemon
181
182
  end
182
183
 
183
184
  signal_loop = Puppet::Scheduler.create_job(SIGNAL_CHECK_INTERVAL) do
184
- while method = @signals.shift
185
+ while method = @signals.shift #rubocop:disable Lint/AssignmentInCondition
185
186
  Puppet.notice "Processing #{method}"
186
187
  send(method)
187
188
  end
@@ -913,6 +913,14 @@ EOT
913
913
  :group => "service",
914
914
  :desc => "Where each client stores the CA certificate."
915
915
  },
916
+ :ca_fingerprint => {
917
+ :default => nil,
918
+ :type => :string,
919
+ :desc => "The expected fingerprint of the CA certificate. If specified, the agent
920
+ will compare the CA certificate fingerprint that it downloads against this value
921
+ and reject the CA certificate if the values do not match. This only applies
922
+ during the first download of the CA certificate."
923
+ },
916
924
  :ssl_client_ca_auth => {
917
925
  :type => :file,
918
926
  :mode => "0644",
@@ -141,17 +141,16 @@ module Puppet::Environments
141
141
  class StaticDirectory < Static
142
142
  # Accepts a single environment in the given directory having the given name (not required to be reflected as the name
143
143
  # of the directory)
144
- #
145
144
  def initialize(env_name, env_dir, environment)
146
145
  super(environment)
147
146
  @env_dir = env_dir
148
- @env_name = env_name
147
+ @env_name = env_name.intern
149
148
  end
150
149
 
151
150
  # @!macro loader_get_conf
152
151
  def get_conf(name)
153
- return nil unless name == @env_name
154
- Puppet::Settings::EnvironmentConf.load_from(@env_dir, '')
152
+ return nil unless name.intern == @env_name
153
+ Puppet::Settings::EnvironmentConf.load_from(@env_dir, [])
155
154
  end
156
155
  end
157
156
 
@@ -268,7 +267,8 @@ module Puppet::Environments
268
267
  # @!macro loader_get
269
268
  def get(name)
270
269
  @loaders.each do |loader|
271
- if env = loader.get(name)
270
+ env = loader.get(name)
271
+ if env
272
272
  return env
273
273
  end
274
274
  end
@@ -278,7 +278,8 @@ module Puppet::Environments
278
278
  # @!macro loader_get_conf
279
279
  def get_conf(name)
280
280
  @loaders.each do |loader|
281
- if conf = loader.get_conf(name)
281
+ conf = loader.get_conf(name)
282
+ if conf
282
283
  return conf
283
284
  end
284
285
  end
@@ -349,7 +350,8 @@ module Puppet::Environments
349
350
  # This strategy favors smaller memory footprint over environment
350
351
  # retrieval time.
351
352
  clear_all_expired
352
- if result = @cache[name]
353
+ result = @cache[name]
354
+ if result
353
355
  # found in cache
354
356
  return result.value
355
357
  elsif (result = @loader.get(name))
@@ -115,7 +115,7 @@ module Puppet::Etc
115
115
 
116
116
  setgrent
117
117
  begin
118
- while cur_group = getgrent
118
+ while cur_group = getgrent #rubocop:disable Lint/AssignmentInCondition
119
119
  yield cur_group
120
120
  end
121
121
  ensure
@@ -180,7 +180,8 @@ module PSON
180
180
  if scan(STRING)
181
181
  return '' if self[1].empty?
182
182
  string = self[1].gsub(%r{(?:\\[\\bfnrt"/]|(?:\\u(?:[A-Fa-f\d]{4}))+|\\[\x20-\xff])}n) do |c|
183
- if u = UNESCAPE_MAP[$MATCH[1]]
183
+ u = UNESCAPE_MAP[$MATCH[1]]
184
+ if u
184
185
  u
185
186
  else # \uXXXX
186
187
  bytes = ''
@@ -402,7 +402,8 @@ Puppet::Face.define(:epp, '0.0.1') do
402
402
 
403
403
  def get_values(compiler, options)
404
404
  template_values = nil
405
- if values_file = options[:values_file]
405
+ values_file = options[:values_file]
406
+ if values_file
406
407
  begin
407
408
  if values_file =~ /\.yaml$/
408
409
  template_values = Puppet::Util::Yaml.safe_load_file(values_file, [Symbol])
@@ -420,7 +421,8 @@ Puppet::Face.define(:epp, '0.0.1') do
420
421
  end
421
422
  end
422
423
 
423
- if values = options[:values]
424
+ values = options[:values]
425
+ if values
424
426
  evaluating_parser = Puppet::Pops::Parser::EvaluatingParser.new
425
427
  result = evaluating_parser.evaluate_string(compiler.topscope, values, 'values-hash')
426
428
  case result
@@ -182,8 +182,9 @@ Puppet::Face.define(:help, '0.0.1') do
182
182
  # depends on the implementation coincidence of how our pages are
183
183
  # formatted. If we can't match the pattern we expect we return the empty
184
184
  # string to ensure we don't blow up in the summary. --daniel 2011-04-11
185
- while line = help.shift do
186
- if md = /^puppet-#{appname}\([^\)]+\) -- (.*)$/.match(line)
185
+ while line = help.shift do #rubocop:disable Lint/AssignmentInCondition
186
+ md = /^puppet-#{appname}\([^\)]+\) -- (.*)$/.match(line)
187
+ if md
187
188
  return md[1]
188
189
  end
189
190
  end