Skip to content

Commit

Permalink
Individually remove imported ordering service nodes (resolves #219) (#…
Browse files Browse the repository at this point in the history
…220)

Signed-off-by: Simon Stone <sstone1@uk.ibm.com>
  • Loading branch information
Simon Stone authored May 12, 2020
1 parent 94519a4 commit 02395b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
17 changes: 0 additions & 17 deletions plugins/module_utils/consoles.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,23 +361,6 @@ def extract_ordering_service_node_info(self, ordering_service_node):
'server_tls_cert': ordering_service_node.get('server_tls_cert', None)
}

def delete_ext_ordering_service(self, cluster_id):
self._ensure_loggedin()
url = urllib.parse.urljoin(self.api_endpoint, f'/ak/api/v2/components/tags/{cluster_id}')
headers = {
'Accepts': 'application/json',
'Content-Type': 'application/json',
'Authorization': self.authorization
}
for attempt in range(self.retries):
try:
open_url(url, None, headers, 'DELETE', validate_certs=False, timeout=self.api_timeout)
return
except Exception as e:
if self.should_retry_error(e):
continue
return self.handle_error('Failed to delete external ordering service', e)

def create_ext_ordering_service_node(self, data):
self._ensure_loggedin()
url = urllib.parse.urljoin(self.api_endpoint, '/ak/api/v2/components/fabric-orderer')
Expand Down
3 changes: 2 additions & 1 deletion plugins/modules/external_ordering_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def main():
if state == 'absent' and existing_ordering_service_exists:

# The ordering service should not exist, so delete it.
console.delete_ext_ordering_service(existing_ordering_service[0]['cluster_id'])
for ordering_service_node in existing_ordering_service:
console.delete_ext_ordering_service_node(ordering_service_node['id'])
return module.exit_json(changed=True)

elif state == 'absent':
Expand Down

0 comments on commit 02395b1

Please sign in to comment.