puppet 7.11.0-universal-darwin → 7.14.0-universal-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +1 -1
  3. data/Gemfile +2 -2
  4. data/Gemfile.lock +24 -19
  5. data/ext/project_data.yaml +1 -1
  6. data/lib/puppet/application/lookup.rb +78 -24
  7. data/lib/puppet/concurrent/thread_local_singleton.rb +5 -3
  8. data/lib/puppet/configurer.rb +74 -25
  9. data/lib/puppet/defaults.rb +20 -1
  10. data/lib/puppet/face/generate.rb +2 -0
  11. data/lib/puppet/file_serving/metadata.rb +3 -0
  12. data/lib/puppet/file_system/file_impl.rb +7 -7
  13. data/lib/puppet/file_system/jruby.rb +1 -1
  14. data/lib/puppet/file_system/path_pattern.rb +10 -15
  15. data/lib/puppet/file_system/uniquefile.rb +1 -1
  16. data/lib/puppet/file_system/windows.rb +4 -4
  17. data/lib/puppet/file_system.rb +3 -2
  18. data/lib/puppet/functions/versioncmp.rb +6 -2
  19. data/lib/puppet/generate/type.rb +9 -0
  20. data/lib/puppet/graph/simple_graph.rb +2 -1
  21. data/lib/puppet/http/client.rb +1 -1
  22. data/lib/puppet/http/redirector.rb +5 -0
  23. data/lib/puppet/node.rb +1 -1
  24. data/lib/puppet/parser/resource.rb +1 -1
  25. data/lib/puppet/pops/evaluator/closure.rb +7 -5
  26. data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +1 -0
  27. data/lib/puppet/pops/parser/code_merger.rb +4 -4
  28. data/lib/puppet/pops/parser/egrammar.ra +2 -0
  29. data/lib/puppet/pops/parser/eparser.rb +574 -558
  30. data/lib/puppet/pops/serialization/to_data_converter.rb +6 -18
  31. data/lib/puppet/pops/validation/checker4_0.rb +7 -2
  32. data/lib/puppet/provider/package/pkg.rb +10 -0
  33. data/lib/puppet/provider/service/init.rb +5 -4
  34. data/lib/puppet/provider/user/useradd.rb +20 -0
  35. data/lib/puppet/resource/catalog.rb +1 -1
  36. data/lib/puppet/resource/type_collection.rb +21 -17
  37. data/lib/puppet/resource.rb +38 -5
  38. data/lib/puppet/ssl/verifier.rb +3 -1
  39. data/lib/puppet/transaction/persistence.rb +22 -12
  40. data/lib/puppet/type/file/data_sync.rb +1 -1
  41. data/lib/puppet/type/file/group.rb +8 -1
  42. data/lib/puppet/type/file/owner.rb +8 -1
  43. data/lib/puppet/type/service.rb +8 -3
  44. data/lib/puppet/type/user.rb +41 -39
  45. data/lib/puppet/util/autoload.rb +1 -1
  46. data/lib/puppet/util/json.rb +20 -0
  47. data/lib/puppet/util/log.rb +7 -2
  48. data/lib/puppet/util/monkey_patches.rb +26 -2
  49. data/lib/puppet/util/package.rb +25 -16
  50. data/lib/puppet/util/windows/service.rb +0 -5
  51. data/lib/puppet/util/windows.rb +3 -0
  52. data/lib/puppet/util/yaml.rb +16 -1
  53. data/lib/puppet/version.rb +1 -1
  54. data/lib/puppet.rb +1 -0
  55. data/locales/puppet.pot +5 -9737
  56. data/man/man5/puppet.conf.5 +21 -2
  57. data/man/man8/puppet-agent.8 +1 -1
  58. data/man/man8/puppet-apply.8 +1 -1
  59. data/man/man8/puppet-catalog.8 +1 -1
  60. data/man/man8/puppet-config.8 +1 -1
  61. data/man/man8/puppet-describe.8 +1 -1
  62. data/man/man8/puppet-device.8 +1 -1
  63. data/man/man8/puppet-doc.8 +1 -1
  64. data/man/man8/puppet-epp.8 +1 -1
  65. data/man/man8/puppet-facts.8 +1 -1
  66. data/man/man8/puppet-filebucket.8 +1 -1
  67. data/man/man8/puppet-generate.8 +1 -1
  68. data/man/man8/puppet-help.8 +1 -1
  69. data/man/man8/puppet-lookup.8 +9 -6
  70. data/man/man8/puppet-module.8 +1 -1
  71. data/man/man8/puppet-node.8 +1 -1
  72. data/man/man8/puppet-parser.8 +1 -1
  73. data/man/man8/puppet-plugin.8 +1 -1
  74. data/man/man8/puppet-report.8 +1 -1
  75. data/man/man8/puppet-resource.8 +1 -1
  76. data/man/man8/puppet-script.8 +1 -1
  77. data/man/man8/puppet-ssl.8 +1 -1
  78. data/man/man8/puppet.8 +2 -2
  79. data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +2 -1
  80. data/spec/fixtures/unit/forge/bacula.json +1 -1
  81. data/spec/integration/application/agent_spec.rb +28 -0
  82. data/spec/integration/application/lookup_spec.rb +32 -6
  83. data/spec/integration/parser/pcore_resource_spec.rb +20 -0
  84. data/spec/shared_contexts/l10n.rb +5 -0
  85. data/spec/unit/application/lookup_spec.rb +131 -10
  86. data/spec/unit/concurrent/thread_local_singleton_spec.rb +39 -0
  87. data/spec/unit/configurer_spec.rb +167 -60
  88. data/spec/unit/face/generate_spec.rb +64 -0
  89. data/spec/unit/file_system/uniquefile_spec.rb +7 -1
  90. data/spec/unit/file_system_spec.rb +34 -4
  91. data/spec/unit/forge/module_release_spec.rb +3 -3
  92. data/spec/unit/functions/versioncmp_spec.rb +40 -4
  93. data/spec/unit/http/client_spec.rb +58 -1
  94. data/spec/unit/network/formats_spec.rb +6 -0
  95. data/spec/unit/node_spec.rb +6 -0
  96. data/spec/unit/pops/parser/parse_containers_spec.rb +2 -2
  97. data/spec/unit/pops/serialization/to_from_hr_spec.rb +0 -58
  98. data/spec/unit/pops/validator/validator_spec.rb +5 -0
  99. data/spec/unit/provider/package/pkg_spec.rb +15 -0
  100. data/spec/unit/provider/service/gentoo_spec.rb +6 -5
  101. data/spec/unit/provider/service/init_spec.rb +15 -9
  102. data/spec/unit/provider/service/openwrt_spec.rb +21 -29
  103. data/spec/unit/provider/service/redhat_spec.rb +3 -2
  104. data/spec/unit/provider/user/useradd_spec.rb +40 -0
  105. data/spec/unit/resource/catalog_spec.rb +14 -1
  106. data/spec/unit/resource_spec.rb +58 -2
  107. data/spec/unit/transaction/persistence_spec.rb +51 -0
  108. data/spec/unit/type/file/group_spec.rb +7 -0
  109. data/spec/unit/type/file/owner_spec.rb +7 -0
  110. data/spec/unit/type/service_spec.rb +27 -0
  111. data/spec/unit/type/user_spec.rb +67 -45
  112. data/spec/unit/util/autoload_spec.rb +25 -8
  113. data/spec/unit/util/json_spec.rb +126 -0
  114. data/spec/unit/util/yaml_spec.rb +37 -13
  115. metadata +15 -5
@@ -1,6 +1,13 @@
1
+ # frozen_string_literal: true
1
2
  module Puppet::Util::Package
2
- def versioncmp(version_a, version_b)
3
+ def versioncmp(version_a, version_b, ignore_trailing_zeroes = false)
3
4
  vre = /[-.]|\d+|[^-.\d]+/
5
+
6
+ if ignore_trailing_zeroes
7
+ version_a = normalize(version_a)
8
+ version_b = normalize(version_b)
9
+ end
10
+
4
11
  ax = version_a.scan(vre)
5
12
  bx = version_b.scan(vre)
6
13
 
@@ -8,24 +15,26 @@ module Puppet::Util::Package
8
15
  a = ax.shift
9
16
  b = bx.shift
10
17
 
11
- if( a == b ) then next
12
- elsif (a == '-' && b == '-') then next
13
- elsif (a == '-') then return -1
14
- elsif (b == '-') then return 1
15
- elsif (a == '.' && b == '.') then next
16
- elsif (a == '.' ) then return -1
17
- elsif (b == '.' ) then return 1
18
- elsif (a =~ /^\d+$/ && b =~ /^\d+$/) then
19
- if( a =~ /^0/ or b =~ /^0/ ) then
20
- return a.to_s.upcase <=> b.to_s.upcase
21
- end
18
+ next if a == b
19
+ return -1 if a == '-'
20
+ return 1 if b == '-'
21
+ return -1 if a == '.'
22
+ return 1 if b == '.'
23
+ if a =~ /^\d+$/ && b =~ /^\d+$/
24
+ return a.to_s.upcase <=> b.to_s.upcase if a =~ /^0/ || b =~ /^0/
22
25
  return a.to_i <=> b.to_i
23
- else
24
- return a.upcase <=> b.upcase
25
26
  end
27
+ return a.upcase <=> b.upcase
26
28
  end
27
- version_a <=> version_b;
29
+ version_a <=> version_b
28
30
  end
29
-
30
31
  module_function :versioncmp
32
+
33
+ def self.normalize(version)
34
+ version = version.split('-')
35
+ version.first.sub!(/([\.0]+)$/, '')
36
+
37
+ version.join('-')
38
+ end
39
+ private_class_method :normalize
31
40
  end
@@ -18,11 +18,6 @@ module Puppet::Util::Windows
18
18
  include Puppet::FFI::Windows::Functions
19
19
  extend Puppet::FFI::Windows::Functions
20
20
 
21
- # integer value of the floor for timeouts when waiting for service pending states.
22
- # puppet will wait the length of dwWaitHint if it is longer than this value, but
23
- # no shorter
24
- DEFAULT_TIMEOUT = 30
25
-
26
21
  # Returns true if the service exists, false otherwise.
27
22
  #
28
23
  # @param [String] service_name name of the service
@@ -10,6 +10,9 @@ module Puppet::Util::Windows
10
10
  module File; end
11
11
  module Registry
12
12
  end
13
+ module Service
14
+ DEFAULT_TIMEOUT = 30
15
+ end
13
16
  module SID
14
17
  class Principal; end
15
18
  end
@@ -24,7 +24,11 @@ module Puppet::Util::Yaml
24
24
  # @raise [YamlLoadException] If deserialization fails.
25
25
  # @return The parsed YAML, which can be Hash, Array or scalar types.
26
26
  def self.safe_load(yaml, allowed_classes = [], filename = nil)
27
- data = YAML.safe_load(yaml, allowed_classes, [], true, filename)
27
+ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0')
28
+ data = YAML.safe_load(yaml, permitted_classes: allowed_classes, aliases: true, filename: filename)
29
+ else
30
+ data = YAML.safe_load(yaml, allowed_classes, [], true, filename)
31
+ end
28
32
  data = false if data.nil?
29
33
  data
30
34
  rescue ::Psych::DisallowedClass => detail
@@ -42,6 +46,17 @@ module Puppet::Util::Yaml
42
46
  safe_load(yaml, allowed_classes, filename)
43
47
  end
44
48
 
49
+ # Safely load the content from a file as YAML if
50
+ # contents are in valid format. This method does not
51
+ # raise error but returns `nil` when invalid file is
52
+ # given.
53
+ def self.safe_load_file_if_valid(filename, allowed_classes = [])
54
+ safe_load_file(filename, allowed_classes)
55
+ rescue YamlLoadError, ArgumentError, Errno::ENOENT => detail
56
+ Puppet.debug("Could not retrieve YAML content from '#{filename}': #{detail.message}")
57
+ nil
58
+ end
59
+
45
60
  def self.dump(structure, filename)
46
61
  Puppet::FileSystem.replace_file(filename, 0660) do |fh|
47
62
  YAML.dump(structure, fh)
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
 
8
8
  module Puppet
9
- PUPPETVERSION = '7.11.0'
9
+ PUPPETVERSION = '7.14.0'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and
data/lib/puppet.rb CHANGED
@@ -355,3 +355,4 @@ require_relative 'puppet/util/storage'
355
355
  require_relative 'puppet/file_bucket/file'
356
356
  require_relative 'puppet/plugins/configuration'
357
357
  require_relative 'puppet/pal/pal_api'
358
+ require_relative 'puppet/node/facts'