components/ruby/puppet/patches/puppet-04-agent-auditing.patch
changeset 7565 48aa82a0931f
parent 5860 afd31ba91ee9
equal deleted inserted replaced
7564:f958607559a6 7565:48aa82a0931f
       
     1 Not submitted to upstream
     1 Add auditing support to agent execution
     2 Add auditing support to agent execution
     2 
     3 
     3 --- puppet-3.8.6/lib/puppet/agent.rb.orig	2016-04-19 14:23:14.948120246 -0700
     4 diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb
     4 +++ puppet-3.8.6/lib/puppet/agent.rb	2016-04-19 14:24:09.178244630 -0700
     5 --- a/lib/puppet/agent.rb
     5 @@ -1,4 +1,11 @@
     6 +++ b/lib/puppet/agent.rb
     6 +#######################################################################
     7 @@ -1,5 +1,8 @@
     7 +# Oracle has modified the originally distributed contents of this file.
       
     8 +#######################################################################
       
     9 +
       
    10  require 'puppet/application'
     8  require 'puppet/application'
       
     9  require 'puppet/error'
    11 +if Facter.value(:osfamily) == "Solaris"
    10 +if Facter.value(:osfamily) == "Solaris"
    12 +  require 'PuppetAudit'
    11 +  require 'PuppetAudit'
    13 +end
    12 +end
    14  
    13  
    15  # A general class for triggering a run of another
    14  # A general class for triggering a run of another
    16  # class.
    15  # class.
    17 @@ -37,6 +44,11 @@
    16 @@ -30,11 +33,15 @@ class Puppet::Agent
    18        return
       
    19      end
       
    20  
    17  
       
    18    # Perform a run with our client.
       
    19    def run(client_options = {})
       
    20 +    # Always start an audit record
    21 +    if Facter.value(:osfamily) == "Solaris"
    21 +    if Facter.value(:osfamily) == "Solaris"
    22 +        audit_handle = PuppetAudit.new
    22 +        audit_handle = PuppetAudit.new
    23 +        audit_handle.audit_start
    23 +        audit_handle.audit_start
    24 +    end
    24 +    end
    25 +
    25      if disabled?
       
    26        Puppet.notice "Skipping run of #{client_class}; administratively disabled (Reason: '#{disable_message}');\nUse 'puppet agent --enable' to re-enable."
       
    27        return
       
    28      end
       
    29 -
    26      result = nil
    30      result = nil
    27      block_run = Puppet::Application.controlled_run do
    31      block_run = Puppet::Application.controlled_run do
    28        splay client_options.fetch :splay, Puppet[:splay]
    32        splay client_options.fetch :splay, Puppet[:splay]
    29 @@ -52,6 +64,10 @@
    33 @@ -55,6 +62,12 @@ class Puppet::Agent
    30            end
       
    31          end
       
    32        end
       
    33 +      if Facter.value(:osfamily) == "Solaris"
       
    34 +          audit_handle.audit_stop
       
    35 +          audit_handle.audit_teardown
       
    36 +      end
       
    37        true
       
    38      end
    34      end
    39      Puppet.notice "Shutdown/restart in progress (#{Puppet::Application.run_status.inspect}); skipping run" unless block_run
    35      Puppet.notice "Shutdown/restart in progress (#{Puppet::Application.run_status.inspect}); skipping run" unless block_run
       
    36      result
       
    37 +  ensure
       
    38 +    # Always stop an audit record
       
    39 +    if Facter.value(:osfamily) == "Solaris"
       
    40 +        audit_handle.audit_stop
       
    41 +        audit_handle.audit_teardown
       
    42 +    end
       
    43    end
       
    44  
       
    45    def stopping?