From 63972b4e47951e40754173c6bb93df9aad6b56a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20G=C3=B3mez=20Cepeda?= <83813093+mgCepeda@users.noreply.github.com> Date: Mon, 13 Nov 2023 08:05:12 +0100 Subject: [PATCH] [fabric] Fix playbook add organization 2.5.4 (#2422) Primary Changes -------------- Removed the platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block role. Since this playbook is used to add a peer organization. To set up an orderer type organization, the add-orderer-organization.yaml playbook will be executed. Therefore it never runs. Modifications ----------------------- platforms/hyperledger-fabric/configuration/add-organization.yaml platforms/hyperledger-fabric/configuration/roles/k8_component/templates/existing_peer_cli.tpl fixes #2399 Signed-off-by: mgCepeda --- .../configuration/add-organization.yaml | 17 ---------- .../syschannel_block/tasks/main.yaml | 34 ------------------- .../templates/syschannel_update_script.tpl | 33 ------------------ .../syschannel_block/vars/main.yaml | 11 ------ 4 files changed, 95 deletions(-) delete mode 100644 platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/tasks/main.yaml delete mode 100644 platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/templates/syschannel_update_script.tpl delete mode 100644 platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/vars/main.yaml diff --git a/platforms/hyperledger-fabric/configuration/add-organization.yaml b/platforms/hyperledger-fabric/configuration/add-organization.yaml index cb071e2d9e3..43f62571507 100644 --- a/platforms/hyperledger-fabric/configuration/add-organization.yaml +++ b/platforms/hyperledger-fabric/configuration/add-organization.yaml @@ -169,22 +169,6 @@ profile_name: "{{ item.channel_name }}" loop: "{{ network['channels'] }}" - # This role adds the new org to the existing consortium and updates the block - - - include_role: - name: "create/new_organization/syschannel_block" - vars: - build_path: "./build" - orderers: "{{ org.services.orderers }}" - docker_url: "{{ network.docker.url }}" - channel_name: "syschannel" - update_type: "tls" - component_ns: "{{ org.name | lower}}-net" - loop: "{{ network.organizations }}" - loop_control: - loop_var: org - when: org.type == 'orderer' - # This role creates the value file for peers of organisations and write couch db credentials # to the vault. - include_role: @@ -219,7 +203,6 @@ name: "setup/config_block/sign_and_update" vars: build_path: "./build" - channel_sys: "syschannel" participants: "{{ item.participants }}" docker_url: "{{ network.docker.url }}" loop: "{{ network['channels'] }}" diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/tasks/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/tasks/main.yaml deleted file mode 100644 index 2584118642f..00000000000 --- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/tasks/main.yaml +++ /dev/null @@ -1,34 +0,0 @@ -############################################################################################## -# Copyright Accenture. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -############################################################################################## - -############################################################################################ -# This task creates the generate_block.sh file for new organizations -- name: "Create create-syschannel-block.sh script file for new orderer" - template: - src: "syschannel_update_script.tpl" - dest: "./build/syschannel-update-script.sh" - vars: - component_name: "{{ org.name | lower }}" - new_org_query: "organizations[?org_status=='new']" - new_org: "{{ network | json_query(new_org_query) | first }}" - channel: "{{ network.channels | first }}" - os: "{{ fabric.os }}" - arch: "{{ fabric.arch }}" - version: "{{ network.version }}" - - -# This task calls nested_create_cli to generate the cli value files for the orderer organization -- name: Call nested_create_cli for the first orderer - include_tasks: nested_create_cli.yaml - vars: - orderer: "{{ org.services.orderers | first }}" - new_org_query: "participants[?org_status=='new']" - channel: "{{ chann }}" - new_org: "{{ chann | json_query(new_org_query) | first }}" - loop: "{{ network.channels }}" - loop_control: - loop_var: chann - when: new_org != "" diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/templates/syschannel_update_script.tpl b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/templates/syschannel_update_script.tpl deleted file mode 100644 index 11b2e0e70d0..00000000000 --- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/templates/syschannel_update_script.tpl +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -x - -CURRENT_DIR=${PWD} - -echo "installing jq " -apt-get install -y jq -echo "installing configtxlator" -mkdir temp -cd temp/ -wget https://github.com/hyperledger/fabric/releases/download/v{{ version }}/hyperledger-fabric-{{ os }}-{{ arch }}-{{ version }}.tar.gz -tar -xvf hyperledger-fabric-{{ os }}-{{ arch }}-{{ version }}.tar.gz -mv bin/configtxlator ../ -cd ../ -rm -r temp -echo "converting the channel_config_block.pb to channel_config.json using configtxlator and jq" -configtxlator proto_decode --input {{ channel_name }}_config_block.pb --type common.Block | jq .data.data[0].payload.data.config > {{ channel_name }}_config_block.json -echo "adding new organization crypto material from config.json to the channel_config.json to make channel_modified_config.json" -echo "adding org to the existing consortium" -jq -s '.[0] * {"channel_group":{"groups":{"Consortiums":{"groups": {"{{ channel.consortium }}": {"groups": {"{{ new_org.name | lower }}MSP":.[1]}}}}}}}' {{ channel_name }}_config_block.json ./config.json >& {{ channel_name }}_updated_config.json -configtxlator proto_encode --input {{ channel_name }}_config_block.json --type common.Config --output {{ channel_name }}_config.pb -configtxlator proto_encode --input {{ channel_name }}_updated_config.json --type common.Config --output {{ channel_name }}_updated_config.pb -echo "calculate the delta between these two config protobufs using configtxlator" -configtxlator compute_update --channel_id {{ channel_name }} --original {{ channel_name }}_config.pb --updated {{ channel_name }}_updated_config.pb --output {{ channel_name }}_diff_config.pb -echo "decode the channel_update.pb to json to add headers." -configtxlator proto_decode --input {{ channel_name }}_diff_config.pb --type common.ConfigUpdate | jq . > {{ channel_name }}_diff_config.json -echo "wrapping the headers arround the channel_update.json file and create channel_update_in_envelope.json" -echo '{"payload":{"header":{"channel_header":{"channel_id":"{{ channel_name | lower }}", "type":2}},"data":{"config_update":'$(cat {{ channel_name }}_diff_config.json)'}}}' | jq . > {{ channel_name }}_diff_config_envelope.json -echo "converting the channel_update_in_envelope.json to channel_update_in_envelope.pb" -configtxlator proto_encode --input {{ channel_name }}_diff_config_envelope.json --type common.Envelope --output {{ channel_name }}_diff_config_envelope.pb -mv {{ channel_name }}_config_block.pb {{ channel_name }}_config_block_old.pb -cd ${CURRENT_DIR} diff --git a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/vars/main.yaml b/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/vars/main.yaml deleted file mode 100644 index 22da8c2d586..00000000000 --- a/platforms/hyperledger-fabric/configuration/roles/create/new_organization/syschannel_block/vars/main.yaml +++ /dev/null @@ -1,11 +0,0 @@ -############################################################################################## -# Copyright Accenture. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -############################################################################################## - ---- -tmp_directory: "{{ lookup('env', 'TMPDIR') | default('/tmp',true) }}" -fabric: - os: "linux" # use "darwin" for MacOS X, "windows" for Windows - arch: "amd64" # other possible values: "386","arm64","arm","ppc64le","s390x"