Revision 8700
Added by Lauren Walker almost 11 years ago
src/scripts/bash/replicaPolicies.sh | ||
---|---|---|
12 | 12 |
cert_path="/var/metacat/certs/urn_node_mnDemo8.pem" |
13 | 13 |
xml_path="replicapolicy.xml" |
14 | 14 |
|
15 |
identifiers=$(curl -s -o - -E $cert_path "$MN_base_URL/object?count=7&replicaStatus=false" | xmlstarlet sel -t -m "//objectInfo" -v "identifier" -n) |
|
15 | 16 |
|
16 |
identifiers=$(curl -o - -E $cert_path "$MN_base_URL/object?count=7000&replicaStatus=false" | xmlstarlet sel -t -m "//objectInfo" -v "identifier" -n) |
|
17 |
failedIDs="" |
|
18 |
successCount=0 |
|
19 |
failCount=0 |
|
20 |
skipCount=0 |
|
17 | 21 |
|
18 | 22 |
for id in ${identifiers}; |
19 | 23 |
do |
20 |
metadata=$(curl -o - -E $cert_path "$CN_base_URL/meta/${id}" | xmlstarlet sel -t -v "concat(//serialVersion,';',//authoritativeMemberNode)" -n) |
|
24 |
metadata=$(curl -s -o - -E $cert_path "$CN_base_URL/meta/${id}" | xmlstarlet sel -t -v "concat(//serialVersion,';',//authoritativeMemberNode)" -n)
|
|
21 | 25 |
|
22 | 26 |
OIFS=$IFS |
23 | 27 |
IFS=";" |
24 | 28 |
arr=($metadata) |
25 | 29 |
if [ ${arr[1]} = $authoritativeMN ]; then |
26 |
echo "---- Updating replica policy for id: $id ----" |
|
27 |
curl -o - -X PUT -E $cert_path --capath "/etc/ssl/certs" -F "serialVersion=${arr[0]}" -F "policy=@$xml_path" "$CN_base_URL/replicaPolicies/${id}" |
|
28 |
else |
|
30 |
#echo "skip" |
|
31 |
echo "Updating replica policy for id: $id" |
|
32 |
statusCode=$(curl -s -o - -w "%{http_code}" -X PUT -E $cert_path --capath "/etc/ssl/certs" -F "serialVersion=${arr[0]}" -F "policy=@$xml_path" "$CN_base_URL/replicaPolicies/${id}") |
|
33 |
if [ $statusCode = "200" ]; then |
|
34 |
successCount=$(($successCount + 1)) |
|
35 |
else |
|
36 |
failCount=$(($failCount + 1)) |
|
37 |
fi |
|
38 |
|
|
39 |
else |
|
29 | 40 |
echo "$authoritativeMN is not the authoritative member node for id: $id. (is ${arr[1]})" |
41 |
failedIDs=$(printf "$failedIDs\n$id") |
|
42 |
skipCount=$(($skipCount + 1)) |
|
30 | 43 |
fi |
31 | 44 |
done |
32 | 45 |
|
46 |
echo -e "\n\nDONE\n----------------------------------" |
|
47 |
echo -e "\nSUCCESSES: $successCount" |
|
48 |
echo -e "\nFAILURES: $failCount" |
|
49 |
echo -e "\n\nSKIPS (objects with a different authoritative member node): $skipCount" |
|
50 |
echo -e "\nIDs of objects with a different authoritative member node: \n$failedIDs" |
|
33 | 51 |
|
52 |
|
|
53 |
|
Also available in: Unified diff
Edited the replicaPolicies script to print out a list of IDs that have a different authoritative member node, the number of successes, and failures at the end.