Skip to content

Commit

Permalink
Create directory to avoid permission errors
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Dzikowski <[email protected]>
  • Loading branch information
dzikowski committed Dec 7, 2024
1 parent c430c74 commit 12bac57
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1700,8 +1700,9 @@ generateArtifacts() {
printItalics "Generating genesis block for group group1" "U1F3E0"
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,9 @@ generateArtifacts() {
printItalics "Generating genesis block for group group1" "U1F3E0"
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2366,8 +2366,9 @@ generateArtifacts() {
printItalics "Generating genesis block for group group1" "U1F3E0"
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3476,8 +3476,9 @@ generateArtifacts() {
printItalics "Generating genesis block for group group2" "U1F3E0"
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group2Genesis"
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3814,8 +3814,9 @@ generateArtifacts() {
printItalics "Generating genesis block for group group1" "U1F3E0"
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1730,8 +1730,9 @@ generateArtifacts() {
printItalics "Generating crypto material for Org1" "U1F512"
certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/"
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down Expand Up @@ -3186,7 +3187,7 @@ createChannelAndJoin() {
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}"
rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}
createChannelAndJoinTls() {
Expand All @@ -3207,7 +3208,7 @@ createChannelAndJoinTls() {
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"
if [ ! -d "$DIR_NAME" ]; then
mkdir "$DIR_NAME"
mkdir -p "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
fi
Expand All @@ -3219,16 +3220,15 @@ createChannelAndJoinTls() {
--client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\
--ca-file "\${TLS_CA_CERT_PATH}"
cd ..
rm -rf "$DIR_NAME"
}
fetchChannelAndJoin() {
local CHANNEL_NAME=$1
local CORE_PEER_LOCALMSPID=$2
local CORE_PEER_ADDRESS=$3
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
local ORDERER_URL=$5
local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS
Expand All @@ -3244,12 +3244,11 @@ fetchChannelAndJoin() {
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}"
peer channel join -b "\${CHANNEL_NAME}"_newest.block
rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}
fetchChannelAndJoinTls() {
local CHANNEL_NAME=$1
local CORE_PEER_LOCALMSPID=$2
local CORE_PEER_ADDRESS=$3
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
Expand Down Expand Up @@ -3278,7 +3277,7 @@ fetchChannelAndJoinTls() {
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"
rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1756,8 +1756,9 @@ generateArtifacts() {
printItalics "Generating crypto material for Org1" "U1F512"
certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/"
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down Expand Up @@ -3211,7 +3212,7 @@ createChannelAndJoin() {
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}"
rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}
createChannelAndJoinTls() {
Expand All @@ -3232,7 +3233,7 @@ createChannelAndJoinTls() {
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"
if [ ! -d "$DIR_NAME" ]; then
mkdir "$DIR_NAME"
mkdir -p "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
fi
Expand All @@ -3244,16 +3245,15 @@ createChannelAndJoinTls() {
--client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\
--ca-file "\${TLS_CA_CERT_PATH}"
cd ..
rm -rf "$DIR_NAME"
}
fetchChannelAndJoin() {
local CHANNEL_NAME=$1
local CORE_PEER_LOCALMSPID=$2
local CORE_PEER_ADDRESS=$3
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
local ORDERER_URL=$5
local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS
Expand All @@ -3269,12 +3269,11 @@ fetchChannelAndJoin() {
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}"
peer channel join -b "\${CHANNEL_NAME}"_newest.block
rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}
fetchChannelAndJoinTls() {
local CHANNEL_NAME=$1
local CORE_PEER_LOCALMSPID=$2
local CORE_PEER_ADDRESS=$3
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
Expand Down Expand Up @@ -3303,7 +3302,7 @@ fetchChannelAndJoinTls() {
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"
rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ generateArtifacts() {
<% } %>
<%_ }) _%>
# Create directory for chaincode packages to avoid permission errors on linux
# Create directories to avoid permission errors on linux
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
}
startNetwork() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ createChannelAndJoin() {

mkdir "$DIR_NAME" && cd "$DIR_NAME"


cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .

osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}"
rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}

createChannelAndJoinTls() {
Expand All @@ -46,7 +45,7 @@ createChannelAndJoinTls() {
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"

if [ ! -d "$DIR_NAME" ]; then
mkdir "$DIR_NAME"
mkdir -p "$DIR_NAME"
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
fi

Expand All @@ -58,16 +57,15 @@ createChannelAndJoinTls() {
--client-key "${ADMIN_TLS_PRIVATE_KEY}" \
--ca-file "${TLS_CA_CERT_PATH}"

cd ..
rm -rf "$DIR_NAME"
}

fetchChannelAndJoin() {
local CHANNEL_NAME=$1

local CORE_PEER_LOCALMSPID=$2
local CORE_PEER_ADDRESS=$3
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")

local ORDERER_URL=$5

local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS
Expand All @@ -83,12 +81,11 @@ fetchChannelAndJoin() {
peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}"
peer channel join -b "${CHANNEL_NAME}"_newest.block

rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}

fetchChannelAndJoinTls() {
local CHANNEL_NAME=$1

local CORE_PEER_LOCALMSPID=$2
local CORE_PEER_ADDRESS=$3
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
Expand Down Expand Up @@ -117,5 +114,5 @@ fetchChannelAndJoinTls() {
peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"

rm -rf "$DIR_NAME"
cd .. && rm -rf "$DIR_NAME"
}

0 comments on commit 12bac57

Please sign in to comment.