From 512b1ee9cc9759fb4ef9fde6723c4f98521e2f51 Mon Sep 17 00:00:00 2001 From: Simon Stone Date: Thu, 23 Apr 2020 17:43:53 +0100 Subject: [PATCH] Fix creation of components on free clusters (resolves #187) (#188) * Fix creation of components on free clusters (resolves #187) Signed-off-by: Simon Stone * Bump version to v0.0.15 Signed-off-by: Simon Stone --- galaxy.yml | 2 +- plugins/modules/certificate_authority.py | 8 +++++++- plugins/modules/ordering_service.py | 6 ++++++ plugins/modules/peer.py | 6 ++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index f7fe32fc..5a174588 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -4,7 +4,7 @@ --- namespace: ibm name: blockchain_platform -version: 0.0.14 +version: 0.0.15 readme: README.md authors: - Simon Stone diff --git a/plugins/modules/certificate_authority.py b/plugins/modules/certificate_authority.py index fef66c19..00b82cf4 100644 --- a/plugins/modules/certificate_authority.py +++ b/plugins/modules/certificate_authority.py @@ -308,10 +308,16 @@ def main(): if tlsca is not None: merge_dicts(tlsca, bccsp) - # Either create or update the peer. + # Either create or update the certificate authority. changed = False if state == 'present' and not certificate_authority_exists: + # Delete the resources and storage configuration for a new certificate + # authority being deployed to a free cluster. + if console.is_free_cluster(): + del expected_certificate_authority['resources'] + del expected_certificate_authority['storage'] + # Create the certificate authority. certificate_authority = console.create_ca(expected_certificate_authority) changed = True diff --git a/plugins/modules/ordering_service.py b/plugins/modules/ordering_service.py index 1e8d4032..aca5b292 100644 --- a/plugins/modules/ordering_service.py +++ b/plugins/modules/ordering_service.py @@ -527,6 +527,12 @@ def main(): storage=module.params['storage'] ) + # Delete the resources and storage configuration for a new ordering + # service being deployed to a free cluster. + if console.is_free_cluster(): + del expected_ordering_service['resources'] + del expected_ordering_service['storage'] + # Add the HSM configuration if it is specified. if hsm is not None: expected_ordering_service['hsm'] = dict(pkcs11endpoint=pkcs11endpoint) diff --git a/plugins/modules/peer.py b/plugins/modules/peer.py index 81319a06..b765dfce 100644 --- a/plugins/modules/peer.py +++ b/plugins/modules/peer.py @@ -535,6 +535,12 @@ def main(): changed = False if state == 'present' and not peer_exists: + # Delete the resources and storage configuration for a new peer + # being deployed to a free cluster. + if console.is_free_cluster(): + del expected_peer['resources'] + del expected_peer['storage'] + # Get the config. expected_peer['config'] = get_config(console, module)