Sha256: 0ddd2d6e10db71626ffc940d1c9257a56b0d37e0926d78a44b915075cd3f39a1

Contents?: true

Size: 1.52 KB

Versions: 295

Compression:

Stored size: 1.52 KB

Contents

require 'puppet'

# A module for building AtFork handlers. These handlers are objects providing
# pre/post fork callbacks modeled after those registered by the `pthread_atfork`
# function.
# Currently there are two AtFork handler implementations:
# - a noop implementation used on all platforms except Solaris (and possibly
#   even there as a fallback)
# - a Solaris implementation which ensures the forked process runs in a different
#   contract than the parent process. This is necessary for agent runs started by
#   the puppet agent service to be able to restart that service without being
#   killed in the process as a consequence of running in the same contract as the
#   service.
module Puppet::Util::AtFork
  @handler_class = loop do
    if Facter.value(:operatingsystem) == 'Solaris'
      begin
        require 'puppet/util/at_fork/solaris'
        # using break to return a value from the loop block
        break Puppet::Util::AtFork::Solaris
      rescue LoadError => detail
        Puppet.log_exception(detail, _('Failed to load Solaris implementation of the Puppet::Util::AtFork handler. Child process contract management will be unavailable, which means that agent runs executed by the puppet agent service will be killed when they attempt to restart the service.'))
        # fall through to use the no-op implementation
      end
    end

    require 'puppet/util/at_fork/noop'
    # using break to return a value from the loop block
    break Puppet::Util::AtFork::Noop
  end

  def self.get_handler
    @handler_class.new
  end
end

Version data entries

295 entries across 295 versions & 2 rubygems

Version Path
puppet-5.5.22 lib/puppet/util/at_fork.rb
puppet-5.5.22-x86-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.22-x64-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.22-universal-darwin lib/puppet/util/at_fork.rb
puppet-5.5.21 lib/puppet/util/at_fork.rb
puppet-5.5.21-x86-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.21-x64-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.21-universal-darwin lib/puppet/util/at_fork.rb
puppet-5.5.20 lib/puppet/util/at_fork.rb
puppet-5.5.20-x86-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.20-x64-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.20-universal-darwin lib/puppet/util/at_fork.rb
puppet-5.5.19 lib/puppet/util/at_fork.rb
puppet-5.5.19-x86-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.19-x64-mingw32 lib/puppet/util/at_fork.rb
puppet-5.5.19-universal-darwin lib/puppet/util/at_fork.rb
puppet-6.14.0 lib/puppet/util/at_fork.rb
puppet-6.14.0-x86-mingw32 lib/puppet/util/at_fork.rb
puppet-6.14.0-x64-mingw32 lib/puppet/util/at_fork.rb
puppet-6.14.0-universal-darwin lib/puppet/util/at_fork.rb