Neha Jain | de45c68 | 2018-04-05 11:51:29 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | function usage() |
| 4 | { |
| 5 | echo usage: switchVoting.sh primary\|secondary |
| 6 | exit 1 |
| 7 | } |
| 8 | |
| 9 | if [ $# -ne 1 ]; then |
| 10 | usage |
| 11 | fi |
| 12 | |
| 13 | partition=$1 |
| 14 | |
| 15 | if [ "$partition" == "primary" ]; then |
| 16 | curl -u admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:30202/restconf/operations/cluster-admin:change-member-voting-states-for-all-shards -d '{ "input" : { "member-voting-state" : [ { "member-name" : "member-1", "voting":true}, { "member-name" : "member-2", "voting":true}, { "member-name" : "member-3", "voting":true},{ "member-name" : "member-4", "voting":false},{ "member-name" : "member-5", "voting":false},{ "member-name" : "member-6", "voting":false}] } }' > switch_voting_resp.json 2>/dev/null |
| 17 | echo "" >> switch_voting_resp.json |
| 18 | exit 0 |
| 19 | fi |
| 20 | |
| 21 | if [ "$partition" == "secondary" ]; then |
| 22 | curl -u admin:Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:30202/restconf/operations/cluster-admin:change-member-voting-states-for-all-shards -d '{ "input" : { "member-voting-state" : [ { "member-name" : "member-1", "voting":false}, { "member-name" : "member-2", "voting":false}, { "member-name" : "member-3", "voting":false},{ "member-name" : "member-4", "voting":true},{ "member-name" : "member-5", "voting":true},{ "member-name" : "member-6", "voting":true}] } }' > switch_voting_resp.json 2>/dev/null |
| 23 | echo "" >> switch_voting_resp.json |
| 24 | exit 0 |
| 25 | fi |
| 26 | |
| 27 | usage |