Use config-get

This commit is contained in:
Adam Gandelman 2011-08-12 13:15:42 -07:00
parent 54b673e230
commit 73e8d2bdac
3 changed files with 16 additions and 5 deletions

View File

@ -10,7 +10,8 @@ STORAGE_LOCAL_NET_IP=$IP
PACKAGES="swift swift-account swift-container swift-object xfsprogs"
DEVICE=xvda2
DEVICE=$(config-get block-device)
PPA=$(config-get swift-release)
function set_swift_hash {
# TODO: Do this with augeas and put in a utility function for use elsewhere
@ -87,3 +88,12 @@ function setup_storage {
mount /srv/node/$DEVICE
chown -R swift:swift /srv/node
}
function add_ppa {
[[ $PPA == "distro" ]] && exit 0
. /etc/lsb-release
[[ -z $PPA ]] && return 0
[[ $PPA == "milestone" ]] && PPA="release"
PPA_URL="deb http://ppa.launchpad.net/swift-core/$PPA/ubuntu $DISTRIB_CODENAME main"
add-apt-repository "$PPA_URL" || exit 1
}

View File

@ -14,7 +14,7 @@ fi
function install_hook {
apt-get -y install python-software-properties || exit 1
add-apt-repository ppa:swift-core/milestone-proposed || exit 1
add_ppa
apt-get update
for i in $PACKAGES ; do
DEBIAN_FRONTEND=noninteractive apt-get -y install $i
@ -24,7 +24,6 @@ function install_hook {
configure_rsyncd
setup_storage
for i in account container object ; do create_server_conf $i ; done
set_swift_hash "TESTINGHASH"
}
function proxy_joined {
@ -33,7 +32,8 @@ function proxy_joined {
function proxy_changed {
URL=`relation-get update_url`
[[ -z $URL ]] && exit 0
SWIFT_HASH=`relation-get swift_hash`
[[ -z $URL ]] || [[ -z $SWIFT_HASH ]] && exit 0
echo "$URL" >>/tmp/url
rm -rf /etc/swift/*.gz
for i in account object container ; do
@ -41,6 +41,7 @@ function proxy_changed {
echo "Fetching $URL/$i.ring.gz"
wget $URL/$i.ring.gz
done
set_swift_hash $SWIFT_HASH
chown swift -R /etc/swift
swift-init all start
}

View File

@ -1,6 +1,6 @@
ensemble: formula
name: swift-storage
revision: 19
revision: 24
summary: "Swift storage node"
description: |
Contains swift-object, swift-container and swift-account servers.