Merge lp:~dspiteri/charms/precise/cassandra/prodchanges into lp:charms/cassandra

Proposed by Darren Spiteri
Status: Merged
Merged at revision: 28
Proposed branch: lp:~dspiteri/charms/precise/cassandra/prodchanges
Merge into: lp:charms/cassandra
Diff against target: 111 lines (+26/-10)
2 files modified
config.yaml (+7/-0)
hooks/cassandra-common (+19/-10)
To merge this branch: bzr merge lp:~dspiteri/charms/precise/cassandra/prodchanges
Reviewer Review Type Date Requested Status
Mark Mims (community) Approve
Review via email: mp+179862@code.launchpad.net

Description of the change

Merging from prod.

To post a comment you must log in.
Revision history for this message
Mark Mims (mark-mims) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2013-07-12 11:57:40 +0000
+++ config.yaml 2013-08-13 07:34:06 +0000
@@ -142,3 +142,10 @@
142 type: int142 type: int
143 description: |143 description: |
144 The pct of heap used to trigger a nagios critcal alert144 The pct of heap used to trigger a nagios critcal alert
145
146 extra_packages:
147 type: string
148 default: ""
149 description: |
150 Extra packages to install. A space delimited list of packages.
151
145152
=== modified file 'hooks/cassandra-common'
--- hooks/cassandra-common 2013-07-18 20:31:35 +0000
+++ hooks/cassandra-common 2013-08-13 07:34:06 +0000
@@ -29,8 +29,9 @@
29bzr_ci () {29bzr_ci () {
30 local msg=${FUNCNAME[1]}30 local msg=${FUNCNAME[1]}
31 test -n "$1" && msg="$1"31 test -n "$1" && msg="$1"
32 bzr st /etc/cassandra|egrep -q '^modified|added' || return 032 bzr st /etc/cassandra|egrep -q '^modified|added' || return 1
33 bzr ci -m "[$(date "+%Y-%m-%d %H:%M:%S")] ${JUJU_UNIT_NAME}: ${msg} auto-commit" /etc/cassandra || return 033 bzr ci -m "[$(date "+%Y-%m-%d %H:%M:%S")] ${JUJU_UNIT_NAME}: ${msg} auto-commit" /etc/cassandra || return 1
34 return 0
34}35}
3536
3637
@@ -48,6 +49,8 @@
48 # Install the repository49 # Install the repository
49 APT_REPO_SPEC="$(config-get apt-repo-spec)"50 APT_REPO_SPEC="$(config-get apt-repo-spec)"
50 APT_REPO_KEY=$(config-get apt-repo-key)51 APT_REPO_KEY=$(config-get apt-repo-key)
52 # Check for configured extra packages to install from config
53 EXTRA_PACKAGES="$(config-get extra_packages)"
51 # Add the key54 # Add the key
52 if [[ -n "${APT_REPO_KEY}" ]]; then55 if [[ -n "${APT_REPO_KEY}" ]]; then
53 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${APT_REPO_KEY}56 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ${APT_REPO_KEY}
@@ -56,12 +59,13 @@
56 echo "${APT_REPO_SPEC}" > /etc/apt/sources.list.d/cassandra.list59 echo "${APT_REPO_SPEC}" > /etc/apt/sources.list.d/cassandra.list
57 fi60 fi
58 # Update the repositories61 # Update the repositories
62
59 apt-get update63 apt-get update
60 # Ensure that cassandra does not startup before we have configured it64 # Ensure that cassandra does not startup before we have configured it
61 disable_cassandra_start65 disable_cassandra_start
62 # Install the package66 # Install the package
63 DEBIAN_FRONTEND=noninteractive apt-get -qq install -y cassandra python-cheetah dnsutils bzr67 DEBIAN_FRONTEND=noninteractive apt-get -qq install -y cassandra python-cheetah dnsutils bzr ${EXTRA_PACKAGES}
64 bzr_ci68 bzr_ci || :
65}69}
6670
67# Update the cassandra environment with the appropriate JMX port71# Update the cassandra environment with the appropriate JMX port
@@ -71,7 +75,6 @@
71 test -n "${JMX_PORT}" || return 175 test -n "${JMX_PORT}" || return 1
72 test ${JMX_PORT} -gt 0 -a ${JMX_PORT} -lt 65535 || return 176 test ${JMX_PORT} -gt 0 -a ${JMX_PORT} -lt 65535 || return 1
73 sed -i -e "s/^JMX_PORT=.*/JMX_PORT=\"${JMX_PORT}\"/" /etc/cassandra/cassandra-env.sh77 sed -i -e "s/^JMX_PORT=.*/JMX_PORT=\"${JMX_PORT}\"/" /etc/cassandra/cassandra-env.sh
74 bzr_ci
75 # Open port ready for expose78 # Open port ready for expose
76 open-port ${JMX_PORT}/TCP79 open-port ${JMX_PORT}/TCP
77}80}
@@ -240,7 +243,6 @@
240 sed -i -e "s/^[#]MAX_HEAP_SIZE=.*/#MAX_HEAP_SIZE=\"${HEAP_SIZE}\"/" \243 sed -i -e "s/^[#]MAX_HEAP_SIZE=.*/#MAX_HEAP_SIZE=\"${HEAP_SIZE}\"/" \
241 -e "s/^[#]HEAP_NEWSIZE=.*/#HEAP_NEWSIZE=\"${NEW_GEN_SIZE}\"/" /etc/cassandra/cassandra-env.sh244 -e "s/^[#]HEAP_NEWSIZE=.*/#HEAP_NEWSIZE=\"${NEW_GEN_SIZE}\"/" /etc/cassandra/cassandra-env.sh
242 fi 245 fi
243 bzr_ci
244}246}
245247
246# Service Control Commands248# Service Control Commands
@@ -281,7 +283,7 @@
281 sed -i -e "s/\- seeds:.*/\- seeds: \"${seeds}\"/" /etc/cassandra/cassandra.yaml283 sed -i -e "s/\- seeds:.*/\- seeds: \"${seeds}\"/" /etc/cassandra/cassandra.yaml
282 fi284 fi
283 juju-log "$JUJU_REMOTE_UNIT modified its settings or departed"285 juju-log "$JUJU_REMOTE_UNIT modified its settings or departed"
284 bzr_ci286 bzr_ci || :
285}287}
286288
287nodestatus() {289nodestatus() {
@@ -385,20 +387,27 @@
385 # Initialize /etc/cassandra bzr387 # Initialize /etc/cassandra bzr
386 bzr whoami "${JUJU_UNIT_NAME} <juju@${HOSTNAME}>"388 bzr whoami "${JUJU_UNIT_NAME} <juju@${HOSTNAME}>"
387 test -d /etc/cassandra/.bzr || bzr init /etc/cassandra && bzr add /etc/cassandra389 test -d /etc/cassandra/.bzr || bzr init /etc/cassandra && bzr add /etc/cassandra
388 bzr_ci "main:${COMMAND}" /etc/cassandra390 bzr_ci "main:${COMMAND}" /etc/cassandra || :
389 # Update the cassandra environment with the appropriate JMX port391 # Update the cassandra environment with the appropriate JMX port
390 configure_jmx_port 392 configure_jmx_port
393 bzr_ci || :
391 # Construct the cassandra.yaml file from the appropriate information above394 # Construct the cassandra.yaml file from the appropriate information above
392 configure_cassandra 395 configure_cassandra
396 bzr_ci || :
393 run_exec_d_hooks "post-install"397 run_exec_d_hooks "post-install"
394 ;;398 ;;
395 config-changed)399 config-changed)
400 needs_restart=
396 # Update the cassandra environment with the appropriate JMX port401 # Update the cassandra environment with the appropriate JMX port
397 configure_jmx_port 402 configure_jmx_port
403 bzr_ci && needs_restart=:
398 # Construct the cassandra.yaml file from the appropriate information above404 # Construct the cassandra.yaml file from the appropriate information above
399 configure_cassandra405 configure_cassandra
400 # Restart as required406 bzr_ci && needs_restart=:
401 restart_cassandra407 if [ $needs_restart ]; then
408 # Restart as required
409 restart_cassandra
410 fi
402 # Fill in nagios checks411 # Fill in nagios checks
403 update_nagios_checks412 update_nagios_checks
404 ;;413 ;;

Subscribers

People subscribed via source and target branches

to all changes: