hartmantis / clamav-chef

A Chef cookbook for the Clam AntiVirus application
11 stars 57 forks source link

Converge fails for when freshclam enabled #89

Closed blischalk closed 7 years ago

blischalk commented 7 years ago

I am trying to test out the clamav cookbook and when I the following attributes enabled:

default["clamav"]["freshclam"]["enabled"] = true default["clamav"]["clamd"]["enabled"] = true

The cookbook fails to converge with the following error:

` [2017-03-07T15:53:41+00:00] INFO: template[/etc/clamav/freshclam.conf] mode changed to 644

       - change mode from '0444' to '0644'
       - change group from 'adm' to 'clamav'
   [2017-03-07T15:53:41+00:00] INFO: template[/etc/clamav/freshclam.conf] not queuing delayed action restart on service[clamav-freshclam] (delayed), as it's already been queued
     * execute[freshclam] action run[2017-03-07T15:53:41+00:00] INFO: Processing execute[freshclam] action run (clamav::freshclam line 55)

       [execute] ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
          ERROR: /var/log/clamav/freshclam.log is locked by another process

       ================================================================================
       Error executing action `run` on resource 'execute[freshclam]'
       ================================================================================

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       Expected process to exit with [0], but received '62'
       ---- Begin output of freshclam ----
       STDOUT: ERROR: /var/log/clamav/freshclam.log is locked by another process
       STDERR: ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
       ---- End output of freshclam ----
       Ran freshclam returned 62

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/clamav/recipes/freshclam.rb

        55: execute 'freshclam' do
        56:   command 'freshclam'
        57:   creates ::File.join(node['clamav']['database_directory'], 'daily.cvd')
        58:   not_if { node['clamav']['freshclam']['skip_initial_run'] }
        59: end

       Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cache/cookbooks/clamav/recipes/freshclam.rb:55:in `from_file'

       execute("freshclam") do
         action [:run]
         retries 0
         retry_delay 2
         default_guard_interpreter :execute
         command "freshclam"
         backup 5
         creates "/var/lib/clamav/daily.cvd"
         returns 0
         user nil
         declared_type :execute
         cookbook_name "clamav"
         recipe_name "freshclam"
         not_if { #code block }
       end

       Platform:
       ---------
       x86_64-linux

`

blischalk commented 7 years ago

I noticed the option freshclam skip_initial_run. Enabling this option seems to avoid the issue.