fablo icon indicating copy to clipboard operation
fablo copied to clipboard

Support chaincode list command

Open dzikowski opened this issue 2 years ago • 1 comments

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

  1. Support non-TLS flow (test-01)
  2. Support TLS (test-02)
  3. Update README with docs + update CHANGELOG

Can be implemented in separate PRs

dzikowski avatar Aug 23 '23 12:08 dzikowski

@jnjerin current work - For some reason we cannot assign her

Hejwo avatar Aug 30 '23 10:08 Hejwo