Code Monkey home page Code Monkey logo

Comments (5)

legal90 avatar legal90 commented on June 5, 2024

@patcon I've made it recently just in order to follow the recommendations from Chef how libraries should look like:
https://www.chef.io/blog/2014/03/12/writing-libraries-in-chef-cookbooks/
https://docs.chef.io/libraries.html
I was also inspired by examples from mysql , postgresql cookbooks.

Actually, these helpers methods are designed for usage in the same cookbook. There is no need to call merge_confluence_settings in wrapper cookbooks.

from confluence.

patcon avatar patcon commented on June 5, 2024

Actually, these helpers methods are designed for usage in the same cookbook. There is no need to call merge_confluence_settings in wrapper cookbooks.

heh. i beg to differ :) I am calling them in a wrapper cookbook (for manipulating config files, doing restore from backup, etc), which is totally reasonable, right? otherwise the node object might differ from the settings hash, and attributes in the wrapper wouldn't match the actual cookbook

from confluence.

patcon avatar patcon commented on June 5, 2024

For example, if I want to talk to the database in my wrapper cookbook, I need to recreate the logic in here, including loading the merged settings hash:
https://github.com/bflad/chef-confluence/blob/master/recipes/database.rb

I'd much rather replace all the repetition with DRYness:

# my_confluence/recipes/restore.rb
settings = Confluence.merge_confluence_settings

postgresql_database settings['database']['name'] do
  connection Confluence.database_connection
  owner settings['database']['user']
  action [:drop, :create]
end

Is this unreasonable?

from confluence.

bflad avatar bflad commented on June 5, 2024

I think it's reasonable that this cookbook provides external cookbooks a
method for retrieving the finished product of determining the settings just
like the cookbook internally uses so they don't have to reinvent the wheel.

On Wed, Sep 30, 2015, 16:31 Patrick Connolly [email protected]
wrote:

For example, if I want to talk to the database in my wrapper cookbook, I
need to recreate the logic in here, including loading the merged settings
hash:
https://github.com/bflad/chef-confluence/blob/master/recipes/database.rb

I'd much rather replace all the repetition with DRYness:

my_confluence/recipes/restore.rb

settings = Confluence.merge_confluence_settings

postgresql_database settings['database']['name'] do
connection Confluence.database_connection
owner settings['database']['user']
action [:drop, :create]end

Is this unreasonable?


Reply to this email directly or view it on GitHub
#55 (comment)
.

from confluence.

lock avatar lock commented on June 5, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from confluence.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.