Skip to content

Cookbook does not ensure presence of postfix table dbs #117

@explody

Description

@explody

During testing of a wrapper cookbook, we very quickly noticed that if the .db files corresponding to a postfix table are deleted, they are not replaced unless the content of the table file is changed, which triggers execution of postmap again.

Obviously, nothing should be deleting these files but this makes it really difficult to ensure consistency of the state declared by the cookbook.

There's a simple fix - in the recipes for the various files, like transport.rb, instead of:

execute 'update-postfix-transport' do
  command "postmap #{node['postfix']['transport_db']}"
  environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
  action :nothing
end

It could be:

execute 'update-postfix-transport' do
  command "postmap #{node['postfix']['transport_db']}"
  environment PATH: "#{ENV['PATH']}:/opt/omni/bin:/opt/omni/sbin" if platform_family?('omnios')
  action File.exist?("#{node['postfix']['transport_db'].db") ? :nothing : :run
end

Which maintains all the current behavior but also runs postmap if the db file is missing.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions