fablo
fablo copied to clipboard
Support chaincode list command
Right now we use some scripts in e2e-network directory to determine chaincode list, like in wait-for-chaincode.sh. The goal of this issue is to support the following command for Docker engine:
fablo chaincode list <peer> <channel>
Implementation details
Add to fabric-docker.sh:
elif [ "$1" = "chaincodes" ] && [ "$2" = "list" ]; then
chaincodeList "$3" "$4"
Use the syntax known from channel query scripts for chaincode-scripts.sh; something similar to:
chaincodeList() {
if [ "$#" -ne 3 ]; then
echo "Expected 3 parameters for chaincode list, but got: $@"
exit 1
<% orgs.forEach((org) => { org.peers.forEach((peer) => { %>
elif [ "$1" = "<%= org.name.toLowerCase(); %>" ] && [ "$2" = "<%= peer.name %>" ]; then
<% if(!global.tls) { %>
peerChaincodeList "<%= org.cli.address %>" "<%= peer.fullAddress %>" "$3" # $3 is channel name
<% } else { %>
peerChaincodeListTls "<%= org.cli.address %>" "<%= peer.fullAddress %>" "#3" # ??? maybe a TLS file path will be required inside target function
<% } %>
<% })}) %>
}
Inside wait-for-chaincode.sh use:
listChaincodes() {
"$FABLO_HOME/fablo.sh" chaincode list "$peer" "$channel"
# instead of previous:
# docker exec -e CORE_PEER_ADDRESS="$peer" "$cli" peer lifecycle chaincode querycommitted \
# --channelID "$channel"
}
Add peerChaincodeList, and peerChaincodeListTls functions to chaincode-functions-v2.sh file.
Steps
- Support non-TLS flow (test-01)
- Support TLS (test-02)
- Update
READMEwith docs + updateCHANGELOG
Can be implemented in separate PRs
@jnjerin current work - For some reason we cannot assign her