Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.

Commit 985bad0

Browse files
author
Simon Stone
authored
Merge pull request #145 from sstone1/issue-80
Provide FABRIC_CFG_PATH in env for all peer commands (resolves #80)
2 parents 6763d9c + 0f1717b commit 985bad0

File tree

11 files changed

+772
-55
lines changed

11 files changed

+772
-55
lines changed

azure-pipelines.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ trigger:
1313
pool:
1414
vmImage: "ubuntu-latest"
1515

16-
variables:
17-
FABRIC_CFG_PATH: /usr/local/config
18-
1916
steps:
2017
- script: sudo apt-get update && sudo apt-get install -y moreutils
2118
displayName: Install Ubuntu dependencies

docker/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ RUN mkdir /lib64 && \
1616
wget -qO fabric-ca-bins.tar.gz https://github.com/hyperledger/fabric-ca/releases/download/v1.4.4/hyperledger-fabric-ca-linux-amd64-1.4.4.tar.gz && \
1717
tar xvf fabric-ca-bins.tar.gz -C /usr/local && \
1818
rm fabric-bins.tar.gz fabric-ca-bins.tar.gz
19-
ENV FABRIC_CFG_PATH=/usr/local/config
2019
COPY ansible-role-blockchain-platform-manager.tar.gz /usr/local/src/
2120
RUN mkdir -p /etc/ansible/roles/ibm.blockchain_platform_manager && \
2221
cd /etc/ansible/roles/ibm.blockchain_platform_manager && \

files/sampleconfig/core.yaml

Lines changed: 703 additions & 0 deletions
Large diffs are not rendered by default.

tasks/manage-channel.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
{{ '--cafile "' + ibp[channel.orderer.id].pem + '"' if ibp[channel.orderer.id].protocol == 'grpcs' else '' }}
1414
{{ '--ordererTLSHostnameOverride ' + ibp[channel.orderer.id].internal_hostname if ibp[channel.orderer.id].internal_hostname is defined else '' }}
1515
environment:
16-
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
17-
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
16+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
17+
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
18+
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
1819
register: channel_fetch
1920
failed_when: False
2021
changed_when: False

tasks/manage-channel/create-channel.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- name: Sign channel configuration update envelope
2424
command: peer channel signconfigtx -f {{ tempdir.path }}/config_update_as_envelope.pb
2525
environment:
26+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
2627
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
2728
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
2829
with_items: "{{ channel.members }}"
@@ -40,6 +41,7 @@
4041
{{ '--cafile "' + ibp[channel.orderer.id].pem + '"' if ibp[channel.orderer.id].protocol == 'grpcs' else '' }}
4142
{{ '--ordererTLSHostnameOverride ' + ibp[channel.orderer.id].internal_hostname if ibp[channel.orderer.id].internal_hostname is defined else '' }}
4243
environment:
44+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
4345
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
4446
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
4547
changed_when: True
@@ -55,6 +57,7 @@
5557
{{ '--cafile "' + ibp[channel.orderer.id].pem + '"' if ibp[channel.orderer.id].protocol == 'grpcs' else '' }}
5658
{{ '--ordererTLSHostnameOverride ' + ibp[channel.orderer.id].internal_hostname if ibp[channel.orderer.id].internal_hostname is defined else '' }}
5759
environment:
60+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
5861
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
5962
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
6063
register: channel_fetch

tasks/manage-channel/join-channel-peer.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
- name: Retrieve current channel information
66
command: peer channel getinfo -c {{ channel.name }}
77
environment:
8-
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
9-
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
10-
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
11-
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
12-
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
8+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
9+
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
10+
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
11+
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
12+
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
13+
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
1314
register: channel_getinfo
1415
failed_when: False
1516
changed_when: False
@@ -21,9 +22,10 @@
2122
- name: Join peer to channel
2223
command: peer channel join -b {{ tempdir.path }}/config_block.pb
2324
environment:
24-
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
25-
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
26-
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
27-
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
28-
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
25+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
26+
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
27+
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
28+
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
29+
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
30+
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
2931
when: not joined_channel

tasks/manage-channel/join-channel.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
{{ '--cafile "' + ibp[channel.orderer.id].pem + '"' if ibp[channel.orderer.id].protocol == 'grpcs' else '' }}
1313
{{ '--ordererTLSHostnameOverride ' + ibp[channel.orderer.id].internal_hostname if ibp[channel.orderer.id].internal_hostname is defined else '' }}
1414
environment:
15-
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
16-
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
15+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
16+
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
17+
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
1718
changed_when: False
1819

1920
- name: Join all members to channel

tasks/manage-channel/update-channel.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
{{ '--cafile "' + ibp[channel.orderer.id].pem + '"' if ibp[channel.orderer.id].protocol == 'grpcs' else '' }}
1414
{{ '--ordererTLSHostnameOverride ' + ibp[channel.orderer.id].internal_hostname if ibp[channel.orderer.id].internal_hostname is defined else '' }}
1515
environment:
16-
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
17-
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
16+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
17+
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
18+
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
1819
changed_when: False
1920

2021
- name: Decode current channel configuration block
@@ -116,8 +117,9 @@
116117
- name: Sign channel configuration update envelope
117118
command: peer channel signconfigtx -f {{ tempdir.path }}/config_update_as_envelope.pb
118119
environment:
119-
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
120-
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
120+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
121+
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
122+
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
121123
with_items: "{{ channel.members }}"
122124
loop_control:
123125
loop_var: member
@@ -133,6 +135,7 @@
133135
{{ '--cafile "' + ibp[channel.orderer.id].pem + '"' if ibp[channel.orderer.id].protocol == 'grpcs' else '' }}
134136
{{ '--ordererTLSHostnameOverride ' + ibp[channel.orderer.id].internal_hostname if ibp[channel.orderer.id].internal_hostname is defined else '' }}
135137
environment:
136-
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
137-
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
138+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
139+
CORE_PEER_MSPCONFIGPATH: "{{ channel.members[0].wallet }}/{{ channel.members[0].msp.admin.identity }}"
140+
CORE_PEER_LOCALMSPID: "{{ channel.members[0].msp.id }}"
138141
when: compute_update.rc == 0

tasks/manage-consortium.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
{{ '--cafile "' + ibp[orderer.id].pem + '"' if ibp[orderer.id].protocol == 'grpcs' else '' }}
1313
{{ '--ordererTLSHostnameOverride ' + ibp[orderer.id].internal_hostname if ibp[orderer.id].internal_hostname is defined else '' }}
1414
environment:
15-
CORE_PEER_MSPCONFIGPATH: "{{ organization.wallet }}/{{ organization.msp.admin.identity }}"
16-
CORE_PEER_LOCALMSPID: "{{ organization.msp.id }}"
15+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
16+
CORE_PEER_MSPCONFIGPATH: "{{ organization.wallet }}/{{ organization.msp.admin.identity }}"
17+
CORE_PEER_LOCALMSPID: "{{ organization.msp.id }}"
1718
changed_when: False
1819

1920
- name: Decode current system channel configuration block
@@ -99,8 +100,9 @@
99100
- name: Sign system channel configuration update envelope
100101
command: peer channel signconfigtx -f {{ tempdir.path }}/config_update_as_envelope.pb
101102
environment:
102-
CORE_PEER_MSPCONFIGPATH: "{{ organization.wallet }}/{{ organization.msp.admin.identity }}"
103-
CORE_PEER_LOCALMSPID: "{{ organization.msp.id }}"
103+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
104+
CORE_PEER_MSPCONFIGPATH: "{{ organization.wallet }}/{{ organization.msp.admin.identity }}"
105+
CORE_PEER_LOCALMSPID: "{{ organization.msp.id }}"
104106
when: compute_update.rc == 0
105107

106108
- name: Submit system channel configuration update envelope
@@ -113,6 +115,7 @@
113115
{{ '--cafile "' + ibp[orderer.id].pem + '"' if ibp[orderer.id].protocol == 'grpcs' else '' }}
114116
{{ '--ordererTLSHostnameOverride ' + ibp[orderer.id].internal_hostname if ibp[orderer.id].internal_hostname is defined else '' }}
115117
environment:
116-
CORE_PEER_MSPCONFIGPATH: "{{ organization.wallet }}/{{ organization.msp.admin.identity }}"
117-
CORE_PEER_LOCALMSPID: "{{ organization.msp.id }}"
118+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
119+
CORE_PEER_MSPCONFIGPATH: "{{ organization.wallet }}/{{ organization.msp.admin.identity }}"
120+
CORE_PEER_LOCALMSPID: "{{ organization.msp.id }}"
118121
when: compute_update.rc == 0

tasks/manage-contract/install-contract-peer.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
- name: Retrieve current installed contract list
66
command: peer chaincode list --installed
77
environment:
8-
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
9-
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
10-
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
11-
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
12-
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
8+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
9+
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
10+
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
11+
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
12+
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
13+
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
1314
register: chaincode_list
1415
failed_when: False
1516
changed_when: False
@@ -21,9 +22,10 @@
2122
- name: Install contract on peer
2223
command: peer chaincode install "{{ contract.package }}"
2324
environment:
24-
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
25-
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
26-
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
27-
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
28-
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
25+
FABRIC_CFG_PATH: "{{ role_path }}/files/sampleconfig"
26+
CORE_PEER_ADDRESS: "{{ ibp[peer.id].hostname }}:{{ ibp[peer.id].port }}"
27+
CORE_PEER_MSPCONFIGPATH: "{{ member.wallet }}/{{ member.msp.admin.identity }}"
28+
CORE_PEER_LOCALMSPID: "{{ member.msp.id }}"
29+
CORE_PEER_TLS_ENABLED: "{{ 'true' if peer.tls.enabled else 'false' }}"
30+
CORE_PEER_TLS_ROOTCERT_FILE: "{{ ibp[peer.id].pem if ibp[peer.id].pem is defined }}"
2931
when: not contract_installed

0 commit comments

Comments
 (0)