Some strange bash problem happened to me when i deployed a fabric network
fabric image version:2.2
one of installing chaincode steps in fabric2.x is approveformyorg,and there is a parameter called "--signature-policy".According to the test-network bash file in fabric-sample-2.2,they use a variable called "CC_END_POLICY" to pass the parameter.But when i used in that way,i found some strange thing.
here is the code
CC_END_POLICY="AND ('Org1MSP.peer','Org2MSP.peer')"
if [ $CC_END_POLICY = "NA" ]; then
CC_END_POLICY=""
else
CC_END_POLICY="--signature-policy ${CC_END_POLICY}"
fi
and the approveformyorg command code
echo ${CC_END_POLICY}
peer lifecycle chaincode approveformyorg -o orderer.root.example.com:7050 --tls --cafile ${ORDERER_CA} --channelID ${HANNEL_NAME} -n ${CC_NAME} --version ${VERSION} --package-id ${PACKAGE_ID} --sequence ${CC_SEQUENCE} ${INIT_REQUIRED} ${CC_END_POLICY} ${CC_COLL_CONFIG} --waitForEvent >&log.txt
And i got error:
--signature-policy AND ('Org1MSP.peer','Org2MSP.peer')
peer lifecycle chaincode approveformyorg -o orderer.root.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/root.example.com/orderers/orderer.root.example.com/msp/tlscacerts/tlsca.root.example.com-cert.pem --channelID --name businessCC --version 1.0 --package-id businessCC_1.0:2b9b70ef81a7f5389973f5804ac6c40f2304821c1af8f636731fe1fef76a4850 --sequence 1 --init-required --signature-policy AND '('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')' --waitForEvent
Error: invalid signature policy: AND
I'm so confused about the ' and \ in the variable,why it's different when i run peer command. Had anyone ever encountered such problem?