Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookbook does not ensure presence of postfix table dbs #117

Open
explody opened this issue Sep 20, 2015 · 3 comments
Open

Cookbook does not ensure presence of postfix table dbs #117

explody opened this issue Sep 20, 2015 · 3 comments

Comments

@explody
Copy link

explody commented Sep 20, 2015

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

@cheeseplus
Copy link

cheeseplus commented Feb 22, 2017

So would you want to recreate these in the event of a failure? Wouldn't you want it to blow up?

@iennae
Copy link
Contributor

iennae commented May 2, 2017

We'd love to better understand the appropriate action to take here. If you still have thoughts on this please reopen. Thanks!

@iennae iennae closed this as completed May 2, 2017
@explody
Copy link
Author

explody commented May 26, 2017

Oh, sorry, I didn't see the notifications. IMHO, the appropriate action would be like the code snip above where the update will run if the source (text) has changed or output (db map) is missing.

@cheeseplus I get your point but in this case, no, I wouldn't want it to blow up. If one were managing the files manually and restarted postfix or ran 'newaliases' for example, the DBs would be automatically recreated if missing. There's pretty much no scenario in which I'd want the text to exist without the corresponding DB.

It's a corner case, I think, but the overhead is minuscule and since the standard tools don't make a distinction between 'create' and 'update', it makes sense to have the resource behave similarly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants