Comments (11)
The workaround is to override all of the paths for the node attribute like so:
override["postgresql"]["version"] = "9.2"
override["postgresql"]["data_directory"] = "/var/lib/postgresql/#{node["postgresql"]["version"]}/main"
override["postgresql"]["hba_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_hba.conf"
override["postgresql"]["ident_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_ident.conf"
override["postgresql"]["external_pid_file"] = "/var/run/postgresql/#{node["postgresql"]["version"]}-main.pid"
from chef-postgresql.
I suspect that this has gone unnoticed due to Chef's ordering of loading attributes - so it can sometimes work. From the Chef wiki: "When Chef loads cookbook attribute files, it does so in alphabetical order for all the cookbooks". See here.
from chef-postgresql.
@freshtonic thanks for the report. This is the first I have heard of this issue occurring. Would you be willing to submit a pull request to update the README with your notes?
Thanks for your time!
from chef-postgresql.
Sure, no problem.
from chef-postgresql.
I'll try my hand at a pull request that fixes the issue rather than works around it.
from chef-postgresql.
@phlipper I think the correct solution (at least until Opscode give us lazy attribute evaluation) is to perform the interpolation entirely in the recipes. For some files this already happens: pg_version is interpolated into other strings right there in the recipe.
I'm not familiar with other's specific Postgres deployment idiosynracies, and so I don't know who's downstream cookbooks will break if I make the recipes self-consistent with respect to filename generation.
Is this a reasonable approach?
from chef-postgresql.
@freshtonic I can't totally envision what you mean at the moment, but it sounds like a reasonable approach :) Go ahead and take a stab at it and we'll use that as a starting point to work through this issue.
Thanks so much for your time and help, I really appreciate it!
from chef-postgresql.
@freshtonic have you had an opportunity to look in to this issue any more?
from chef-postgresql.
@phlipper the core problem is that changing
default["postgresql"]["version"]
to another value in the attributes file will not cause
# FILE LOCATIONS
default["postgresql"]["data_directory"] = "/var/lib/postgresql/#{node["postgresql"]["version"]}/main"
default["postgresql"]["hba_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_hba.conf"
default["postgresql"]["ident_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_ident.conf"
default["postgresql"]["external_pid_file"] = "/var/run/postgresql/#{node["postgresql"]["version"]}-main.pid"
to be recalculated.
Right now, the default postgresql version is 9.2. If a user of this recipe wants to install 9.1, it is insufficient to override just the postgresql version attribute. It is required that the user also override the FILE LOCATIONS attributes in their own recipes too. Like so:
override["postgresql"]["version"] = "9.2"
# FILE LOCATIONS
override["postgresql"]["data_directory"] = "/var/lib/postgresql/#{node["postgresql"]["version"]}/main"
override["postgresql"]["hba_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_hba.conf"
override["postgresql"]["ident_file"] = "/etc/postgresql/#{node["postgresql"]["version"]}/main/pg_ident.conf"
override["postgresql"]["external_pid_file"] = "/var/run/postgresql/#{node["postgresql"]["version"]}-main.pid"
All I can offer is a documentation fix in the README that informs users that they need to override the derived attributes too.
This cannot be solved cleanly (i.e. by overriding only the version attribute) until the version 11.0 of chef is released. My understanding is that a user's override will be applied earlier in attribute resolution, so in theory overriding only the version (in this case) will work fine.
See This Chef Issue
from chef-postgresql.
Made a pull request #14
from chef-postgresql.
Closed by #14
from chef-postgresql.
Related Issues (20)
- Submitting to Chef community? HOT 5
- pg_hba error with 9.4 HOT 2
- NoMethodError: undefined method `sensitive' HOT 2
- Berkshelf install? HOT 2
- createlang cannot find plperl HOT 3
- gem install pg error
- Conditional enablement of service HOT 1
- prevent cluster init / create_main_cluster? HOT 3
- Fix filename of preferences.d and integration tests HOT 1
- Getting RuntimeErrors when attempting to locate files in `templates/default` directory HOT 3
- cannot load such file -- pg when creating a database
- Backports error on Debian 8 (jessie) HOT 1
- Minified recipe HOT 4
- Database server build not working on Ubuntu Server 15.04 HOT 2
- Replication support HOT 1
- Any plans to make this support RedHat?
- Spec failure dependent on execution order HOT 1
- Postgres 9.5 compatibility HOT 3
- Cleanup PR
- error with apt HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chef-postgresql.