Merge lp:~johnsca/charms/precise/couchbase/fix-install into lp:~mbruzek/charms/precise/couchbase/tests

Proposed by Cory Johns
Status: Needs review
Proposed branch: lp:~johnsca/charms/precise/couchbase/fix-install
Merge into: lp:~mbruzek/charms/precise/couchbase/tests
Diff against target: 41 lines (+17/-3)
1 file modified
hooks/install (+17/-3)
To merge this branch: bzr merge lp:~johnsca/charms/precise/couchbase/fix-install
Reviewer Review Type Date Requested Status
Matt Bruzek Pending
Review via email: mp+243575@code.launchpad.net

Description of the change

Added wait for server to fix intermittent failure. Fixed hard-coded paths to open-port.

To post a comment you must log in.

Unmerged revisions

13. By Cory Johns

Fixed install hook

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/install'
2--- hooks/install 2013-02-08 18:55:26 +0000
3+++ hooks/install 2014-12-03 18:35:43 +0000
4@@ -5,7 +5,7 @@
5 set -ux
6
7 apt-get -y install python-software-properties
8-apt-add-repository ppa:facter-plugins/ppa
9+apt-add-repository -y ppa:facter-plugins/ppa
10 apt-get -y update
11 apt-get -y install facter facter-customfacts-plugin curl uuid pwgen libssl0.9.8
12
13@@ -71,6 +71,20 @@
14
15 service couchbase-server status && service couchbase-server restart || service couchbase-server start
16
17+echo "Waiting for couchbase-server..."
18+seconds=0
19+check_server_cmd="/opt/couchbase/bin/couchbase-cli server-info -c ${COUCHBASE_IP}:${COUCHBASE_PORT} \
20+ -u ${DEFAULT_CLUSTER_USERNAME} -p ${DEFAULT_CLUSTER_PASSWORD}"
21+until $check_server_cmd > /dev/null; do
22+ sleep 1
23+ seconds=$((seconds+1))
24+ if [ $seconds -gt 30 ]; then
25+ echo "Time out waiting for couchbase-server"
26+ $check_server_cmd
27+ exit 1
28+ fi
29+done
30+
31 /opt/couchbase/bin/couchbase-cli cluster-init \
32 -c ${COUCHBASE_IP}:${COUCHBASE_PORT} \
33 --cluster-init-username=${DEFAULT_CLUSTER_USERNAME} \
34@@ -87,5 +101,5 @@
35 --bucket-replica=${COUCHBASE_BUCKET_REPLICA}
36
37 # Open the necessary ports
38-[ -x /usr/bin/open-port ] && open-port ${COUCHBASE_PORT}/TCP
39-[ -x /usr/bin/open-port ] && open-port ${COUCHBASE_CLUSTER_PORT}/TCP
40+open-port ${COUCHBASE_PORT}/TCP
41+open-port ${COUCHBASE_CLUSTER_PORT}/TCP

Subscribers

People subscribed via source and target branches

to all changes: