Skip to content

Commit 12bac57

Browse files
committed
Create directory to avoid permission errors
Signed-off-by: Jakub Dzikowski <[email protected]>
1 parent c430c74 commit 12bac57

9 files changed

+31
-30
lines changed

e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode-raft-explorer.json.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,8 +1700,9 @@ generateArtifacts() {
17001700
printItalics "Generating genesis block for group group1" "U1F3E0"
17011701
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
17021702
1703-
# Create directory for chaincode packages to avoid permission errors on linux
1703+
# Create directories to avoid permission errors on linux
17041704
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
1705+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
17051706
}
17061707
17071708
startNetwork() {

e2e/__snapshots__/fablo-config-hlf2-1org-1chaincode.json.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,9 @@ generateArtifacts() {
16511651
printItalics "Generating genesis block for group group1" "U1F3E0"
16521652
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
16531653
1654-
# Create directory for chaincode packages to avoid permission errors on linux
1654+
# Create directories to avoid permission errors on linux
16551655
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
1656+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
16561657
}
16571658
16581659
startNetwork() {

e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-private-data.yaml.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,8 +2366,9 @@ generateArtifacts() {
23662366
printItalics "Generating genesis block for group group1" "U1F3E0"
23672367
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
23682368
2369-
# Create directory for chaincode packages to avoid permission errors on linux
2369+
# Create directories to avoid permission errors on linux
23702370
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
2371+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
23712372
}
23722373
23732374
startNetwork() {

e2e/__snapshots__/fablo-config-hlf2-2orgs-2chaincodes-raft.yaml.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3476,8 +3476,9 @@ generateArtifacts() {
34763476
printItalics "Generating genesis block for group group2" "U1F3E0"
34773477
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group2Genesis"
34783478
3479-
# Create directory for chaincode packages to avoid permission errors on linux
3479+
# Create directories to avoid permission errors on linux
34803480
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
3481+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
34813482
}
34823483
34833484
startNetwork() {

e2e/__snapshots__/fablo-config-hlf2-3orgs-1chaincode-raft-explorer.json.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3814,8 +3814,9 @@ generateArtifacts() {
38143814
printItalics "Generating genesis block for group group1" "U1F3E0"
38153815
genesisBlockCreate "$FABLO_NETWORK_ROOT/fabric-config" "$FABLO_NETWORK_ROOT/fabric-config/config" "Group1Genesis"
38163816
3817-
# Create directory for chaincode packages to avoid permission errors on linux
3817+
# Create directories to avoid permission errors on linux
38183818
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
3819+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
38193820
}
38203821
38213822
startNetwork() {

e2e/__snapshots__/fablo-config-hlf3-1orgs-1chaincode.json.test.ts.snap

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,8 +1730,9 @@ generateArtifacts() {
17301730
printItalics "Generating crypto material for Org1" "U1F512"
17311731
certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/"
17321732
1733-
# Create directory for chaincode packages to avoid permission errors on linux
1733+
# Create directories to avoid permission errors on linux
17341734
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
1735+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
17351736
}
17361737
17371738
startNetwork() {
@@ -3186,7 +3187,7 @@ createChannelAndJoin() {
31863187
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
31873188
31883189
osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}"
3189-
rm -rf "$DIR_NAME"
3190+
cd .. && rm -rf "$DIR_NAME"
31903191
}
31913192
31923193
createChannelAndJoinTls() {
@@ -3207,7 +3208,7 @@ createChannelAndJoinTls() {
32073208
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"
32083209
32093210
if [ ! -d "$DIR_NAME" ]; then
3210-
mkdir "$DIR_NAME"
3211+
mkdir -p "$DIR_NAME"
32113212
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
32123213
fi
32133214
@@ -3219,16 +3220,15 @@ createChannelAndJoinTls() {
32193220
--client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\
32203221
--ca-file "\${TLS_CA_CERT_PATH}"
32213222
3223+
cd ..
32223224
rm -rf "$DIR_NAME"
32233225
}
32243226
32253227
fetchChannelAndJoin() {
32263228
local CHANNEL_NAME=$1
3227-
32283229
local CORE_PEER_LOCALMSPID=$2
32293230
local CORE_PEER_ADDRESS=$3
32303231
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
3231-
32323232
local ORDERER_URL=$5
32333233
32343234
local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS
@@ -3244,12 +3244,11 @@ fetchChannelAndJoin() {
32443244
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}"
32453245
peer channel join -b "\${CHANNEL_NAME}"_newest.block
32463246
3247-
rm -rf "$DIR_NAME"
3247+
cd .. && rm -rf "$DIR_NAME"
32483248
}
32493249
32503250
fetchChannelAndJoinTls() {
32513251
local CHANNEL_NAME=$1
3252-
32533252
local CORE_PEER_LOCALMSPID=$2
32543253
local CORE_PEER_ADDRESS=$3
32553254
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
@@ -3278,7 +3277,7 @@ fetchChannelAndJoinTls() {
32783277
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
32793278
peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"
32803279
3281-
rm -rf "$DIR_NAME"
3280+
cd .. && rm -rf "$DIR_NAME"
32823281
}
32833282
"
32843283
`;

e2e/__snapshots__/fablo-config-hlf3-bft-1orgs-1chaincode.json.test.ts.snap

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,8 +1756,9 @@ generateArtifacts() {
17561756
printItalics "Generating crypto material for Org1" "U1F512"
17571757
certsGenerate "$FABLO_NETWORK_ROOT/fabric-config" "crypto-config-org1.yaml" "peerOrganizations/org1.example.com" "$FABLO_NETWORK_ROOT/fabric-config/crypto-config/"
17581758
1759-
# Create directory for chaincode packages to avoid permission errors on linux
1759+
# Create directories to avoid permission errors on linux
17601760
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
1761+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
17611762
}
17621763
17631764
startNetwork() {
@@ -3211,7 +3212,7 @@ createChannelAndJoin() {
32113212
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
32123213
32133214
osnadmin channel join --channelID "\${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "\${ORDERER_URL}"
3214-
rm -rf "$DIR_NAME"
3215+
cd .. && rm -rf "$DIR_NAME"
32153216
}
32163217
32173218
createChannelAndJoinTls() {
@@ -3232,7 +3233,7 @@ createChannelAndJoinTls() {
32323233
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"
32333234
32343235
if [ ! -d "$DIR_NAME" ]; then
3235-
mkdir "$DIR_NAME"
3236+
mkdir -p "$DIR_NAME"
32363237
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
32373238
fi
32383239
@@ -3244,16 +3245,15 @@ createChannelAndJoinTls() {
32443245
--client-key "\${ADMIN_TLS_PRIVATE_KEY}" \\
32453246
--ca-file "\${TLS_CA_CERT_PATH}"
32463247
3248+
cd ..
32473249
rm -rf "$DIR_NAME"
32483250
}
32493251
32503252
fetchChannelAndJoin() {
32513253
local CHANNEL_NAME=$1
3252-
32533254
local CORE_PEER_LOCALMSPID=$2
32543255
local CORE_PEER_ADDRESS=$3
32553256
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
3256-
32573257
local ORDERER_URL=$5
32583258
32593259
local DIR_NAME=step-fetchChannelAndJoin-$CHANNEL_NAME-$CORE_PEER_ADDRESS
@@ -3269,12 +3269,11 @@ fetchChannelAndJoin() {
32693269
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}"
32703270
peer channel join -b "\${CHANNEL_NAME}"_newest.block
32713271
3272-
rm -rf "$DIR_NAME"
3272+
cd .. && rm -rf "$DIR_NAME"
32733273
}
32743274
32753275
fetchChannelAndJoinTls() {
32763276
local CHANNEL_NAME=$1
3277-
32783277
local CORE_PEER_LOCALMSPID=$2
32793278
local CORE_PEER_ADDRESS=$3
32803279
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
@@ -3303,7 +3302,7 @@ fetchChannelAndJoinTls() {
33033302
peer channel fetch newest -c "\${CHANNEL_NAME}" --orderer "\${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
33043303
peer channel join -b "\${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"
33053304
3306-
rm -rf "$DIR_NAME"
3305+
cd .. && rm -rf "$DIR_NAME"
33073306
}
33083307
"
33093308
`;

src/setup-docker/templates/fabric-docker/commands-generated.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ generateArtifacts() {
2020
<% } %>
2121
2222
<%_ }) _%>
23-
# Create directory for chaincode packages to avoid permission errors on linux
23+
# Create directories to avoid permission errors on linux
2424
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/chaincode-packages"
25+
mkdir -p "$FABLO_NETWORK_ROOT/fabric-config/config"
2526
}
2627
2728
startNetwork() {

src/setup-docker/templates/fabric-docker/scripts/cli/channel_fns-v3.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ createChannelAndJoin() {
2121

2222
mkdir "$DIR_NAME" && cd "$DIR_NAME"
2323

24-
2524
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb .
2625

2726
osnadmin channel join --channelID "${CHANNEL_NAME}" --config-block ./"$CHANNEL_NAME".pb -o "${ORDERER_URL}"
28-
rm -rf "$DIR_NAME"
27+
cd .. && rm -rf "$DIR_NAME"
2928
}
3029

3130
createChannelAndJoinTls() {
@@ -46,7 +45,7 @@ createChannelAndJoinTls() {
4645
echo " TLS_CA_CERT_PATH: $TLS_CA_CERT_PATH"
4746

4847
if [ ! -d "$DIR_NAME" ]; then
49-
mkdir "$DIR_NAME"
48+
mkdir -p "$DIR_NAME"
5049
cp /var/hyperledger/cli/config/"$CHANNEL_NAME".pb "$DIR_NAME"
5150
fi
5251

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

60+
cd ..
6161
rm -rf "$DIR_NAME"
6262
}
6363

6464
fetchChannelAndJoin() {
6565
local CHANNEL_NAME=$1
66-
6766
local CORE_PEER_LOCALMSPID=$2
6867
local CORE_PEER_ADDRESS=$3
6968
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
70-
7169
local ORDERER_URL=$5
7270

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

86-
rm -rf "$DIR_NAME"
84+
cd .. && rm -rf "$DIR_NAME"
8785
}
8886

8987
fetchChannelAndJoinTls() {
9088
local CHANNEL_NAME=$1
91-
9289
local CORE_PEER_LOCALMSPID=$2
9390
local CORE_PEER_ADDRESS=$3
9491
local CORE_PEER_MSPCONFIGPATH=$(realpath "$4")
@@ -117,5 +114,5 @@ fetchChannelAndJoinTls() {
117114
peer channel fetch newest -c "${CHANNEL_NAME}" --orderer "${ORDERER_URL}" --tls --cafile "$TLS_CA_CERT_PATH"
118115
peer channel join -b "${CHANNEL_NAME}"_newest.block --tls --cafile "$TLS_CA_CERT_PATH"
119116

120-
rm -rf "$DIR_NAME"
117+
cd .. && rm -rf "$DIR_NAME"
121118
}

0 commit comments

Comments
 (0)