components/ruby/puppet/patches/puppet-05-apply-auditing.patch
branchs11-update
changeset 3458 4912663e9858
parent 2928 43b3da52b84a
equal deleted inserted replaced
3455:6bba35ecb6b8 3458:4912663e9858
       
     1 Add auditing hooks for puppet apply
       
     2 
       
     3 --- puppet-3.6.2/lib/puppet/application/apply.rb.orig	2014-06-09 15:08:19.000000000 -0600
       
     4 +++ puppet-3.6.2/lib/puppet/application/apply.rb	2014-06-25 14:57:54.627534169 -0600
       
     5 @@ -1,5 +1,8 @@
       
     6  require 'puppet/application'
       
     7  require 'puppet/configurer'
       
     8 +if Facter.value(:osfamily) == "Solaris"
       
     9 +  require 'PuppetAudit'
       
    10 +end
       
    11  
       
    12  class Puppet::Application::Apply < Puppet::Application
       
    13  
       
    14 @@ -209,6 +212,12 @@
       
    15        end
       
    16  
       
    17        begin
       
    18 +        # configure auditing on Solaris
       
    19 +        if Facter.value(:osfamily) == "Solaris"
       
    20 +            audit_handle = PuppetAudit.new
       
    21 +            audit_handle.audit_start
       
    22 +        end
       
    23 +
       
    24          # Compile our catalog
       
    25          starttime = Time.now
       
    26          catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
       
    27 @@ -237,6 +246,12 @@
       
    28        rescue => detail
       
    29          Puppet.log_exception(detail)
       
    30          exit(1)
       
    31 +      ensure
       
    32 +        # clean up auditing records on Solaris
       
    33 +        if Facter.value(:osfamily) == "Solaris"
       
    34 +          audit_handle.audit_stop
       
    35 +          audit_handle.audit_teardown
       
    36 +        end
       
    37        end
       
    38      end
       
    39    end