Merge lp:~ahasenack/charms/precise/nova-compute/use-charm-dir into lp:~openstack-charmers/charms/precise/nova-compute/ha-support

Proposed by Andreas Hasenack
Status: Merged
Merged at revision: 57
Proposed branch: lp:~ahasenack/charms/precise/nova-compute/use-charm-dir
Merge into: lp:~openstack-charmers/charms/precise/nova-compute/ha-support
Diff against target: 112 lines (+17/-15)
5 files modified
hooks/lib/nova/nova-common (+6/-5)
hooks/lib/openstack-common (+2/-2)
hooks/nova-compute-common (+4/-3)
hooks/nova-compute-relations (+4/-4)
revision (+1/-1)
To merge this branch: bzr merge lp:~ahasenack/charms/precise/nova-compute/use-charm-dir
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+161114@code.launchpad.net

Description of the change

This branch makes the nova-compute charm use CHARM_DIR instead of a hardcoded path for the charm location on disk, thereby being compatible with both juju and juju-core.

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 'hooks/lib/nova/nova-common'
--- hooks/lib/nova/nova-common 2013-04-04 23:34:30 +0000
+++ hooks/lib/nova/nova-common 2013-04-26 13:16:05 +0000
@@ -3,19 +3,20 @@
3# Common utility functions used across all nova charms.3# Common utility functions used across all nova charms.
44
5CONFIG_CHANGED=False5CONFIG_CHANGED=False
6HOOKS_DIR="$CHARM_DIR/hooks"
67
7# Load the common OpenStack helper library.8# Load the common OpenStack helper library.
8if [[ -e $CHARM_DIR/lib/openstack-common ]] ; then9if [[ -e $HOOKS_DIR/lib/openstack-common ]] ; then
9 . $CHARM_DIR/lib/openstack-common10 . $HOOKS_DIR/lib/openstack-common
10else11else
11 juju-log "Couldn't load $CHARM_DIR/lib/opentack-common." && exit 112 juju-log "Couldn't load $HOOKS_DIR/lib/opentack-common." && exit 1
12fi13fi
1314
14set_or_update() {15set_or_update() {
15 # Update config flags in nova.conf or api-paste.ini.16 # Update config flags in nova.conf or api-paste.ini.
16 # Config layout changed in Folsom, so this is now OpenStack release specific.17 # Config layout changed in Folsom, so this is now OpenStack release specific.
17 local rel=$(get_os_codename_package "nova-common")18 local rel=$(get_os_codename_package "nova-common")
18 . $CHARM_DIR/lib/nova/$rel19 . $HOOKS_DIR/lib/nova/$rel
19 nova_set_or_update $@20 nova_set_or_update $@
20}21}
2122
@@ -130,7 +131,7 @@
130131
131 # load the release helper library for pre/post upgrade hooks specific to the132 # load the release helper library for pre/post upgrade hooks specific to the
132 # release we are upgrading to.133 # release we are upgrading to.
133 . $CHARM_DIR/lib/nova/$new_rel134 . $HOOKS_DIR/lib/nova/$new_rel
134135
135 # new release specific pre-upgrade hook136 # new release specific pre-upgrade hook
136 nova_pre_upgrade "$orig_os_rel"137 nova_pre_upgrade "$orig_os_rel"
137138
=== modified file 'hooks/lib/openstack-common'
--- hooks/lib/openstack-common 2013-04-04 23:34:30 +0000
+++ hooks/lib/openstack-common 2013-04-26 13:16:05 +0000
@@ -762,7 +762,7 @@
762 exit 1762 exit 1
763 fi763 fi
764 # our default unit_path764 # our default unit_path
765 unit_path="/var/lib/juju/units/${JUJU_UNIT_NAME/\//-}/charm/scripts/scriptrc"765 unit_path="$CHARM_DIR/scripts/scriptrc"
766 echo $unit_path766 echo $unit_path
767 tmp_rc="/tmp/${JUJU_UNIT_NAME/\//-}rc"767 tmp_rc="/tmp/${JUJU_UNIT_NAME/\//-}rc"
768768
@@ -771,7 +771,7 @@
771 do771 do
772 if `echo $env_var | grep -q script_path`; then772 if `echo $env_var | grep -q script_path`; then
773 # well then we need to reset the new unit-local script path773 # well then we need to reset the new unit-local script path
774 unit_path="/var/lib/juju/units/${JUJU_UNIT_NAME/\//-}/charm/${env_var/script_path=/}"774 unit_path="$CHARM_DIR/${env_var/script_path=/}"
775 else775 else
776 echo "export $env_var" >> $tmp_rc776 echo "export $env_var" >> $tmp_rc
777 fi777 fi
778778
=== modified file 'hooks/nova-compute-common'
--- hooks/nova-compute-common 2013-04-05 18:43:45 +0000
+++ hooks/nova-compute-common 2013-04-26 13:16:05 +0000
@@ -8,6 +8,7 @@
8API_CONF="/etc/nova/api-paste.ini"8API_CONF="/etc/nova/api-paste.ini"
9QUANTUM_CONF="/etc/quantum/quantum.conf"9QUANTUM_CONF="/etc/quantum/quantum.conf"
10LIBVIRTD_CONF="/etc/libvirt/libvirtd.conf"10LIBVIRTD_CONF="/etc/libvirt/libvirtd.conf"
11HOOKS_DIR="$CHARM_DIR/hooks"
1112
12if [ -f /etc/nova/nm.conf ]; then13if [ -f /etc/nova/nm.conf ]; then
13 NET_MANAGER=$(cat /etc/nova/nm.conf)14 NET_MANAGER=$(cat /etc/nova/nm.conf)
@@ -33,10 +34,10 @@
33 ;;34 ;;
34esac35esac
3536
36if [[ -e $CHARM_DIR/lib/nova/nova-common ]] ; then37if [[ -e $HOOKS_DIR/lib/nova/nova-common ]] ; then
37 . $CHARM_DIR/lib/nova/nova-common38 . $HOOKS_DIR/lib/nova/nova-common
38else39else
39 juju-log "$CHARM: Couldn't load $CHARM_DIR/lib/nova-common" && exit 140 juju-log "$CHARM: Couldn't load $HOOKS_DIR/lib/nova-common" && exit 1
40fi41fi
4142
42determine_compute_package() {43determine_compute_package() {
4344
=== modified file 'hooks/nova-compute-relations'
--- hooks/nova-compute-relations 2013-04-11 03:18:41 +0000
+++ hooks/nova-compute-relations 2013-04-26 13:16:05 +0000
@@ -1,11 +1,11 @@
1#!/bin/bash -e1#!/bin/bash -e
2CHARM_DIR=$(dirname $0)2HOOKS_DIR="$CHARM_DIR/hooks"
3ARG0=${0##*/}3ARG0=${0##*/}
44
5if [[ -e $CHARM_DIR/nova-compute-common ]] ; then5if [[ -e $HOOKS_DIR/nova-compute-common ]] ; then
6 . $CHARM_DIR/nova-compute-common6 . $HOOKS_DIR/nova-compute-common
7else7else
8 juju-log "ERROR: Could not load nova-compute-common from $CHARM_DIR"8 juju-log "ERROR: Could not load nova-compute-common from $HOOKS_DIR"
9fi9fi
1010
11function install_hook {11function install_hook {
1212
=== modified file 'revision'
--- revision 2013-04-11 03:18:41 +0000
+++ revision 2013-04-26 13:16:05 +0000
@@ -1,1 +1,1 @@
190191

Subscribers

People subscribed via source and target branches