blob: 440c68833055ff716898f1ae7a43f111bb6b09d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
heat_template_version: ocata
parameters:
servers:
type: json
SwiftRingPutTempurl:
default: ''
description: A temporary Swift URL to upload rings to.
type: string
resources:
SwiftRingUpdateConfig:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: swift_ring_put_tempurl
config: |
#!/bin/sh
TMP_DATA=$(mktemp -d)
function cleanup {
rm -Rf "$TMP_DATA"
}
trap cleanup EXIT
# sanity check in case rings are not consistent within cluster
swift-recon --md5 | grep -q "doesn't match" && exit 1
pushd ${TMP_DATA}
tar -cvzf swift-rings.tar.gz /etc/swift/*.builder /etc/swift/*.ring.gz /etc/swift/backups/*
resp=`curl --insecure --silent -X PUT "${swift_ring_put_tempurl}" --write-out "%{http_code}" --data-binary @swift-rings.tar.gz`
popd
if [ "$resp" != "201" ]; then
exit 1
fi
SwiftRingUpdate:
type: OS::Heat::SoftwareDeployments
properties:
name: SwiftRingUpdate
config: {get_resource: SwiftRingUpdateConfig}
servers: {get_param: servers}
input_values:
swift_ring_put_tempurl: {get_param: SwiftRingPutTempurl}
|