Merge lp:~thedac/charms/precise/errors/fix-multiple-app-server-races into lp:~daisy-pluckers/charms/precise/errors/trunk

Proposed by David Ames
Status: Merged
Merged at revision: 37
Proposed branch: lp:~thedac/charms/precise/errors/fix-multiple-app-server-races
Merge into: lp:~daisy-pluckers/charms/precise/errors/trunk
Diff against target: 44 lines (+16/-2)
2 files modified
config.yaml (+5/-0)
hooks/postgres (+11/-2)
To merge this branch: bzr merge lp:~thedac/charms/precise/errors/fix-multiple-app-server-races
Reviewer Review Type Date Requested Status
Daisy Pluckers Pending
Review via email: mp+213350@code.launchpad.net

Description of the change

Fix problems with multiple appservers.
Use role account for db ownership.
Wait for allowed-hosts to be set on the relation before proceeding

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2014-03-19 17:16:45 +0000
+++ config.yaml 2014-03-28 23:33:54 +0000
@@ -58,6 +58,11 @@
58 default: 'credentials_cache'58 default: 'credentials_cache'
59 description: |59 description: |
60 The name of the database to store OpenID credential information in.60 The name of the database to store OpenID credential information in.
61 credentials-database-role:
62 type: string
63 default: 'credentials_cache'
64 description: |
65 The role name that will own the database.
61 repository:66 repository:
62 type: string67 type: string
63 default: 'ppa:daisy-pluckers/daisy-seeds'68 default: 'ppa:daisy-pluckers/daisy-seeds'
6469
=== modified file 'hooks/postgres'
--- hooks/postgres 2014-03-12 18:57:37 +0000
+++ hooks/postgres 2014-03-28 23:33:54 +0000
@@ -6,13 +6,22 @@
6DATABASE="$(relation-get database)"6DATABASE="$(relation-get database)"
7HOST="$(relation-get host)"7HOST="$(relation-get host)"
8PASSWORD="$(relation-get password)"8PASSWORD="$(relation-get password)"
9ALLOWED_UNITS="$(relation-get allowed-units)"
910
10if [ -z "$DATABASE" ]; then11if [ -z "$DATABASE" ]; then
11 relation-set database="$(config-get credentials-database-name)"12 relation-set database="$(config-get credentials-database-name)" role="$(config-get credentials-database-role)"
12 exit 013 exit 0
13fi14fi
1415
15[ -n "$USER" ] || exit 016if [[ -z "$ALLOWED_UNITS" ]]; then
17 echo "ALLOWED_UNITS not yet set"
18 exit 0
19fi
20if [[ "$ALLOWED_UNITS" != *${JUJU_UNIT_NAME}* ]]; then
21 echo "$JUJU_UNIT_NAME not in $ALLOWED_UNITS"
22 exit 0
23fi
24
1625
17if [ ! -e "$POSTGRES_CONFIG_PATH" ]; then26if [ ! -e "$POSTGRES_CONFIG_PATH" ]; then
18 cat > "$POSTGRES_CONFIG_PATH" << EOF27 cat > "$POSTGRES_CONFIG_PATH" << EOF

Subscribers

People subscribed via source and target branches

to all changes: