Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/7.x' into merge_nov_28
Browse files Browse the repository at this point in the history
* upstream/7.x:
  (PUP-11772) Resolve Security/Eval
  (PUP-11772) Resolve Security/Open
  (PUP-11593) Gentoo: Set systemd as default provider
  (PUP-11986) Add Amazon Linux package mapping
  (maint) Remove logic for unsupported OS
  Make cache and values fully thread-safe
  • Loading branch information
joshcooper committed Nov 28, 2023
2 parents bc32a27 + 7e0a01a commit 521808e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package_name = {'el' => 'httpd',
'centos' => 'httpd',
'fedora' => 'httpd',
'amazon' => 'httpd',
'sles' => 'apache2',
'debian' => 'cron', # apache2 does not create systemd service symlinks in Debian
'ubuntu' => 'cron', # See https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1447807
Expand All @@ -43,13 +44,6 @@
package { '#{package_name[platform]}':
ensure => present,
}
if ($os['name'] == 'Fedora') and ($os['release']['major'] == '23') {
package{'libnghttp2':
ensure => latest,
install_options => '--best',
before => Package['httpd'],
}
}
}
manifest_service_masked = %Q{
service { '#{package_name[platform]}':
Expand Down
18 changes: 16 additions & 2 deletions lib/puppet/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require 'forwardable'
require 'fileutils'
require 'concurrent'
require_relative 'concurrent/lock'

# The class for handling configuration files.
class Puppet::Settings
Expand Down Expand Up @@ -147,8 +148,21 @@ def initialize
@configuration_file = nil

# And keep a per-environment cache
@cache = Concurrent::Hash.new { |hash, key| hash[key] = Concurrent::Hash.new }
@values = Concurrent::Hash.new { |hash, key| hash[key] = Concurrent::Hash.new }
# We can't use Concurrent::Map because we want to preserve insertion order
@cache_lock = Puppet::Concurrent::Lock.new
@cache = Concurrent::Hash.new do |hash, key|
@cache_lock.synchronize do
break hash[key] if hash.key?(key)
hash[key] = Concurrent::Hash.new
end
end
@values_lock = Puppet::Concurrent::Lock.new
@values = Concurrent::Hash.new do |hash, key|
@values_lock.synchronize do
break hash[key] if hash.key?(key)
hash[key] = Concurrent::Hash.new
end
end

# The list of sections we've used.
@used = []
Expand Down

0 comments on commit 521808e

Please sign in to comment.