sous-chefs / confluence

Development repository for the confluence cookbook
https://supermarket.chef.io/cookbooks/confluence
Other
43 stars 46 forks source link

Proposal: Improve data bag approach #74

Closed legal90 closed 8 years ago

legal90 commented 8 years ago

This PR contains a breaking change, so it can be merged only in the scope of major version bump.

1) Add attributes ['confluence']['data_bag_name'] and ['confluence']['data_bag_item']. Finally, they will be optional and users will be able to change data bag and item names.

2) Allow to use as well as encrypted and not encrypted data bags regardless of Chef Client type. Breaking: In old Chef clients (< 12.0.0) data_bag_item method couldn't be used for encrypted data bag. So, in this case settings will be defined by attributes, not by data bag values.

3) Use confluence nesting level in data bag instead of 'local' or node.chef_environment. At this moment it is not predictable - the library method tries to fetch local nested dictionary if it is called by Chef Solo. Otherwise, it fetches dictionary node.environment. I suggest to use an explicit name, "confluence", which is the cookbook name. Also, it will be easier for users to understand how data bag values are overriding the appropriate attributes. The logic is: "If I want to override ['confluence']['database']['password'] and ['confluence']['database']['user'] via data bag, then I have to set these values on the same nesting level in the data bag". Example:

{
  "id": "confluence",
  "confluence": {
    "database": {
      "user": "some_user",
      "password": "some_password"
    }
  }
}

Breaking: Those who use confluence/confluence data bag with this cookbook, will have to change the name of the nested dictionary from their current Chef environment to "confluence". If they still want to have environment-specific configuration, they can rename the data bag item to env name and then override this attribute:

node.set['confluence']['data_bag_item'] = node.chef_environment

@racktear @Kasen @patcon Please, take a look. Suggestions are welcome!

@mvdkleijn @linc01n I'd like to suggest you to do the similar changes in JIRA and Stash cookbooks appropriately. I'm ready to send PR to your cookbooks if you don't mind.

Kasen commented 8 years ago

:+1:

linc01n commented 8 years ago

@legal90 PR is welcome ! It is good to have a breaking change before stash 4.0 big release. Thanks!

patcon commented 8 years ago

Not using the databag feature myself yet, but looks sensible!

lock[bot] commented 5 years ago

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.