New Charm: pgbouncer
Bug #1046318 reported by
Haw Loeung
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Juju Charms Collection |
Fix Released
|
Wishlist
|
charmers |
Bug Description
Hi,
I'd like to submit a new charm to the Juju Charm Store. This is my first attempt at charm writing so your feedback appreciated.
lp:~hloeung/charms/precise/pgbouncer/trunk
Thanks,
Haw
Related branches
tags: | added: canonical-webops-juju |
summary: |
- pgbouncer charm + New Charm: pgbouncer |
Changed in charms: | |
assignee: | Haw Loeung (hloeung) → Alexander List (alexlist) |
status: | Incomplete → In Progress |
Changed in charms: | |
status: | New → Fix Committed |
Changed in charms: | |
assignee: | Alexander List (alexlist) → charmers (charmers) |
Changed in charms: | |
status: | Fix Committed → New |
To post a comment you must log in.
Hello Haw! Thanks for submitting this charm, it will be a great addition to the charm store.
***
Blockers:
[1]* Since pgbouncer speaks pgsql, it shouldn't require any special interface like 'pgbouncer' to relate to it. Because of that, you can just use 'interface' pgsql on both sides.
[2]* Both relations being called 'db' may seem to "work", but its actually a bug if it even works. The hooks you have, db-relation-* are doing things for the different sides of the relation, and so are doing things in a very confusing way. While relations are always directional, so you can have this situation without an error, it doesn't actually speak to what you are providing or requiring. Since it is a proxy, I'd change the relations to:
provides:
db-proxy:
interface: pgsql
requires:
backend-db:
interface: pgsql
db-proxy should implement relation-sets that mimic the behavior of the pgsql charm, using relation-set to tell clients how to connect. Backend-db should work more or less like your current 'db' relations.
***
Minors:
scripts/ common: update_ config
[3] config} .new
# Copy existing config file to preserve permissions.
cp -a $pgbouncer_config ${pgbouncer_
This is a predictable temp file creation. While /etc/pgbouncer should remain root-writable-only, if that changed, this would allow any user who can write a symlink in that dir to overwrite files as root. Would suggest using 'mktemp' to generate a temp file and then rename it over top of the existing file.
[4] generate. py does, perhaps consider using that to avoid more code. :)
Also, cheetah has a command line tool that can do what the template-
scripts/ common: update_ init_script
[5] pgbouncer, including the ulimit. The advantage there is that you can just write the whole file instead of having to do any sed gymnastics.
This seems unnecessary. You can very easily set the options in /etc/default/
[6]
hooks/start,stop:
These are not idempotent. You need to not fail if the service is already started in start, and likewise, don't fail if it is already stopped in stop.
[7] charm:
hooks/upgrade-
one could argue that the charm would be simpler if you just symlinked upgrade-charm -> install and added a 'service pgbouncer reload' to the bottom of install.