Eliminate relative path usage (#59)

* Apply same changes to make-invoice-payment-cancelled-after-failed-cancel.sh
This commit is contained in:
Andrey Fadeev 2019-07-11 12:12:14 +03:00 committed by Andrew Mayorov
parent 121a39a59d
commit 0a7fee6551
21 changed files with 92 additions and 57 deletions

View File

@ -22,13 +22,13 @@ for line in $(cat "${BATCH}"); do
currency=$(echo "${line}" | jq -r '.currency')
info "Refunding $(em $amount $currency) @ payment $(em $payment) on invoice $(em $invoice) ..."
./refund-invoice-payment.sh $invoice $payment $amount $currency
"${CWD}/refund-invoice-payment.sh" "$invoice" "$payment" "$amount" "$currency"
echo
sleep 3
info "Repairing refund @ payment $(em $payment) on $(em $invoice) ..."
./make-invoice-payment-refunded.sh $invoice $payment
"${CWD}/make-invoice-payment-refunded.sh" "$invoice" "$payment"
echo
done

View File

@ -4,6 +4,7 @@ set -e
CWD="$(dirname $0)"
SCRIPTNAME="$(basename $0)"
DAMSEL="${CWD}/../damsel"
source "${CWD}/lib/logging"
@ -50,7 +51,7 @@ fi
[ -f woorlrc ] && source woorlrc
${WOORL:-woorl} \
-s damsel/proto/payment_processing.thrift \
http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing \
"${WOORL:-woorl}" \
-s "${DAMSEL}/proto/payment_processing.thrift" \
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
Invoicing CreateManualRefund "${USERINFO}" "\"${INVOICE_ID}\"" "\"${PAYMENT_ID}\"" "${PARAMS}"

View File

@ -2,6 +2,8 @@
set -e
CWD="$(dirname $0)"
DAMSEL="${CWD}/../../damsel"
SCRIPTNAME=$(basename $0)
export CURDIR="$(dirname ${0})"
@ -20,9 +22,9 @@ case "$1" in
exit 0
;;
* )
FIXTURE="$(${LIBDIR}/template.sh ${CURDIR}/base-fixture.commit.json.tpl $*)"
woorl $* \
-s damsel/proto/domain_config.thrift \
http://${DOMINANT:-dominant}:8022/v1/domain/repository \
FIXTURE=$("${LIBDIR}/template.sh" "${CURDIR}/base-fixture.commit.json.tpl" $*)
"${WOORL:-woorl}" $* \
-s "${DAMSEL}/proto/domain_config.thrift" \
"http://${DOMINANT:-dominant}:8022/v1/domain/repository" \
Repository Commit 0 "${FIXTURE}"
esac

View File

@ -1,11 +1,14 @@
#!/bin/sh
CWD="$(dirname $0)"
DAMSEL="${CWD}/../../damsel"
CURRENCY=${1}
shift 1
[ -z "${CURRENCY}" ] && { echo "No currency code specified"; exit -1; }
woorl $* \
-s damsel/proto/accounter.thrift \
http://${SHUMWAY:-shumway}:8022/accounter \
"${WOORL:-woorl}" $* \
-s "${DAMSEL}/proto/accounter.thrift" \
"http://${SHUMWAY:-shumway}:8022/accounter" \
Accounter CreateAccount "{\"currency_sym_code\":\"${CURRENCY}\"}"

View File

@ -1,5 +1,8 @@
#!/bin/bash
CWD="$(dirname $0)"
MGPROTO="${CWD}/../mgproto"
USAGE=$(cat <<EOF
Usage: ${SCRIPTNAME} id [ns]
Fails a machine. Exploits the fact that most if not all already implemented
@ -40,7 +43,7 @@ CALLARGS=$(cat <<END
END
)
${WOORL:-woorl} -s mgproto/proto/state_processing.thrift \
"${WOORL:-woorl}" -s "${MGPROTO}/proto/state_processing.thrift" \
"http://${MACHINEGUN:-machinegun}:8022/v1/automaton" \
Automaton Call "${MACHINEDESC}" "${CALLARGS}" \
| grep -sqF 'MachineFailed'

View File

@ -1,5 +1,8 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../damsel"
USAGE=$(cat <<EOF
Usage: ${SCRIPTNAME} plan-id batch-id
Shows a plan batch given a plan-id and a batch-id.
@ -26,6 +29,6 @@ BATCHID="${2}"
ACCOUNTER="http://${SHUMWAY:-shumway}:8022/accounter"
${WOORL:-woorl} -s damsel/proto/accounter.thrift \
${ACCOUNTER} Accounter GetPlan "\"${PLANID}\"" | \
"${WOORL:-woorl}" -s "${DAMSEL}/proto/accounter.thrift" \
"${ACCOUNTER}" Accounter GetPlan "\"${PLANID}\"" | \
jq ".batch_list[] | select(.id == ${BATCHID})"

View File

@ -1,14 +1,17 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../../damsel"
[ -f woorlrc ] && source woorlrc
SCRIPTNAME=$(basename $0)
get_events () {
${WOORL:-woorl} \
-s damsel/proto/payment_processing.thrift \
http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing \
Invoicing GetEvents $1 $2 $3
"${WOORL:-woorl}" \
-s "${DAMSEL}/proto/payment_processing.thrift" \
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
Invoicing GetEvents "$1" "$2" "$3"
}
case "$1" in

View File

@ -1,13 +1,16 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../../damsel"
[ -f woorlrc ] && source woorlrc
SCRIPTNAME=$(basename $0)
get_state () {
${WOORL:-woorl} \
-s damsel/proto/payment_processing.thrift \
http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing \
"${WOORL:-woorl}" \
-s "${DAMSEL}/proto/payment_processing.thrift" \
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
Invoicing Get "$1" "$2"
}

View File

@ -1,13 +1,16 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../../damsel"
[ -f woorlrc ] && source woorlrc
SCRIPTNAME=$(basename $0)
get_events () {
woorl $4 \
-s damsel/proto/payment_processing.thrift \
http://${HELLGATE:-hellgate}:8022/v1/processing/partymgmt \
"${WOORL:-woorl}" $4 \
-s "${DAMSEL}/proto/payment_processing.thrift" \
"http://${HELLGATE:-hellgate}:8022/v1/processing/partymgmt" \
PartyManagement GetEvents "$1" "$2" "$3"
}

View File

@ -1,13 +1,16 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../../damsel"
[ -f woorlrc ] && source woorlrc
SCRIPTNAME=$(basename $0)
get_party () {
woorl $3 \
-s damsel/proto/payment_processing.thrift \
http://${HELLGATE:-hellgate}:8022/v1/processing/partymgmt \
"${WOORL:-woorl}" $3 \
-s "${DAMSEL}/proto/payment_processing.thrift" \
"http://${HELLGATE:-hellgate}:8022/v1/processing/partymgmt" \
PartyManagement Get "$1" "$2"
}

View File

@ -1,13 +1,16 @@
#!/bin/sh
CWD="$(dirname $0)"
MGPROTO="${CWD}/../../mgproto"
[ -f woorlrc ] && source woorlrc
MACHINE_NS="\"${1}\""
MACHINE_ID="{\"id\":\"${2}\"}"
shift 2
woorl $* \
-s damsel/proto/state_processing.thrift \
http://${MACHINEGUN:-machinegun}:8022/v1/automaton \
Automaton Repair ${MACHINE_NS} ${MACHINE_ID} \
"${WOORL:-woorl}" $* \
-s "${MGPROTO}/proto/state_processing.thrift" \
"http://${MACHINEGUN:-machinegun}:8022/v1/automaton" \
Automaton Repair "${MACHINE_NS}" "${MACHINE_ID}" \
'{"content_type":"base64","content": "g2o="}'

View File

@ -28,7 +28,7 @@ case ${INVOICE} in
;;
esac
INVOICE_EVENTS=$(${CWD}/hellgate/get-invoice-events.sh ${INVOICE})
INVOICE_EVENTS=$("${CWD}/hellgate/get-invoice-events.sh" ${INVOICE})
LAST_CHANGE=$(echo "${INVOICE_EVENTS}" | jq '.[-1].payload.invoice_changes[-1].invoice_payment_change')
PAYMENT=$(echo "${LAST_CHANGE}" | jq -r '.id')
@ -69,4 +69,4 @@ END
)
# Then we should stuff it with previously reconstructed history
./repair-invoice.sh "${INVOICE}" "${CHANGES}"
"${CWD}/repair-invoice.sh" "${INVOICE}" "${CHANGES}"

View File

@ -39,7 +39,7 @@ END
)
# First we need to explicitly make invoice failed again. Amen.
./fail-machine.sh "${INVOICE}"
"${CWD}/fail-machine.sh" "${INVOICE}"
# Then we should stuff it with previously reconstructed history
./repair-invoice.sh "${INVOICE}" "${CHANGES}"
"${CWD}/repair-invoice.sh" "${INVOICE}" "${CHANGES}"

View File

@ -33,7 +33,7 @@ case ${INVOICE} in
;;
esac
INVOICE_EVENTS=$(${CWD}/hellgate/get-invoice-events.sh ${INVOICE})
INVOICE_EVENTS=$("${CWD}/hellgate/get-invoice-events.sh" "${INVOICE}")
LAST_CHANGE=$(echo "${INVOICE_EVENTS}" | jq '.[-1].payload.invoice_changes[-1].invoice_payment_change')
PAYMENT=$(echo "${LAST_CHANGE}" | jq -r '.id')
@ -74,4 +74,4 @@ END
)
# Then we should stuff it with previously reconstructed history
"$CWD/repair-invoice.sh" "${INVOICE}" "${CHANGES}"
"${CWD}/repair-invoice.sh" "${INVOICE}" "${CHANGES}"

View File

@ -35,7 +35,7 @@ case ${INVOICE} in
;;
esac
INVOICE_EVENTS=$(${CWD}/hellgate/get-invoice-events.sh ${INVOICE})
INVOICE_EVENTS=$("${CWD}/hellgate/get-invoice-events.sh" "${INVOICE}")
LAST_CHANGE=$(echo "${INVOICE_EVENTS}" | jq '.[-1].payload.invoice_changes[-1].invoice_payment_change')
PAYMENT=$(echo "${LAST_CHANGE}" | jq -r '.id')
@ -115,4 +115,4 @@ END
)
# Then we should stuff it with previously reconstructed history
./repair-invoice.sh "${INVOICE}" "${CHANGES}"
"${CWD}/repair-invoice.sh" "${INVOICE}" "${CHANGES}"

View File

@ -43,7 +43,7 @@ esac
LAST_CHANGE=$(
${CWD}/hellgate/get-invoice-events.sh ${INVOICE} |
"${CWD}/hellgate/get-invoice-events.sh" "${INVOICE}" |
jq '.[-1].payload.invoice_changes[-1].invoice_payment_change'
)
@ -139,4 +139,4 @@ END
)
# Then we should stuff it with previously reconstructed history
./repair-invoice.sh "${INVOICE}" "${CHANGES}"
"${CWD}/repair-invoice.sh" "${INVOICE}" "${CHANGES}"

View File

@ -38,7 +38,7 @@ REFUND="${3}"
# END
# )
STATE="$(${CWD}/hellgate/get-invoice-state.sh ${INVOICE})"
STATE=$("${CWD}/hellgate/get-invoice-state.sh" "${INVOICE}")
info "Going on with payment $(em ${PAYMENT}) ..."
@ -133,4 +133,4 @@ END
)
# Then we should stuff it with previously reconstructed history
${CWD}/repair-invoice.sh "${INVOICE}" "${CHANGES}"
"${CWD}/repair-invoice.sh" "${INVOICE}" "${CHANGES}"

View File

@ -3,6 +3,7 @@
set -e
CWD="$(dirname $0)"
DAMSEL="${CWD}/../damsel"
SCRIPTNAME="$(basename $0)"
source "${CWD}/lib/logging"
@ -33,7 +34,7 @@ USERINFO=$(jq -nc "{id:\"${SCRIPTNAME}\", type:{service_user:{}}}")
[ -f woorlrc ] && source woorlrc
${WOORL:-woorl} \
-s damsel/proto/payment_processing.thrift \
http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing \
"${WOORL:-woorl}" \
-s "${DAMSEL}/proto/payment_processing.thrift" \
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
Invoicing RefundPayment "${USERINFO}" "\"${INVOICE}\"" "\"${PAYMENT}\"" "${PARAMS}"

View File

@ -1,6 +1,7 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../damsel"
SCRIPTNAME="$(basename $0)"
source "${CWD}/lib/logging"
@ -54,7 +55,7 @@ INVOICE_CHANGES="${2}"
USERINFO='{"id":"woorl","type":{"service_user":{}}}'
${WOORL:-woorl} \
-s damsel/proto/payment_processing.thrift \
"${WOORL:-woorl}" \
-s "${DAMSEL}/proto/payment_processing.thrift" \
"http://${HELLGATE:-hellgate}:8022/v1/processing/invoicing" \
Invoicing Repair "${USERINFO}" "\"${INVOICE}\"" "${INVOICE_CHANGES}" "${ACTION}" "${PARAMS}"

View File

@ -1,5 +1,8 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../damsel"
USAGE=$(cat <<EOF
Usage: ${SCRIPTNAME} plan-id batch
Prepares and then rolls back a plan made up of the single posting batch provided by
@ -27,9 +30,9 @@ BATCH="${2}"
ACCOUNTER="http://${SHUMWAY:-shumway}:8022/accounter"
${WOORL:-woorl} -s damsel/proto/accounter.thrift \
${ACCOUNTER} Accounter Hold \
"${WOORL:-woorl}" -s "${DAMSEL}/proto/accounter.thrift" \
"${ACCOUNTER}" Accounter Hold \
"{\"id\": \"${PLANID}\", \"batch\": ${BATCH}}" && \
${WOORL:-woorl} -s damsel/proto/accounter.thrift \
${ACCOUNTER} Accounter RollbackPlan \
"${WOORL:-woorl}" -s "${DAMSEL}/proto/accounter.thrift" \
"${ACCOUNTER}" Accounter RollbackPlan \
"{\"id\": \"${PLANID}\", \"batch_list\": [${BATCH}]}"

View File

@ -1,5 +1,8 @@
#!/bin/bash
CWD="$(dirname $0)"
DAMSEL="${CWD}/../damsel"
USAGE=$(cat <<EOF
Usage: ${SCRIPTNAME} plan-id batch
Prepares and commits a plan made up of the single posting batch provided by
@ -27,9 +30,9 @@ BATCH="${2}"
ACCOUNTER="http://${SHUMWAY:-shumway}:8022/accounter"
${WOORL:-woorl} -s damsel/proto/accounter.thrift \
${ACCOUNTER} Accounter Hold \
"${WOORL:-woorl}" -s "${DAMSEL}/proto/accounter.thrift" \
"${ACCOUNTER}" Accounter Hold \
"{\"id\": \"${PLANID}\", \"batch\": ${BATCH}}" && \
${WOORL:-woorl} -s damsel/proto/accounter.thrift \
${ACCOUNTER} Accounter CommitPlan \
"${WOORL:-woorl}" -s "${DAMSEL}/proto/accounter.thrift" \
"${ACCOUNTER}" Accounter CommitPlan \
"{\"id\": \"${PLANID}\", \"batch_list\": [${BATCH}]}"