puppet 6.6.0-universal-darwin → 6.7.0-universal-darwin

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
@@ -14,7 +14,8 @@ module Puppet::Parser::Files
14
14
  def find_manifests_in_modules(pattern, environment)
15
15
  module_name, file_pattern = split_file_path(pattern)
16
16
 
17
- if mod = environment.module(module_name)
17
+ mod = environment.module(module_name)
18
+ if mod
18
19
  [mod.name, mod.match_manifests(file_pattern)]
19
20
  else
20
21
  [nil, []]
@@ -232,7 +232,8 @@ module Puppet::Parser::Functions
232
232
  def self.function(name, environment = Puppet.lookup(:current_environment))
233
233
  name = name.intern
234
234
 
235
- unless func = get_function(name, environment)
235
+ func = get_function(name, environment)
236
+ unless func
236
237
  autoloader.delegatee.load(name, environment)
237
238
  func = get_function(name, environment)
238
239
  end
@@ -36,7 +36,8 @@ class Puppet::Parser::Relationship
36
36
  target_ref = canonical_ref(target)
37
37
  rel_param = param_name
38
38
 
39
- unless source_resource = catalog.resource(*source_ref)
39
+ source_resource = catalog.resource(*source_ref)
40
+ unless source_resource
40
41
  raise ArgumentError, _("Could not find resource '%{source}' for relationship on '%{target}'") % { source: source.to_s, target: target.to_s }
41
42
  end
42
43
  unless catalog.resource(*target_ref)
@@ -56,7 +56,8 @@ class Puppet::Parser::Resource < Puppet::Resource
56
56
  def add_edge_to_stage
57
57
  return unless self.class?
58
58
 
59
- unless stage = catalog.resource(:stage, self[:stage] || (scope && scope.resource && scope.resource[:stage]) || :main)
59
+ stage = catalog.resource(:stage, self[:stage] || (scope && scope.resource && scope.resource[:stage]) || :main)
60
+ unless stage
60
61
  raise ArgumentError, _("Could not find stage %{stage} specified by %{resource}") % { stage: self[:stage] || :main, resource: self }
61
62
  end
62
63
 
@@ -298,7 +299,8 @@ class Puppet::Parser::Resource < Puppet::Resource
298
299
 
299
300
  # evaluate mappings in that scope
300
301
  resource_type.arguments.keys.each do |name|
301
- if expr = blueprint[:mappings][name]
302
+ expr = blueprint[:mappings][name]
303
+ if expr
302
304
  # Explicit mapping
303
305
  value = expr.safeevaluate(cns_scope)
304
306
  else
@@ -348,7 +350,8 @@ class Puppet::Parser::Resource < Puppet::Resource
348
350
  def override_parameter(param)
349
351
  # This can happen if the override is defining a new parameter, rather
350
352
  # than replacing an existing one.
351
- (set_parameter(param) and return) unless current = @parameters[param.name]
353
+ current = @parameters[param.name]
354
+ (set_parameter(param) and return) unless current
352
355
 
353
356
  # Parameter is already set - if overriding with a default - simply ignore the setting of the default value
354
357
  return if scope.is_default?(type, param.name, param.value)
@@ -1,4 +1,3 @@
1
-
2
1
  # The scope class, which handles storing and retrieving variables and types and
3
2
  # such.
4
3
  require 'forwardable'
@@ -652,8 +651,10 @@ class Puppet::Parser::Scope
652
651
  private :has_enclosing_scope?
653
652
 
654
653
  def qualified_scope(classname)
655
- raise _("class %{classname} could not be found") % { classname: classname } unless klass = find_hostclass(classname)
656
- raise _("class %{classname} has not been evaluated") % { classname: classname } unless kscope = class_scope(klass)
654
+ klass = find_hostclass(classname)
655
+ raise _("class %{classname} could not be found") % { classname: classname } unless klass
656
+ kscope = class_scope(klass)
657
+ raise _("class %{classname} has not been evaluated") % { classname: classname } unless kscope
657
658
  kscope
658
659
  end
659
660
  private :qualified_scope
@@ -881,7 +882,8 @@ class Puppet::Parser::Scope
881
882
  env_path = nil
882
883
  env_path = environment.configuration.path_to_env unless (environment.nil? || environment.configuration.nil?)
883
884
  # check module paths first since they may be in the environment (i.e. they are longer)
884
- if module_path = environment.full_modulepath.detect {|m_path| path.start_with?(m_path) }
885
+ module_path = environment.full_modulepath.detect {|m_path| path.start_with?(m_path) }
886
+ if module_path
885
887
  path = "<module>" + path[module_path.length..-1]
886
888
  elsif env_path && path && path.start_with?(env_path)
887
889
  path = "<env>" + path[env_path.length..-1]
@@ -61,7 +61,8 @@ class Puppet::Parser::TemplateWrapper
61
61
 
62
62
  # @api private
63
63
  def file=(filename)
64
- unless @__file__ = Puppet::Parser::Files.find_template(filename, scope.compiler.environment)
64
+ @__file__ = Puppet::Parser::Files.find_template(filename, scope.compiler.environment)
65
+ unless @__file__
65
66
  raise Puppet::ParseError, _("Could not find template '%{filename}'") % { filename: filename }
66
67
  end
67
68
  end
@@ -66,7 +66,8 @@ class Puppet::Parser::TypeLoader
66
66
  files_to_try_for(fqname).each do |filename|
67
67
  begin
68
68
  imported_types = import_from_modules(filename)
69
- if result = imported_types.find { |t| t.type == type and t.name == fqname }
69
+ result = imported_types.find { |t| t.type == type and t.name == fqname }
70
+ if result
70
71
  Puppet.debug {"Automatically imported #{fqname} from #{filename} into #{environment}"}
71
72
  return result
72
73
  end
@@ -94,11 +94,8 @@ module Adaptable
94
94
  #
95
95
  def self.adapt(o, &block)
96
96
  attr_name = self_attr_name
97
- adapter = if o.instance_variable_defined?(attr_name) && value = o.instance_variable_get(attr_name)
98
- value
99
- else
100
- associate_adapter(create_adapter(o), o)
101
- end
97
+ value = o.instance_variable_get(attr_name) if o.instance_variable_defined?(attr_name)
98
+ adapter = value || associate_adapter(create_adapter(o), o)
102
99
  if block_given?
103
100
  case block.arity
104
101
  when 1
@@ -44,7 +44,8 @@ class Puppet::Pops::Evaluator::Collectors::ExportedCollector < Puppet::Pops::Eva
44
44
  found_resources = found.map {|x| x.is_a?(Puppet::Parser::Resource) ? x : x.to_resource(@scope)}
45
45
 
46
46
  found_resources.each do |item|
47
- if existing = @scope.findresource(item.resource_type, item.title)
47
+ existing = @scope.findresource(item.resource_type, item.title)
48
+ if existing
48
49
  unless existing.collector_id == item.collector_id
49
50
  raise Puppet::ParseError,
50
51
  _("A duplicate resource was found while collecting exported resources, with the type and title %{title}") % { title: item.ref }
@@ -16,7 +16,8 @@ class Puppet::Pops::Evaluator::Collectors::FixedSetCollector < Puppet::Pops::Eva
16
16
  def collect
17
17
  resolved = []
18
18
  result = @resources.reduce([]) do |memo, ref|
19
- if res = @scope.findresource(ref.to_s)
19
+ res = @scope.findresource(ref.to_s)
20
+ if res
20
21
  res.virtual = false
21
22
  memo << res
22
23
  resolved << ref
@@ -97,7 +97,8 @@ module Runtime3ResourceSupport
97
97
  end
98
98
 
99
99
  loader = scope.compiler.loaders.private_environment_loader
100
- if loaded = loader.load(:resource_type_pp, type_name)
100
+ loaded = loader.load(:resource_type_pp, type_name)
101
+ if loaded
101
102
  return loaded
102
103
  end
103
104
 
@@ -252,7 +252,8 @@ module Runtime3Support
252
252
  if v.is_a?(Numeric)
253
253
  return v
254
254
  end
255
- unless n = Utils.to_n(v)
255
+ n = Utils.to_n(v)
256
+ unless n
256
257
  fail(Issues::NOT_NUMERIC, o, {:value => v})
257
258
  end
258
259
  # this point is reached if there was a conversion
@@ -276,7 +277,8 @@ module Runtime3Support
276
277
  # and it does not defined the visibility of functions from a ruby function's perspective. Instead,
277
278
  # this is done from the perspective of the environment.
278
279
  loader = loaders.private_environment_loader
279
- if loader && func = loader.load(:function, name)
280
+ func = loader.load(:function, name) if loader
281
+ if func
280
282
  Puppet::Util::Profiler.profile(name, [:functions, name]) do
281
283
  return func.call(scope, *args, &block)
282
284
  end
@@ -299,7 +301,8 @@ module Runtime3Support
299
301
  # 'ruby -wc' thinks that _func is unused, because the only reference to it
300
302
  # is inside of the Kernel.eval string below. By prefixing it with the
301
303
  # underscore, we let Ruby know to not worry about whether it's unused or not.
302
- if loader && _func = loader.load(:function, name)
304
+ _func = loader.load(:function, name) if loader
305
+ if _func
303
306
  Puppet::Util::Profiler.profile(name, [:functions, name]) do
304
307
  # Add stack frame when calling. See Puppet::Pops::PuppetStack
305
308
  return Kernel.eval('_func.call(scope, *args, &block)'.freeze, Kernel.binding, file || '', line)
@@ -415,7 +418,8 @@ module Runtime3Support
415
418
  # The defaults must be looked up in the scope where the resource was created (not in the given
416
419
  # scope where the lookup takes place.
417
420
  resource_scope = resource.scope
418
- if val.nil? && resource_scope && defaults = resource_scope.lookupdefaults(resource.type)
421
+ defaults = resource_scope.lookupdefaults(resource.type) if val.nil? && resource_scope
422
+ if defaults
419
423
  # NOTE: 3x resource keeps defaults as hash using symbol for name as key to Parameter which (again) holds
420
424
  # name and value.
421
425
  # NOTE: meta parameters that are unset ends up here, and there are no defaults for those encoded
@@ -69,7 +69,8 @@ class BaseLoader < Loader
69
69
  #
70
70
  def set_entry(typed_name, value, origin = nil)
71
71
  # It is never ok to redefine in the very same loader unless redefining a 'not found'
72
- if entry = @named_values[typed_name]
72
+ entry = @named_values[typed_name]
73
+ if entry
73
74
  fail_redefine(entry) unless entry.value.nil?
74
75
  end
75
76
 
@@ -106,7 +107,8 @@ class BaseLoader < Loader
106
107
  #
107
108
  def promote_entry(named_entry)
108
109
  typed_name = named_entry.typed_name
109
- if entry = @named_values[typed_name] then fail_redefine(entry); end
110
+ entry = @named_values[typed_name]
111
+ if entry then fail_redefine(entry); end
110
112
  @named_values[typed_name] = named_entry
111
113
  end
112
114
 
@@ -34,7 +34,8 @@ class Puppet::Pops::Loader::DependencyLoader < Puppet::Pops::Loader::BaseLoader
34
34
  #
35
35
  def find(typed_name)
36
36
  if typed_name.qualified?
37
- if l = index()[typed_name.name_parts[0]]
37
+ l = index()[typed_name.name_parts[0]]
38
+ if l
38
39
  l.load_typed(typed_name)
39
40
  else
40
41
  # no module entered as dependency with name matching first segment of wanted name
@@ -69,7 +70,8 @@ class Puppet::Pops::Loader::DependencyLoader < Puppet::Pops::Loader::BaseLoader
69
70
 
70
71
  def loaded_entry_in_dependency(typed_name, check_dependencies)
71
72
  if typed_name.qualified?
72
- if l = index[typed_name.name_parts[0]]
73
+ l = index[typed_name.name_parts[0]]
74
+ if l
73
75
  l.loaded_entry(typed_name)
74
76
  else
75
77
  # no module entered as dependency with name matching first segment of wanted name
@@ -26,7 +26,8 @@ module Puppet::Pops::Loader::GemSupport
26
26
  # TODO: FIND by name raises exception Gem::LoadError with list of all gems on the path
27
27
  #
28
28
  def gem_dir_from_uri(uri)
29
- unless spec = Gem::Specification.find_by_name(uri.hostname)
29
+ spec = Gem::Specification.find_by_name(uri.hostname)
30
+ unless spec
30
31
  raise ArgumentError, _("Gem not found %{uri}") % { uri: uri }
31
32
  end
32
33
  # if path given append that, else append given subdir
@@ -41,7 +42,8 @@ module Puppet::Pops::Loader::GemSupport
41
42
  # TODO: FIND by name raises exception Gem::LoadError with list of all gems on the path
42
43
  #
43
44
  def gem_dir_from_name(gem_name)
44
- unless spec = Gem::Specification.find_by_name(gem_name)
45
+ spec = Gem::Specification.find_by_name(gem_name)
46
+ unless spec
45
47
  raise ArgumentError, _("Gem not found '%{gem_name}'") % { gem_name: gem_name }
46
48
  end
47
49
  spec.full_gem_path
@@ -69,7 +69,8 @@ class Loader
69
69
  # @api public
70
70
  #
71
71
  def load(type, name)
72
- if result = load_typed(TypedName.new(type, name.to_s))
72
+ result = load_typed(TypedName.new(type, name.to_s))
73
+ if result
73
74
  result.value
74
75
  end
75
76
  end
@@ -108,7 +109,8 @@ class Loader
108
109
  # @api private
109
110
  #
110
111
  def [](typed_name)
111
- if found = get_entry(typed_name)
112
+ found = get_entry(typed_name)
113
+ if found
112
114
  found.value
113
115
  else
114
116
  nil
@@ -397,7 +397,8 @@ module LoaderPaths
397
397
  def effective_paths(type)
398
398
  smart_paths = @smart_paths
399
399
  loader = @loader
400
- unless effective_paths = smart_paths[type]
400
+ effective_paths = smart_paths[type]
401
+ unless effective_paths
401
402
  # type not yet processed, does the various directories for the type exist ?
402
403
  # Get the relative dirs for the type
403
404
  paths_for_type = LoaderPaths.relative_paths_for_type(type, loader)
@@ -44,7 +44,7 @@ class StaticLoader < Loader
44
44
 
45
45
  def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY)
46
46
  # Static loader only contains runtime types
47
- return EMPTY_ARRAY unless type == :type && name_authority == name_authority = Pcore::RUNTIME_NAME_AUTHORITY
47
+ return EMPTY_ARRAY unless type == :type && name_authority == name_authority = Pcore::RUNTIME_NAME_AUTHORITY #rubocop:disable Lint/AssignmentInCondition
48
48
 
49
49
  typed_names = type == :type && name_authority == Pcore::RUNTIME_NAME_AUTHORITY ? @loaded.keys : EMPTY_ARRAY
50
50
  block_given? ? typed_names.select { |tn| yield(tn) } : typed_names
@@ -135,7 +135,8 @@ module Interpolation
135
135
  end
136
136
 
137
137
  def get_method_and_data(data, allow_methods)
138
- if match = data.match(/^(\w+)\((?:["]([^"]+)["]|[']([^']+)['])\)$/)
138
+ match = data.match(/^(\w+)\((?:["]([^"]+)["]|[']([^']+)['])\)$/)
139
+ if match
139
140
  fail(Issues::HIERA_INTERPOLATION_METHOD_SYNTAX_NOT_ALLOWED) unless allow_methods
140
141
  key = match[1].to_sym
141
142
  data = match[2] || match[3] # double or single qouted
@@ -835,7 +835,8 @@ class Factory
835
835
  end
836
836
 
837
837
  def self.NUMBER(name_or_numeric)
838
- if n_radix = Utils.to_n_with_radix(name_or_numeric)
838
+ n_radix = Utils.to_n_with_radix(name_or_numeric)
839
+ if n_radix
839
840
  val, radix = n_radix
840
841
  if val.is_a?(Float)
841
842
  new(LiteralFloat, val)
@@ -853,7 +854,8 @@ class Factory
853
854
  # Convert input string to either a qualified name, a LiteralInteger with radix, or a LiteralFloat
854
855
  #
855
856
  def self.QNAME_OR_NUMBER(name)
856
- if n_radix = Utils.to_n_with_radix(name)
857
+ n_radix = Utils.to_n_with_radix(name)
858
+ if n_radix
857
859
  val, radix = n_radix
858
860
  if val.is_a?(Float)
859
861
  new(LiteralFloat, val)
@@ -44,7 +44,8 @@ module EppSupport
44
44
 
45
45
  # This is the lexer's main loop
46
46
  until queue.empty? && scn.eos? do
47
- if token = queue.shift || lex_token
47
+ token = queue.shift || lex_token
48
+ if token
48
49
  yield [ ctx[:after] = token[0], token[1] ]
49
50
  end
50
51
  end
@@ -85,7 +85,8 @@ module HeredocSupport
85
85
  while !scn.eos? do
86
86
  one_line = scn.scan_until(/(?:\n|\z)/)
87
87
  raise eof_error unless one_line
88
- if md = one_line.match(endline_pattern)
88
+ md = one_line.match(endline_pattern)
89
+ if md
89
90
  leading = md[1]
90
91
  has_margin = md[2] == '|'
91
92
  remove_break = md[3] == '-'
@@ -37,7 +37,8 @@ module Puppet::Pops::Parser::InterpolationSupport
37
37
  enqueue_until count
38
38
  break
39
39
  when '$'
40
- if varname = scn.scan(PATTERN_VARIABLE)
40
+ varname = scn.scan(PATTERN_VARIABLE)
41
+ if varname
41
42
  # The $ is counted towards the variable
42
43
  enqueue_completed([:DQPRE, text, after-before-1], before)
43
44
  enqueue_completed([:VARIABLE, varname, scn.pos - after + 1], after - 1)
@@ -78,7 +79,8 @@ module Puppet::Pops::Parser::InterpolationSupport
78
79
  enqueue_until count
79
80
  break
80
81
  when '$'
81
- if varname = scn.scan(PATTERN_VARIABLE)
82
+ varname = scn.scan(PATTERN_VARIABLE)
83
+ if varname
82
84
  # The $ is counted towards the variable
83
85
  enqueue_completed([:DQMID, text, after-before-1], before)
84
86
  enqueue_completed([:VARIABLE, varname, scn.pos - after + 1], after - 1)
@@ -122,7 +124,8 @@ module Puppet::Pops::Parser::InterpolationSupport
122
124
  enqueue_until count
123
125
  break
124
126
  when '$'
125
- if varname = scn.scan(PATTERN_VARIABLE)
127
+ varname = scn.scan(PATTERN_VARIABLE)
128
+ if varname
126
129
  # The $ is counted towards the variable
127
130
  enqueue_completed([:DQPRE, text, after-before-1], before)
128
131
  enqueue_completed([:VARIABLE, varname, scn.pos - after + 1], after - 1)
@@ -162,7 +165,8 @@ module Puppet::Pops::Parser::InterpolationSupport
162
165
  enqueue_until count
163
166
  break
164
167
  when '$'
165
- if varname = scn.scan(PATTERN_VARIABLE)
168
+ varname = scn.scan(PATTERN_VARIABLE)
169
+ if varname
166
170
  # The $ is counted towards the variable
167
171
  enqueue_completed([:DQMID, text, after-before-1], before)
168
172
  enqueue_completed([:VARIABLE, varname, scn.pos - after + 1], after - 1)
@@ -190,7 +194,8 @@ module Puppet::Pops::Parser::InterpolationSupport
190
194
  scn.skip(self.class::PATTERN_WS)
191
195
  queue_size = queue.size
192
196
  until scn.eos? do
193
- if token = lex_token
197
+ token = lex_token
198
+ if token
194
199
  if token.equal?(queue_base)
195
200
  # A nested #interpolate_dq call shifted the queue_base token from the @token_queue. It must
196
201
  # be put back since it is intended for the top level #interpolate_dq call only.
@@ -355,7 +355,8 @@ class Lexer2
355
355
  else
356
356
  before = scn.pos
357
357
  # regexp position is a regexp, else a div
358
- if regexp_acceptable? && value = scn.scan(PATTERN_REGEX)
358
+ value = scn.scan(PATTERN_REGEX) if regexp_acceptable?
359
+ if value
359
360
  # Ensure an escaped / was not matched
360
361
  while escaped_end(value)
361
362
  more = scn.scan_until(PATTERN_REGEX_END)
@@ -452,7 +453,8 @@ class Lexer2
452
453
  '$' => lambda do
453
454
  scn = @scanner
454
455
  before = scn.pos
455
- if value = scn.scan(PATTERN_DOLLAR_VAR)
456
+ value = scn.scan(PATTERN_DOLLAR_VAR)
457
+ if value
456
458
  emit_completed([:VARIABLE, value[1..-1].freeze, scn.pos - before], before)
457
459
  else
458
460
  # consume the $ and let higher layer complain about the error instead of getting a syntax error
@@ -703,7 +705,8 @@ class Lexer2
703
705
 
704
706
  # This is the lexer's main loop
705
707
  until queue.empty? && scn.eos? do
706
- if token = queue.shift || selector[scn.peek(1)].call
708
+ token = queue.shift || selector[scn.peek(1)].call
709
+ if token
707
710
  ctx[:after] = token[0]
708
711
  yield token
709
712
  end
@@ -177,7 +177,8 @@ class Locator
177
177
  # use cache
178
178
  return @prev_line
179
179
  end
180
- if line_nbr = ary_bsearch_i(line_index, offset)
180
+ line_nbr = ary_bsearch_i(line_index, offset)
181
+ if line_nbr
181
182
  # cache
182
183
  @prev_offset = offset
183
184
  @prev_line = line_nbr